[notmuch] [PATCH 3/3] notmuch.el: Support for customizing search result display
From: Aneesh Kumar K.VThis patch helps in customizing search result display similar to mutt's index_format. The customization is done by defining an alist as below (setq notmuch-search-result-format '(("date" . "%s ") ("authors" . "%-40s ") ("subject" . "%s ") ("tags" . "(%s)"))) The supported keywords are date, count, authors, subject and tags. tags need to be last element for it to get highlighted by notmuch-tag-face. Signed-off-by: Aneesh Kumar K.V --- notmuch.el | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/notmuch.el b/notmuch.el index 6a0c119..cbee989 100644 --- a/notmuch.el +++ b/notmuch.el @@ -125,6 +125,13 @@ pattern can still test against the entire line).") (defvar notmuch-show-body-read-visible nil) (defvar notmuch-show-citations-visible nil) (defvar notmuch-show-signatures-visible nil) +(defcustom notmuch-search-result-format nil + "Search result formating. Supported fields are + date, count, authors, subject, tags +ex: \(\(\"date\" \"%s\"\) \(\"count\" \"%-7s\) \(\"authors\" \"%-40s\"\) \(\"subject %s\"\) \(\"tag\" \"(%s)\"\)\)" +:type '(alist :key-type (string) :value-type (string)) +:group 'notmuch) + (defvar notmuch-show-headers-visible nil) ; XXX: This should be a generic function in emacs somewhere, not here @@ -1117,6 +1124,26 @@ This function advances point to the next line when finished." (insert (format " (process returned %d)" exit-status))) (insert "\n")) +(defun insert_field (field date count authors subject tags) +(if (string-equal field "date") +(insert (format (cdr (assoc field notmuch-search-result-format)) date)) + (if (string-equal field "count") +(insert (format (cdr (assoc field notmuch-search-result-format)) count)) + (if (string-equal field "authors") +(insert (format (cdr (assoc field notmuch-search-result-format)) authors)) + (if (string-equal field "subject") + (insert (format (cdr (assoc field notmuch-search-result-format)) subject)) + (if (string-equal field "tags") +(insert (format (cdr (assoc field notmuch-search-result-format)) tags))) +) + +(defun notmuch-search-show-result (date count authors subject tags) +(let ((fields) (field)) + (setq fields (mapcar 'car notmuch-search-result-format)) + (loop for field in fields + do (insert_field field date count authors subject tags))) +(insert "\n")) + (defun notmuch-search-process-filter (proc string) "Process and filter the output of \"notmuch search\"" (let ((buffer (process-buffer proc))) @@ -1139,7 +1166,9 @@ This function advances point to the next line when finished." (set 'authors (concat (substring authors 0 (- 40 3)) "..."))) (goto-char (point-max)) (let ((beg (point-marker))) - (insert (format "%s %-7s %-40s %s (%s)\n" date count authors subject tags)) + (if (not notmuch-search-result-format) + (insert (format "%s %-7s %-40s %s (%s)\n" date count authors subject tags)) + (notmuch-search-show-result date count authors subject tags)) (put-text-property beg (point-marker) 'notmuch-search-thread-id thread-id)) (set 'line (match-end 0))) (set 'more nil)) -- 1.6.5.2.74.g610f9
[notmuch] [PATCH 2/3] notmuch.el: Fix the message summary button to be active even on first column
From: Aneesh Kumar K.VThis make we have button activated even on the first column of the message summary line. Remove the inverse video overlay on the message summary line. Signed-off-by: Aneesh Kumar K.V --- notmuch.el | 15 +++ 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/notmuch.el b/notmuch.el index c1e8257..6a0c119 100644 --- a/notmuch.el +++ b/notmuch.el @@ -575,7 +575,7 @@ which this thread was originally shown." :supertype 'notmuch-button-invisibility-toggle-type) (define-button-type 'notmuch-button-body-toggle-type 'help-echo "mouse-1, RET: Show message" - 'face '(:inverse-video . t) + 'face 'message-header-other :supertype 'notmuch-button-invisibility-toggle-type ) (defun notmuch-show-markup-citations-region (beg end depth) @@ -721,13 +721,7 @@ which this thread was originally shown." (forward-line) (let ((beg (point-marker)) (btn nil)) -(end-of-line) -; Inverse video for subject -(let ((message-overlay (make-overlay beg (point - (overlay-put message-overlay 'face '(:inverse-video t)) - (setq btn (make-button (line-beginning-position) -(overlay-end message-overlay) -:type 'notmuch-button-body-toggle-type))) + (forward-line 1) (end-of-line) (let ((beg-hidden (point-marker))) @@ -747,7 +741,12 @@ which this thread was originally shown." (overlay-put (make-overlay beg-hidden end) 'invisible invis-spec) (goto-char beg) + ;; mail summary + (setq btn (make-button (line-beginning-position) + (line-end-position) + :type 'notmuch-button-body-toggle-type)) (forward-line) + ;; subject line (make-button (line-beginning-position) (line-end-position) 'invisibility-spec (cons invis-spec t) :type 'notmuch-button-headers-toggle-type)) -- 1.6.5.2.74.g610f9
[notmuch] [PATCH 1/3] Use default face for the button types so that the underlines go away
From: Alexander Botero-LowrySince we know what these buttons do it seems like the underlines are unnecessary. This also backs out the attempt at fixing the button alignment on the message row, which is broken because of some interaction with indent-rigidly in some threads --- notmuch.el | 27 +++ 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/notmuch.el b/notmuch.el index 65473ba..c1e8257 100644 --- a/notmuch.el +++ b/notmuch.el @@ -560,15 +560,23 @@ which this thread was originally shown." (force-window-update) (redisplay t)) -(define-button-type 'notmuch-button-invisibility-toggle-type 'action 'notmuch-toggle-invisible-action 'follow-link t) -(define-button-type 'notmuch-button-citation-toggle-type 'help-echo "mouse-1, RET: Show citation" +(define-button-type 'notmuch-button-invisibility-toggle-type + 'action 'notmuch-toggle-invisible-action + 'follow-link t + 'face "default") +(define-button-type 'notmuch-button-citation-toggle-type + 'help-echo "mouse-1, RET: Show citation" :supertype 'notmuch-button-invisibility-toggle-type) -(define-button-type 'notmuch-button-signature-toggle-type 'help-echo "mouse-1, RET: Show signature" +(define-button-type 'notmuch-button-signature-toggle-type + 'help-echo "mouse-1, RET: Show signature" :supertype 'notmuch-button-invisibility-toggle-type) -(define-button-type 'notmuch-button-headers-toggle-type 'help-echo "mouse-1, RET: Show headers" - :supertype 'notmuch-button-invisibility-toggle-type) -(define-button-type 'notmuch-button-body-toggle-type 'help-echo "mouse-1, RET: Show message" +(define-button-type 'notmuch-button-headers-toggle-type + 'help-echo "mouse-1, RET: Show headers" :supertype 'notmuch-button-invisibility-toggle-type) +(define-button-type 'notmuch-button-body-toggle-type + 'help-echo "mouse-1, RET: Show message" + 'face '(:inverse-video . t) + :supertype 'notmuch-button-invisibility-toggle-type ) (defun notmuch-show-markup-citations-region (beg end depth) (goto-char beg) @@ -715,8 +723,11 @@ which this thread was originally shown." (btn nil)) (end-of-line) ; Inverse video for subject -(overlay-put (make-overlay beg (point)) 'face '(:inverse-video t)) -(setq btn (make-button beg (point) :type 'notmuch-button-body-toggle-type)) +(let ((message-overlay (make-overlay beg (point + (overlay-put message-overlay 'face '(:inverse-video t)) + (setq btn (make-button (line-beginning-position) +(overlay-end message-overlay) +:type 'notmuch-button-body-toggle-type))) (forward-line 1) (end-of-line) (let ((beg-hidden (point-marker))) -- 1.6.5.2.74.g610f9
[notmuch] [PATCH 2/2] * avoid gcc 4.4.1 compiler warning due to ignored 'fflush' return value
Hi Carl, >>>>> "Carl" == Carl Worth writes: Carl> [1 ] Carl> On Mon, 23 Nov 2009 08:21:50 +0200, Dirk-Jan C. Binnema wrote: >> -#define prompt(format, ...) \ >> -do {\ >> -printf (format, ##__VA_ARGS__); \ >> -fflush (stdout);\ >> -getline (, _size, stdin); \ >> -chomp_newline (response); \ >> +#define prompt(format, ...) \ >> +do {\ >> +int ignored;\ >> +printf (format, ##__VA_ARGS__); \ >> +fflush (stdout);\ >> +ignored = getline (, _size, stdin); \ >> +chomp_newline (response); \ >> } while (0) Carl> This patch is incorrect. Ignoring the return value of getline results in Carl> the program invoking undefined behavior by reading uninitialized Carl> memory. This is easily tested by, for example, typing Control-D to Carl> provide EOF to a prompt from "notmuch setup". Carl> How about just exiting in case of EOF as in the patch below? Sure, that's the better solution, but note that my patch did not introduce the undefined behavior -- it was there before. I was trying a minimal patch to silencing the warning. Note that prompt seems to leak a bit, even after the committed patch; attached are two more micro patches to fix this and another small leak. I try to do minimal changes, but the prompt business gets a bit unwieldy. The leaks are one-time at not critical, but anyway it's always good stay vigilant. -- next part -- A non-text attachment was scrubbed... Name: 0001-notmuch-config-fix-small-leak-from-g_key_file_to_dat.patch Type: application/octet-stream Size: 491 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091201/6a42087a/attachment.obj> -- next part -- -- next part -- A non-text attachment was scrubbed... Name: 0002-free-the-response-data-from-prompt.patch Type: application/octet-stream Size: 1674 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091201/6a42087a/attachment-0001.obj> -- next part -- Best wishes, Dirk. -- Dirk-Jan C. Binnema Helsinki, Finland e:djcb at djcbsoftware.nl w:www.djcbsoftware.nl pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C
[notmuch] [PATCH 2/2] * avoid gcc 4.4.1 compiler warning due to ignored 'fflush' return value
On Tue, 01 Dec 2009 20:50:03 +0200, Dirk-Jan C. Binnema wrote: > Sure, that's the better solution, but note that my patch did not introduce the > undefined behavior -- it was there before. I was trying a minimal patch to > silencing the warning. Yes, the leak was my bug. And the warning was useful to point to the bug. That's why silencing it would have been a bad thing. > Note that prompt seems to leak a bit, even after the > committed patch; attached are two more micro patches to fix this and another > small leak. I try to do minimal changes, but the prompt business gets a bit > unwieldy. The leaks are one-time at not critical, but anyway it's always good > stay vigilant. Yes, leak fixes are always appreciated. Could you resend these as complete git commits? I see only git diffs which lack both authorship and commit messages. Also, if you can send patches as text/plain rather than application/octet-stream then it's much easier to review them by simply replying and having the patch be quoted in the reply. Thanks, -Carl -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091201/f1627db3/attachment.pgp>
[notmuch] [PATCH] Make search filters handle disjunctive queries.
On Mon, 23 Nov 2009 19:07:23 +0100, Jed Brown wrote: > notmuch-search-filter accepts now accepts an arbitrary query and will > group if necessary so that we get > > tag:inbox AND (gravy OR biscuits) > > notmuch-search-filter-tag now handles multiple terms. All terms in the > query except AND and OR are interpreted as tags. Hi Jed, Sorry this one has sat in my queue for a while. But I finally got around to it. The above commit message (and the patch below) really do implement two separate features, so really should be separated into two separate commits. I do like both of the ideas, and will be glad to commit both when they arrive separate. > This version has nice regexes and handles NOT. And that kind of commentary, (referring to a previous revision of the patch), is great in an email discussion like we're having here, but won't make any sense within the context of the log of commit messages. So such commentary is best placed *after* the "---" separator. > Signed-off-by: Jed Brown > --- That is, the commentary would go here in the original message, and then I won't have to "commit --amend" the commentary away after applying the patch. Thanks, -Carl PS. Hmm... "notmuch reply" needs to be more clever to avoid duplicate addresses in the To: and Cc: lines. See above. -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091201/40f9f12f/attachment.pgp>
[notmuch] Problem building notmuch
On Tue, 1 Dec 2009 10:33:05 +0100, Steen Manniche wrote: > Probably unusable system info: > % uname -a > Linux algorithm 2.6.31-ARCH #1 SMP PREEMPT Fri Oct 23 11:12:58 CEST > 2009 i686 Intel(R) Core(TM)2 Duo CPU P9500 @ 2.53GHz GenuineIntel > GNU/Linux This is pretty much my fault because I made the talloc package that is on AUR. The problem is that you have both talloc-1 (from the smbclient package) and talloc-2 (from the AUR talloc). The libtalloc.so symlink points at smbclient's copy, but smbclient doesn't include a pkgconfig for talloc, thus you are using the talloc-2 header and talloc-1 library. How do other distros handle talloc-1/talloc-2 incompatibility? Jed
[notmuch] [PATCH 2/3] notmuch.el: Add collapse all and expand all to notmuch-show
These two functions behave like gmail's collapse all and expand all commands. notmuch-show-collapse-all is bound to 'B' but notmuch-show-expand-all has no keybindig because I thought it is not often used. Signed-off-by: Kan-Ru Chen --- notmuch.el | 25 + 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/notmuch.el b/notmuch.el index 2526020..5b8513c 100644 --- a/notmuch.el +++ b/notmuch.el @@ -63,6 +63,7 @@ (define-key map "a" 'notmuch-show-archive-thread) (define-key map "A" 'notmuch-show-mark-read-then-archive-thread) (define-key map "b" 'notmuch-show-toggle-current-body) +(define-key map "B" 'notmuch-show-collapse-all) (define-key map "f" 'notmuch-show-forward-current) (define-key map "h" 'notmuch-show-toggle-current-header) (define-key map "m" 'message-mail) @@ -582,6 +583,30 @@ which this thread was originally shown." (push-button)) ) +(defun notmuch-show-collapse-all () + (interactive) + (save-excursion +(beginning-of-buffer) +(while (not (notmuch-show-last-message-p)) + (unless (button-at (point)) +(notmuch-show-next-button)) + (let ((invis-spec (button-get (button-at (point)) 'invisibility-spec))) +(add-to-invisibility-spec invis-spec)) + (notmuch-show-next-open-message) + ))) + +(defun notmuch-show-expand-all () + (interactive) + (save-excursion +(beginning-of-buffer) +(while (not (notmuch-show-last-message-p)) + (unless (button-at (point)) +(notmuch-show-next-button)) + (let ((invis-spec (button-get (button-at (point)) 'invisibility-spec))) +(remove-from-invisibility-spec invis-spec)) + (notmuch-show-next-message) + ))) + (define-button-type 'notmuch-button-invisibility-toggle-type 'action 'notmuch-toggle-invisible-action 'follow-link t) (define-button-type 'notmuch-button-citation-toggle-type 'help-echo "mouse-1, RET: Show citation" :supertype 'notmuch-button-invisibility-toggle-type) -- 1.6.5.3
[notmuch] [PATCH 1/3] notmuch.el: Add keybinding to toggle display of message body and headers.
I really missed this feature. Added notmuch-show-toggle-current-body and notmuch-show-toggle-current-header and bind them to 'b' and 'h'. Signed-off-by: Kan-Ru Chen --- notmuch.el | 22 ++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/notmuch.el b/notmuch.el index 65473ba..2526020 100644 --- a/notmuch.el +++ b/notmuch.el @@ -62,7 +62,9 @@ ; overlays-at to query and manipulate the current overlay. (define-key map "a" 'notmuch-show-archive-thread) (define-key map "A" 'notmuch-show-mark-read-then-archive-thread) +(define-key map "b" 'notmuch-show-toggle-current-body) (define-key map "f" 'notmuch-show-forward-current) +(define-key map "h" 'notmuch-show-toggle-current-header) (define-key map "m" 'message-mail) (define-key map "n" 'notmuch-show-next-message) (define-key map "N" 'notmuch-show-mark-read-then-next-open-message) @@ -560,6 +562,26 @@ which this thread was originally shown." (force-window-update) (redisplay t)) +(defun notmuch-show-toggle-current-body () + "Toggle the current message body." + (interactive) + (save-excursion +(notmuch-show-move-to-current-message-summary-line) +(unless (button-at (point)) + (notmuch-show-next-button)) +(push-button)) + ) + +(defun notmuch-show-toggle-current-header () + (interactive) + (save-excursion +(notmuch-show-move-to-current-message-summary-line) +(next-line) +(unless (button-at (point)) + (notmuch-show-next-button)) +(push-button)) + ) + (define-button-type 'notmuch-button-invisibility-toggle-type 'action 'notmuch-toggle-invisible-action 'follow-link t) (define-button-type 'notmuch-button-citation-toggle-type 'help-echo "mouse-1, RET: Show citation" :supertype 'notmuch-button-invisibility-toggle-type) -- 1.6.5.3
[notmuch] Problem building notmuch
Hi list, I've been trying to install notmuch but I ran into problems related to talloc and, seemingly with notmuch's understanding of the talloc.h file. ./configure affirms that all needed headers are installed: [...] Checking for Xapian development files... Yes. Checking for GMime 2.4 development files... Yes. Checking for talloc development files... Yes. Checking for valgrind development files... No. [...] but then make complains: [...] CClib/xutil.o CXX lib/database.o CXX lib/index.o CXX lib/message.o CXX lib/query.o CXX lib/thread.o ARlib/notmuch.a CXX notmuch notmuch.o: In function `main': notmuch.c:(.text+0x326): undefined reference to `_talloc_free' notmuch-config.o: In function `notmuch_config_set_user_other_email': notmuch-config.c:(.text+0x42): undefined reference to `_talloc_free' notmuch-config.o: In function `notmuch_config_close': notmuch-config.c:(.text+0x75): undefined reference to `_talloc_free' notmuch-config.o: In function `notmuch_config_set_user_primary_email': notmuch-config.c:(.text+0x1ab): undefined reference to `_talloc_free' notmuch-config.o: In function `notmuch_config_set_user_name': notmuch-config.c:(.text+0x1fb): undefined reference to `_talloc_free' notmuch-config.o:notmuch-config.c:(.text+0x24b): more undefined references to `_talloc_free' follow lib/notmuch.a(database.o): In function `_resolve_message_id_to_thread_id(_notmuch_database*, void*, char const*)': database.cc:(.text+0x186e): undefined reference to `_talloc_steal_loc' lib/notmuch.a(database.o): In function `_my_talloc_free_for_g_hash(void*)': database.cc:(.text+0x1a4c): undefined reference to `_talloc_free' lib/notmuch.a(database.o): In function `notmuch_database_add_message': database.cc:(.text+0x20e7): undefined reference to `_talloc_free' database.cc:(.text+0x216b): undefined reference to `_talloc_free' lib/notmuch.a(message.o): In function `_notmuch_message_create': message.cc:(.text+0x1ee): undefined reference to `_talloc_free' lib/notmuch.a(message.o): In function `_notmuch_message_create_for_message_id': message.cc:(.text+0x299): undefined reference to `_talloc_steal_loc' message.cc:(.text+0x372): undefined reference to `_talloc_free' lib/notmuch.a(message.o): In function `_notmuch_message_set_filename': message.cc:(.text+0xd9e): undefined reference to `_talloc_free' lib/notmuch.a(message.o): In function `_notmuch_message_add_term': message.cc:(.text+0x157e): undefined reference to `_talloc_free' lib/notmuch.a(message.o): In function `_notmuch_message_remove_term': message.cc:(.text+0x193b): undefined reference to `_talloc_free' lib/notmuch.a(message.o): In function `notmuch_message_destroy': message.cc:(.text+0x1b5a): undefined reference to `_talloc_free' lib/notmuch.a(query.o):query.cc:(.text+0x8fb): more undefined references to `_talloc_free' follow lib/notmuch.a(thread.o): In function `_thread_add_message(_notmuch_thread*, _notmuch_message*)': thread.cc:(.text+0x10c): undefined reference to `_talloc_steal_loc' lib/notmuch.a(thread.o): In function `notmuch_thread_destroy': thread.cc:(.text+0x854): undefined reference to `_talloc_free' lib/notmuch.a(message-file.o): In function `notmuch_message_file_close': message-file.c:(.text+0x5f5): undefined reference to `_talloc_free' collect2: ld returned 1 exit status make: *** [notmuch] Error 1 I have the talloc.h in /usr/include and talloc_free as well as _talloc_free is in there: % egrep "*talloc_free" /usr/include/talloc.h #define talloc_free(ctx) _talloc_free(ctx, __location__) #define talloc_destroy(ctx) talloc_free(ctx) #define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0) int _talloc_free(void *ptr, const char *location); void talloc_free_children(void *ptr); % Probably unusable system info: % uname -a Linux algorithm 2.6.31-ARCH #1 SMP PREEMPT Fri Oct 23 11:12:58 CEST 2009 i686 Intel(R) Core(TM)2 Duo CPU P9500 @ 2.53GHz GenuineIntel GNU/Linux What am I doing wrong? Best regards and thanks for the effort with notmuch! Steen
[notmuch] [patch] Trivial fix for non-root install
On Mon, 23 Nov 2009 16:41:23 +0100, Ingmar Vanhassel wrote: > Excerpts from Brett Viren's message of Mon Nov 23 16:31:47 +0100 2009: > > Installing as a normal user fails because the bash completion config > > files try to install into /etc. This trivial patch fixes this. > > Your patch breaks the more common case of installing as root user. It > now installs into /usr/etc where bash completions most likely won't be > found. Here's a compromise, which is to move the installation of the bash completion support from "make install" to a new "make install-bash". So I think we'll end up with a bunch of install- targets corresponding to each of the things in contrib. And it then shouldn't be surprising that things in contrib aren't installed by "make install". The only thing I think I'd really like beyond this is a better way to advertise the existence of the various install- targets, (maybe a message at the end of "make install" that greps and seds these out of Makefile.local?). -Carl commit 7c2c26bc4ec5fdab5c6fa72ea325d846b46929e3 Author: Carl Worth Date: Tue Dec 1 10:14:00 2009 -0800 Makefile: Add new "install-bash" target for bash completion support It was problematic to have this in "make install" since it would unconditionally try to install to /etc, (even if a non-privileged user was attempting an install to a prefix in the user's home directory, for example). diff --git a/Makefile b/Makefile index ae0f991..e42584b 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,8 @@ ifeq ($(emacs_lispdir),) emacs_lispdir = $(prefix)/share/emacs/site-lisp endif +bash_completion_dir = /etc/bash_completion.d + all_deps = Makefile Makefile.local Makefile.config \ lib/Makefile lib/Makefile.local diff --git a/Makefile.local b/Makefile.local index 1744747..aff7d2c 100644 --- a/Makefile.local +++ b/Makefile.local @@ -29,15 +29,12 @@ notmuch.1.gz: notmuch.1 $(call quiet,gzip) --stdout $^ > $@ install: all notmuch.1.gz - for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \ - $(DESTDIR)$(bash_completion_dir) ; \ + for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 ; \ do \ install -d $$d ; \ done ; install notmuch $(DESTDIR)$(prefix)/bin/ install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ - install contrib/notmuch-completion.bash \ - $(DESTDIR)$(bash_completion_dir)/notmuch install-emacs: install emacs for d in $(DESTDIR)/$(emacs_lispdir) ; \ @@ -47,5 +44,10 @@ install-emacs: install emacs install -m0644 notmuch.el $(DESTDIR)$(emacs_lispdir) install -m0644 notmuch.elc $(DESTDIR)$(emacs_lispdir) +install-bash: + install -d $(DESTDIR)$(bash_completion_dir) + install contrib/notmuch-completion.bash \ + $(DESTDIR)$(bash_completion_dir)/notmuch + SRCS := $(SRCS) $(notmuch_client_srcs) CLEAN := $(CLEAN) notmuch $(notmuch_client_modules) notmuch.elc notmuch.1.gz diff --git a/configure b/configure index 64816e0..140711f 100755 --- a/configure +++ b/configure @@ -133,6 +133,5 @@ EOF # construct the Makefile.config cat > Makefile.config <http://notmuchmail.org/pipermail/notmuch/attachments/20091201/3ebcc715/attachment-0001.pgp>
[notmuch] [PATCH] notmuch.el: Add face support to message summary and subject lines.
On Mon, 30 Nov 2009 22:10:59 +0530, "Aneesh Kumar K. V" wrote: > The subject line is already have a font face value attached. > message-header-name to show the name of the header and > message-header-subject to show the subject details. > Two faces will be merged automatically, and the button face is needed to remove the default button face (:underline t) -- Kan-Ru Chen | http://kanru.info
[notmuch] [PATCH] Fix typos in documentation strings
Let's keep the line wrapping out of the party! Signed-off-by: Fernando Carrijo --- notmuch.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notmuch.el b/notmuch.el index 65473ba..fe09d81 100644 --- a/notmuch.el +++ b/notmuch.el @@ -360,7 +360,7 @@ buffer." (notmuch-reply message-id))) (defun notmuch-show-forward-current () - "Forward a the current message." + "Forward the current message." (interactive) (with-current-notmuch-show-message (message-forward))) @@ -402,7 +402,7 @@ by searching backward)." (not (re-search-forward notmuch-show-message-begin-regexp nil t) (defun notmuch-show-message-unread-p () - "Preficate testing whether current message is unread." + "Predicate testing whether current message is unread." (member "unread" (notmuch-show-get-tags))) (defun notmuch-show-next-message () -- 1.5.6.3
[notmuch] [PATCH] Fix typos in documentation strings
One more party, one more joiner, one more patch! :) Signed-off-by: Fernando Carrijo --- notmuch.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notmuch.el b/notmuch.el index 65473ba..fe09d81 100644 --- a/notmuch.el +++ b/notmuch.el @@ -360,7 +360,7 @@ buffer." (notmuch-reply message-id))) (defun notmuch-show-forward-current () - "Forward a the current message." + "Forward the current message." (interactive) (with-current-notmuch-show-message (message-forward))) @@ -402,7 +402,7 @@ by searching backward)." (not (re-search-forward notmuch-show-message-begin-regexp nil t) (defun notmuch-show-message-unread-p () - "Preficate testing whether current message is unread." + "Predicate testing whether current message is unread." (member "unread" (notmuch-show-get-tags))) (defun notmuch-show-next-message () -- 1.5.6.3
[notmuch] [PATCH 2/2] * avoid gcc 4.4.1 compiler warning due to ignored 'fflush' return value
On Mon, 23 Nov 2009 08:21:50 +0200, Dirk-Jan C. Binnema wrote: > -#define prompt(format, ...) \ > -do { \ > - printf (format, ##__VA_ARGS__); \ > - fflush (stdout);\ > - getline (, _size, stdin); \ > - chomp_newline (response); \ > +#define prompt(format, ...) \ > +do { \ > + int ignored;\ > + printf (format, ##__VA_ARGS__); \ > + fflush (stdout);\ > + ignored = getline (, _size, stdin); \ > + chomp_newline (response); \ > } while (0) This patch is incorrect. Ignoring the return value of getline results in the program invoking undefined behavior by reading uninitialized memory. This is easily tested by, for example, typing Control-D to provide EOF to a prompt from "notmuch setup". How about just exiting in case of EOF as in the patch below? I think I'll push it now. -Carl commit eb0cf86c7a9d5cda464d4d36a9cac66f26b5529d Author: Carl Worth Date: Tue Dec 1 08:06:09 2009 -0800 notmuch setup: Exit if EOF is encountered at any prompt. If the user is explicitly providing EOF, then terminating the program is the most likely desired thing to do. This also avoids undefined behavior from continuing with an uninitialized response after ignoring the return value of getline(). diff --git a/notmuch-setup.c b/notmuch-setup.c index 5ec176d..622bbaa 100644 --- a/notmuch-setup.c +++ b/notmuch-setup.c @@ -100,12 +100,15 @@ notmuch_setup_command (unused (void *ctx), unsigned int i; int is_new; -#define prompt(format, ...)\ -do { \ - printf (format, ##__VA_ARGS__); \ - fflush (stdout);\ - getline (, _size, stdin); \ - chomp_newline (response); \ +#define prompt(format, ...)\ +do { \ + printf (format, ##__VA_ARGS__); \ + fflush (stdout);\ + if (getline (, _size, stdin) < 0) { \ + printf ("Exiting.\n"); \ + exit (1); \ + } \ + chomp_newline (response); \ } while (0) config = notmuch_config_open (ctx, NULL, _new); -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091201/44ff3d86/attachment.pgp>
[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values
On Mon, 23 Nov 2009 15:24:46 +0100, Jed Brown wrote: > >From the gcc man page: > >-Wunused-value >Warn whenever a statement computes a result that is explicitly >not used. To suppress this warning cast the unused expression >to void. This includes an expression-statement or the left- >hand side of a comma expression that contains no side effects. >For example, an expression such as x[i,j] will cause a >warning, while x[(void)i,j] will not. > >This warning is enabled by -Wall. > > But I'm confused here because I don't currently see any warnings with > gcc-4.4.2. Actually this must be a bug because I get no warnings for > the blatantly unused > > malloc(5); I'm guessing that the -Wunused-value warning doesn't consider values computed by function calls. > with -Wall -Wextra -pedantic. Anyway, if your system headers specify > __attribute__((warn_unused_result)) for write, then you could be running > into this bug/feature > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35579 Yes, this is the attribute that's triggering the warnings. I poked around in the glibc headers to see how to get this warning myself, and I finally found: make CFLAGS="-O -D_FORTIFY_SOURCE" That makes the warning appear even with gcc 4.3.4, (and the definitions in the headers suggest it will work with any gcc >= 4.1). So I've pushed the patch now, (with an updated commit message to reflect the above analysis). -Carl -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091201/40d12278/attachment-0001.pgp>
[notmuch] Requires g++, and something else?
On Tue, 1 Dec 2009 00:01:16 +, Scot wrote: > Friends, > > I'm a brand new joiner to notmuch ('course so is nearly everyone). > > I just tried compiling, and I see: > > 1. g++ is also a 'dependency' though ./configure didn't catch it. > 2. I 'make' breaks with the following error: > . > CXX lib/thread.o > AR lib/notmuch.a > CXX notmuch > /usr/bin/ld: cannot find -lz > collect2: ld returned 1 exit status > make: *** [notmuch] Error 1 > > This is a just-now git clone on a Ubuntu 9.10 machine which doesn't > happen to have too much dev stuff loaded. > Feel free to ignore this if it's been reported or it's otherwise 'known' This is because you will need the development package for zlib, package name is "zlib1g-dev", once you have the devel packages listed in the README file plus this one you shoule be able of building NotMuch successfully. Good luck, and best regards, -- Adrian Perez de Castro Igalia - Free Software Engineering -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091201/2b4e110e/attachment.pgp>
[notmuch] Requires g++, and something else?
Friends, I'm a brand new joiner to notmuch ('course so is nearly everyone). I just tried compiling, and I see: 1. g++ is also a 'dependency' though ./configure didn't catch it. 2. I 'make' breaks with the following error: . CXX lib/thread.o ARlib/notmuch.a CXX notmuch /usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status make: *** [notmuch] Error 1 This is a just-now git clone on a Ubuntu 9.10 machine which doesn't happen to have too much dev stuff loaded. Feel free to ignore this if it's been reported or it's otherwise 'known' Cheers, Scot
[notmuch] [PATCH 3/3] notmuch.el: Support for customizing search result display
From: Aneesh Kumar K.V aneesh.ku...@gmail.com This patch helps in customizing search result display similar to mutt's index_format. The customization is done by defining an alist as below (setq notmuch-search-result-format '((date . %s ) (authors . %-40s ) (subject . %s ) (tags . (%s The supported keywords are date, count, authors, subject and tags. tags need to be last element for it to get highlighted by notmuch-tag-face. Signed-off-by: Aneesh Kumar K.V aneesh.ku...@gmail.com --- notmuch.el | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/notmuch.el b/notmuch.el index 6a0c119..cbee989 100644 --- a/notmuch.el +++ b/notmuch.el @@ -125,6 +125,13 @@ pattern can still test against the entire line).) (defvar notmuch-show-body-read-visible nil) (defvar notmuch-show-citations-visible nil) (defvar notmuch-show-signatures-visible nil) +(defcustom notmuch-search-result-format nil + Search result formating. Supported fields are + date, count, authors, subject, tags +ex: \(\(\date\ \%s\\) \(\count\ \%-7s\) \(\authors\ \%-40s\\) \(\subject %s\\) \(\tag\ \(%s)\\)\) +:type '(alist :key-type (string) :value-type (string)) +:group 'notmuch) + (defvar notmuch-show-headers-visible nil) ; XXX: This should be a generic function in emacs somewhere, not here @@ -1117,6 +1124,26 @@ This function advances point to the next line when finished. (insert (format (process returned %d) exit-status))) (insert \n)) +(defun insert_field (field date count authors subject tags) +(if (string-equal field date) +(insert (format (cdr (assoc field notmuch-search-result-format)) date)) + (if (string-equal field count) +(insert (format (cdr (assoc field notmuch-search-result-format)) count)) + (if (string-equal field authors) +(insert (format (cdr (assoc field notmuch-search-result-format)) authors)) + (if (string-equal field subject) + (insert (format (cdr (assoc field notmuch-search-result-format)) subject)) + (if (string-equal field tags) +(insert (format (cdr (assoc field notmuch-search-result-format)) tags))) +) + +(defun notmuch-search-show-result (date count authors subject tags) +(let ((fields) (field)) + (setq fields (mapcar 'car notmuch-search-result-format)) + (loop for field in fields + do (insert_field field date count authors subject tags))) +(insert \n)) + (defun notmuch-search-process-filter (proc string) Process and filter the output of \notmuch search\ (let ((buffer (process-buffer proc))) @@ -1139,7 +1166,9 @@ This function advances point to the next line when finished. (set 'authors (concat (substring authors 0 (- 40 3)) ...))) (goto-char (point-max)) (let ((beg (point-marker))) - (insert (format %s %-7s %-40s %s (%s)\n date count authors subject tags)) + (if (not notmuch-search-result-format) + (insert (format %s %-7s %-40s %s (%s)\n date count authors subject tags)) + (notmuch-search-show-result date count authors subject tags)) (put-text-property beg (point-marker) 'notmuch-search-thread-id thread-id)) (set 'line (match-end 0))) (set 'more nil)) -- 1.6.5.2.74.g610f9 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [patch] Trivial fix for non-root install
On Mon, 23 Nov 2009 16:41:23 +0100, Ingmar Vanhassel ing...@exherbo.org wrote: Excerpts from Brett Viren's message of Mon Nov 23 16:31:47 +0100 2009: Installing as a normal user fails because the bash completion config files try to install into /etc. This trivial patch fixes this. Your patch breaks the more common case of installing as root user. It now installs into /usr/etc where bash completions most likely won't be found. Here's a compromise, which is to move the installation of the bash completion support from make install to a new make install-bash. So I think we'll end up with a bunch of install-foo targets corresponding to each of the things in contrib. And it then shouldn't be surprising that things in contrib aren't installed by make install. The only thing I think I'd really like beyond this is a better way to advertise the existence of the various install-foo targets, (maybe a message at the end of make install that greps and seds these out of Makefile.local?). -Carl commit 7c2c26bc4ec5fdab5c6fa72ea325d846b46929e3 Author: Carl Worth cwo...@cworth.org Date: Tue Dec 1 10:14:00 2009 -0800 Makefile: Add new install-bash target for bash completion support It was problematic to have this in make install since it would unconditionally try to install to /etc, (even if a non-privileged user was attempting an install to a prefix in the user's home directory, for example). diff --git a/Makefile b/Makefile index ae0f991..e42584b 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,8 @@ ifeq ($(emacs_lispdir),) emacs_lispdir = $(prefix)/share/emacs/site-lisp endif +bash_completion_dir = /etc/bash_completion.d + all_deps = Makefile Makefile.local Makefile.config \ lib/Makefile lib/Makefile.local diff --git a/Makefile.local b/Makefile.local index 1744747..aff7d2c 100644 --- a/Makefile.local +++ b/Makefile.local @@ -29,15 +29,12 @@ notmuch.1.gz: notmuch.1 $(call quiet,gzip) --stdout $^ $@ install: all notmuch.1.gz - for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \ - $(DESTDIR)$(bash_completion_dir) ; \ + for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 ; \ do \ install -d $$d ; \ done ; install notmuch $(DESTDIR)$(prefix)/bin/ install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ - install contrib/notmuch-completion.bash \ - $(DESTDIR)$(bash_completion_dir)/notmuch install-emacs: install emacs for d in $(DESTDIR)/$(emacs_lispdir) ; \ @@ -47,5 +44,10 @@ install-emacs: install emacs install -m0644 notmuch.el $(DESTDIR)$(emacs_lispdir) install -m0644 notmuch.elc $(DESTDIR)$(emacs_lispdir) +install-bash: + install -d $(DESTDIR)$(bash_completion_dir) + install contrib/notmuch-completion.bash \ + $(DESTDIR)$(bash_completion_dir)/notmuch + SRCS := $(SRCS) $(notmuch_client_srcs) CLEAN := $(CLEAN) notmuch $(notmuch_client_modules) notmuch.elc notmuch.1.gz diff --git a/configure b/configure index 64816e0..140711f 100755 --- a/configure +++ b/configure @@ -133,6 +133,5 @@ EOF # construct the Makefile.config cat Makefile.config EOF prefix = /usr/local -bash_completion_dir = /etc/bash_completion.d CFLAGS += ${have_valgrind} EOF pgpqjIgDqAQUT.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH 2/2] * avoid gcc 4.4.1 compiler warning due to ignored 'fflush' return value
Hi Carl, Carl == Carl Worth cwo...@cworth.org writes: Carl [1 text/plain (quoted-printable)] Carl On Mon, 23 Nov 2009 08:21:50 +0200, Dirk-Jan C. Binnema djcb.b...@gmail.com wrote: -#define prompt(format, ...) \ -do {\ -printf (format, ##__VA_ARGS__); \ -fflush (stdout);\ -getline (response, response_size, stdin); \ -chomp_newline (response); \ +#define prompt(format, ...) \ +do {\ +int ignored;\ +printf (format, ##__VA_ARGS__); \ +fflush (stdout);\ +ignored = getline (response, response_size, stdin); \ +chomp_newline (response); \ } while (0) Carl This patch is incorrect. Ignoring the return value of getline results in Carl the program invoking undefined behavior by reading uninitialized Carl memory. This is easily tested by, for example, typing Control-D to Carl provide EOF to a prompt from notmuch setup. Carl How about just exiting in case of EOF as in the patch below? Sure, that's the better solution, but note that my patch did not introduce the undefined behavior -- it was there before. I was trying a minimal patch to silencing the warning. Note that prompt seems to leak a bit, even after the committed patch; attached are two more micro patches to fix this and another small leak. I try to do minimal changes, but the prompt business gets a bit unwieldy. The leaks are one-time at not critical, but anyway it's always good stay vigilant. 0001-notmuch-config-fix-small-leak-from-g_key_file_to_dat.patch Description: Binary data 0002-free-the-response-data-from-prompt.patch Description: Binary data Best wishes, Dirk. -- Dirk-Jan C. Binnema Helsinki, Finland e:d...@djcbsoftware.nl w:www.djcbsoftware.nl pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch