Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 44228431FBC for ; Tue, 24 Nov 2009 21:24:12 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IiFj36NLLJAG for ; Tue, 24 Nov 2009 21:24:11 -0800 (PST) Received: from mail-yw0-f200.google.com (mail-yw0-f200.google.com [209.85.211.200]) by olra.theworths.org (Postfix) with ESMTP id 83ED0431FAE for ; Tue, 24 Nov 2009 21:24:11 -0800 (PST) Received: by ywh38 with SMTP id 38so6685448ywh.6 for ; Tue, 24 Nov 2009 21:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:to:subject :in-reply-to:references:date:message-id:mime-version:content-type; bh=EVgPASpy/G7L2S8T/Pcyx12L6l8s7Si9ZGlKwM9b/zA=; b=JrawpXxaaKSu4TUx5aWdQkCn4q6J6YYBM1iVvboYPcjscxNoPF8VcUz+RT2a5PFD5L aXePKm75leYppqoXKhg0JSd0/InNn1Uzkt+r6ittQL764DZ7QclJKCpx4MwDIUmajC1U ycaZINUqJ7tsTjyIUZTHtjeGcphwGr3XeHcLM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:date:message-id:mime-version :content-type; b=eY+n/+IR88yykPTFzG0ZUtsBIhiHimOjC+rse/Ii5KRGBRPa59MwjKAZWvxNlBQ+iI rrrUSoYAhuHM/F4HYpbvlY2XzEkQNPh0Ae5c05T8XxIA0julS1kFqsCTsaelVyOOmpJI DFpp4IvVpJxEI0Op/2vONkYXnivl6fPUn8f9o= Received: by 10.150.172.38 with SMTP id u38mr12673360ybe.328.1259126644847; Tue, 24 Nov 2009 21:24:04 -0800 (PST) Received: from fortitudo (70-36-144-85.dsl.dynamic.sonic.net [70.36.144.85]) by mx.google.com with ESMTPS id 15sm2944590gxk.4.2009.11.24.21.24.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 24 Nov 2009 21:24:03 -0800 (PST) Received: from alexbl (uid 1001) (envelope-from alexbl@fortitudo.i-did-not-set--mail-host-address--so-tickle-me) id 7037 by fortitudo (DragonFly Mail Agent) Tue, 24 Nov 2009 21:24:08 -0800 From: Alexander Botero-Lowry To: "Aneesh Kumar K.V" , notmuch@notmuchmail.org In-Reply-To: <1259125080-18708-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1259125080-18708-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Date: Tue, 24 Nov 2009 21:24:07 -0800 Message-ID: <86fx83qirs.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [notmuch] [PATCH -v4] notmuch.el: Add face support to search and show mode X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2009 05:24:12 -0000 On Wed, 25 Nov 2009 10:28:00 +0530, "Aneesh Kumar K.V" wrote: > This add two faces, notmuch-show-subject-face and > notmuch-tag-face. The first face is used to show the subject > line in the notmuch-show-mode and the second one to show tags > in the notmuch-search-mode. > First, I definetly think fontification is the way to go instead of the adhoc/crappy way that cworth and I have been doing this in the past. [snip] > +(defvar notmuch-show-font-lock-keywords > + (list ;; header in font-lock-type-face > + (list "\\(Subject:.*$\\)" > + '(1 'notmuch-show-subject-face))) > + "Additonal expression to hightlight in notmuch-show-mode") > + So what happens if I have Subject: xxxx in my message? We already ran into a problem where a patch sent the list that included notmuch control character caused it to go into an infinite loop, I'd prefer our fontification code be a bit more resilient. At the very least this should use the font-lock syntax tables stuff to only do header fontification when inside the header block. This would probably require that fontification occur before the message is post-processed by notmuch-show to remove the section markers etc. Also +1 for more subduded colors than red. :) Possibly consider copying the message-mode colors, so that there is a bit of consistency between sending and viewing mail? Might even be able to steal the message-mode faces by importing their symbols. [snip] > (defun notmuch-search-mode () > "Major mode for searching mail with notmuch. > @@ -865,7 +888,18 @@ global search. > (setq truncate-lines t) > (setq major-mode 'notmuch-search-mode > mode-name "notmuch-search") > - (setq buffer-read-only t)) > + (setq buffer-read-only t) > + (if (not notmuch-tag-face-alist) > + (add-to-list 'notmuch-search-font-lock-keywords (list > + "\\(([^)]*)$\\)" '(1 'notmuch-tag-face))) This way of detecting the tags seems ok, but I think it would be nicer if it could be done even more deterministically. :) One idea that be neat is to have a --format=sexp for notmuch search, which exports sexps (probably alists, but could be some other format) for the search results that can just be eval'd and processed in a cleaner way (and would also make for nicer APIs in emacs for querying notmuch itself). Actually I really like the idea of a sexp output mode for show too, instead of the markers.... *plots* > + (progn > + (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)) > + (loop for notmuch-search-tag in notmuch-search-tags > + do (add-to-list 'notmuch-search-font-lock-keywords (list > + (concat "\\(" notmuch-search-tag "\\)") > + `(1 ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist)))))))) > + (set (make-local-variable 'font-lock-defaults) > + '(notmuch-search-font-lock-keywords t))) > I don't really see the point of fontifying all tags the same way if no tag-faces have been set, especially if none of the rest of the search results are fontified. Alex