[PATCH] build: check .git directory existence in srcdir (for out-of-tree builds)
So that $(VERSION) and version.stamp uses the git-describe -based version data instead of the content of `version' file. For consistency also the git commands in Makefile[.local] target `verify-no-dirty-code' uses the git --git-dir=$srcdir/.git ... commands (inside ifeq($(IS_GIT),yes)). Attempting to make this target outside of the tree will fail in any case. --- Makefile.local | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.local b/Makefile.local index f0c4453574b8..a9a6df8bf0e0 100644 --- a/Makefile.local +++ b/Makefile.local @@ -10,10 +10,10 @@ # repository), we let git append identification of the actual commit. PACKAGE=notmuch -IS_GIT=$(shell if [ -d .git ] ; then echo yes ; else echo no; fi) +IS_GIT=$(shell if [ -d ${srcdir}/.git ] ; then echo yes ; else echo no; fi) ifeq ($(IS_GIT),yes) -DATE:=$(shell git log --date=short -1 --pretty=format:%cd) +DATE:=$(shell git --git-dir=${srcdir}/.git log --date=short -1 --pretty=format:%cd) else DATE:=$(shell date +%F) endif @@ -21,7 +21,7 @@ endif VERSION:=$(shell cat ${srcdir}/version) ifeq ($(filter release release-message pre-release update-versions,$(MAKECMDGOALS)),) ifeq ($(IS_GIT),yes) -VERSION:=$(shell git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/) +VERSION:=$(shell git --git-dir=${srcdir}/.git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/) # Write the file 'version.stamp' in case its contents differ from $(VERSION) FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || vs=; echo $$vs) ifneq ($(FILE_VERSION),$(VERSION)) @@ -200,11 +200,11 @@ verify-source-tree-and-version: verify-no-dirty-code verify-no-dirty-code: release-checks ifeq ($(IS_GIT),yes) @printf "Checking that source tree is clean..." -ifneq ($(shell git ls-files -m),) +ifneq ($(shell git --git-dir=${srcdir}/.git ls-files -m),) @echo "No" @echo "The following files have been modified since the most recent git commit:" @echo "" - @git ls-files -m + @git --git-dir=${srcdir}/.git ls-files -m @echo "" @echo "The release will be made from the committed state, but perhaps you meant" @echo "to commit this code first? Please clean this up to make it more clear." -- 1.8.0
[PATCH 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.
On Tue, May 06 2014, Charles Celerier wrote: > Tomi Ollila writes: > >> On Tue, May 06 2014, Charles Celerier wrote: >> >>> The Mac OS X platform uses *.dylib object files instead of *.so object >>> files for linking. Adding the path to notmuch.dylib to the end of >>> DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to >>> notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see >>> dyld(1)). >> >> This series LGTM. I don't understand this difference suffixing >> DYLD_FALLBACK_LIBRARY_PATH with $TEST_DIRECTORY/../lib on Mac OS X >> compared to prefixing LD_LIBRARY_PATH with the same on other >> systems, so I take your word that it works :D > > I just went back and read dyld(1) again. Prefixing would be fine, and I > agree it would look cleaner. That would also be less confusing. You could send a replacement patch 4/5 and use id:1399395748-44920-5-git-send-email-cceleri at cs.stanford.edu as reply-to: let's see how nmbug sorts those patches, then :D Tomi > >>> >>> Signed-off-by: Charles Celerier >>> --- >>> test/T360-symbol-hiding.sh | 9 - >>> 1 file changed, 8 insertions(+), 1 deletion(-) >>> >>> diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh >>> index 636ec91..97c734a 100755 >>> --- a/test/T360-symbol-hiding.sh >>> +++ b/test/T360-symbol-hiding.sh >>> @@ -12,7 +12,14 @@ test_description='exception symbol hiding' >>> . ./test-lib.sh >>> >>> run_test(){ >>> - >>> result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >>> $TEST_DIRECTORY/symbol-test 2>&1) >>> +case $(uname -s) in >>> +Darwin) >>> + >>> result=$(DYLD_FALLBACK_LIBRARY_PATH="${DYLD_FALLBACK_LIBRARY_PATH:+$DYLD_FALLBACK_LIBRARY_PATH:}$TEST_DIRECTORY/../lib" >>> $TEST_DIRECTORY/symbol-test 2>&1) >>> +;; >>> +*) >>> + >>> result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >>> $TEST_DIRECTORY/symbol-test 2>&1) >>> +;; >>> +esac >>> } >>> >>> output="A Xapian exception occurred opening database: Couldn't stat >>> 'fakedb/.notmuch/xapian' >>> -- >>> 1.8.5.2 (Apple Git-48) >>> >>> ___ >>> notmuch mailing list >>> notmuch at notmuchmail.org >>> http://notmuchmail.org/mailman/listinfo/notmuch > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 2/2] test: redirect gdb output to a file.
It seems that the normal output redirection in the test suite doesn't work for gdb, but it's nice to have output in a file for debugging. --- test/T380-atomicity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh index 1c786fa..2daef90 100755 --- a/test/T380-atomicity.sh +++ b/test/T380-atomicity.sh @@ -64,7 +64,7 @@ if test_require_external_prereq gdb; then # -tty /dev/null works around a conflict between the 'timeout' wrapper # and gdb's attempt to control the TTY. export MAIL_DIR -gdb -tty /dev/null -batch -x $TEST_DIRECTORY/atomicity.gdb notmuch >/dev/null 2>/dev/null +gdb -tty /dev/null -batch -x $TEST_DIRECTORY/atomicity.gdb notmuch 1>gdb.out 2>&1 # Get the final, golden output notmuch search '*' > expected -- 1.9.2
[PATCH 1/2] test: allow pending break points in atomicity script.
This seems to fix problems with the symbol rename not being defined at startup on at least OS/X and some Debian Linux architectures. --- test/atomicity.gdb | 4 1 file changed, 4 insertions(+) diff --git a/test/atomicity.gdb b/test/atomicity.gdb index fd67525..15adb16 100644 --- a/test/atomicity.gdb +++ b/test/atomicity.gdb @@ -18,6 +18,10 @@ shell echo 0 > outcount shell touch inodes +# work around apparent issue with lazy library loading on some +# platforms +set breakpoint pending on + break rename commands # As an optimization, only consider snapshots after a Xapian commit. -- 1.9.2
No subject
The first of these fixes a build failure on Debian Linux/armhf (and OS/X). If the patch seems ok, I'd like to roll it into a bug fix release. The second is more of a suggestion to make that atomicity test easier to debug, since it seems to find the dark corners of gdb.
[PATCH] emacs: Correct the documentation for `notmuch-search-line-faces'.
On Tue, May 06 2014, David Edmondson wrote: > The implementation and documentation for `notmuch-search-line-faces' > disagreed in how elements in the list were merged. Correct the > documentation to match the implementation (that is, the earlier > elements in the list have precedence over later elements). LGTM. Tomi > --- > emacs/notmuch.el | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el > index 6c0bc1b..8aa0104 100644 > --- a/emacs/notmuch.el > +++ b/emacs/notmuch.el > @@ -647,12 +647,12 @@ of the result." > Here is an example of how to color search results based on tags. > (the following text would be placed in your ~/.emacs file): > > - (setq notmuch-search-line-faces '((\"deleted\" . (:foreground \"red\" > - :background \"blue\")) > - (\"unread\" . (:foreground \"green\" > + (setq notmuch-search-line-faces '((\"unread\" . (:foreground \"green\")) > + (\"deleted\" . (:foreground \"red\" > + :background \"blue\" > > -The attributes defined for matching tags are merged, with later > -attributes overriding earlier. A message having both \"deleted\" > +The attributes defined for matching tags are merged, with earlier > +attributes overriding later. A message having both \"deleted\" > and \"unread\" tags with the above settings would have a green > foreground and blue background." >:type '(alist :key-type (string) :value-type (custom-face-edit)) > -- > 2.0.0.rc0 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[no subject]
On Tue, May 06 2014, David Bremner wrote: > The first of these fixes a build failure on Debian Linux/armhf (and > OS/X). If the patch seems ok, I'd like to roll it into a bug fix > release. The second is more of a suggestion to make that atomicity > test easier to debug, since it seems to find the dark corners of gdb. Series LGTM. Tomi
[PATCH 3/5] atomicity.gdb: Allow breakpoint symbols to be resolved later.
On Tue, May 06 2014, Charles Celerier wrote: > On the Mac OS X platform, the rename() function symbol is not found > until the debugger begins running. The reason for this is unknown, but > allowing breakpoint symbols to be resolved later both solves the problem > and does not change the test. > > Signed-off-by: Charles Celerier > --- > test/atomicity.gdb | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/test/atomicity.gdb b/test/atomicity.gdb > index fd67525..127dc8f 100644 > --- a/test/atomicity.gdb > +++ b/test/atomicity.gdb > @@ -18,6 +18,9 @@ shell echo 0 > outcount > > shell touch inodes > > +# for gdb on mac > +set breakpoint pending on > + actually this particular patch could be taken from David's series as it has better comment: id:1399381588-26271-2-git-send-email-david at tethera.net > break rename > commands > # As an optimization, only consider snapshots after a Xapian commit. > -- > 1.8.5.2 (Apple Git-48) > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.
On Tue, May 06 2014, Charles Celerier wrote: > The Mac OS X platform uses *.dylib object files instead of *.so object > files for linking. Adding the path to notmuch.dylib to the end of > DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to > notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see > dyld(1)). This series LGTM. I don't understand this difference suffixing DYLD_FALLBACK_LIBRARY_PATH with $TEST_DIRECTORY/../lib on Mac OS X compared to prefixing LD_LIBRARY_PATH with the same on other systems, so I take your word that it works :D Tomi > > Signed-off-by: Charles Celerier > --- > test/T360-symbol-hiding.sh | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh > index 636ec91..97c734a 100755 > --- a/test/T360-symbol-hiding.sh > +++ b/test/T360-symbol-hiding.sh > @@ -12,7 +12,14 @@ test_description='exception symbol hiding' > . ./test-lib.sh > > run_test(){ > - > result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" > $TEST_DIRECTORY/symbol-test 2>&1) > +case $(uname -s) in > +Darwin) > + > result=$(DYLD_FALLBACK_LIBRARY_PATH="${DYLD_FALLBACK_LIBRARY_PATH:+$DYLD_FALLBACK_LIBRARY_PATH:}$TEST_DIRECTORY/../lib" > $TEST_DIRECTORY/symbol-test 2>&1) > +;; > +*) > + > result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" > $TEST_DIRECTORY/symbol-test 2>&1) > +;; > +esac > } > > output="A Xapian exception occurred opening database: Couldn't stat > 'fakedb/.notmuch/xapian' > -- > 1.8.5.2 (Apple Git-48) > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] emacs: Correct the documentation for `notmuch-search-line-faces'.
LGTM too +1 Mark On Tue, 06 May 2014, Tomi Ollila wrote: > On Tue, May 06 2014, David Edmondson wrote: > >> The implementation and documentation for `notmuch-search-line-faces' >> disagreed in how elements in the list were merged. Correct the >> documentation to match the implementation (that is, the earlier >> elements in the list have precedence over later elements). > > LGTM. > > Tomi > > > >> --- >> emacs/notmuch.el | 10 +- >> 1 file changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/emacs/notmuch.el b/emacs/notmuch.el >> index 6c0bc1b..8aa0104 100644 >> --- a/emacs/notmuch.el >> +++ b/emacs/notmuch.el >> @@ -647,12 +647,12 @@ of the result." >> Here is an example of how to color search results based on tags. >> (the following text would be placed in your ~/.emacs file): >> >> - (setq notmuch-search-line-faces '((\"deleted\" . (:foreground \"red\" >> - :background \"blue\")) >> - (\"unread\" . (:foreground \"green\" >> + (setq notmuch-search-line-faces '((\"unread\" . (:foreground \"green\")) >> + (\"deleted\" . (:foreground \"red\" >> + :background \"blue\" >> >> -The attributes defined for matching tags are merged, with later >> -attributes overriding earlier. A message having both \"deleted\" >> +The attributes defined for matching tags are merged, with earlier >> +attributes overriding later. A message having both \"deleted\" >> and \"unread\" tags with the above settings would have a green >> foreground and blue background." >>:type '(alist :key-type (string) :value-type (custom-face-edit)) >> -- >> 2.0.0.rc0 >> >> ___ >> notmuch mailing list >> notmuch at notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] emacs: hello: allow arbitrary lisp for generating the count.
This allows a function to be given for the count-query of a saved search. The function will be called with the query plist as an argument to generate the count shown and should return either a string or a number to be displayed as the count. If this option is a function then its query will not be part of the normal bacth query used so it may make notmuch-hello slower to display. --- There was some discussion on irc today about notmuch hello being slow (because it can make a lot of queries). This extends the new saved-searches :count-query option to allow aribtrary lisp functions. Thus a user could configure some searches to be (lambda (elem) "--") so that these searches do not have a count executed and just display "--". Alternatively (and at the risk of some slow down) they could configure them to be my-notmuch-count where (defun my-notmuch-count (elem) (concat (notmuch-hello-nice-number (string-to-number (car (process-lines notmuch-command "count" "--output=messages" (plist-get elem :query) "/" (notmuch-hello-nice-number (string-to-number (car (process-lines notmuch-command "count" "--output=threads" (plist-get elem :query))) which would display messages/threads for that particular query. Maybe the interface is too complicated but I can actually imagine using this (possibly even both of the above for different of my saved searches!) Best wishes Mark emacs/notmuch-hello.el | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 3de5238..877c84f 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -85,7 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v"))) (checklist :inline t :format "%v" -(group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")) +(group :format "%v" :inline t (const :format "Count-Query: " :count-query) (sexp :format "%v")) (group :format "%v" :inline t (const :format "" :sort-order) (choice :tag " Sort Order" (const :tag "Default" nil) @@ -101,9 +101,12 @@ (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox") :nameName of the search (required). :query Search to run (required). - :count-query Optional extra query to generate the count - shown. If not present then the :query property - is used. + :count-query Optional extra lisp to generate the count + shown. If it is a string then it is a query + string for generating the count. If it is a + function then the function is called with the + query plist as a parameter. If it is nil or not + present then the :query property is used. :sort-order Specify the sort order to be used for the search. Possible values are 'oldest-first 'newest-first or nil. Nil means use the default sort order. @@ -493,13 +496,14 @@ (defun notmuch-hello-query-counts (query-list options) (dolist (elem query-list nil) (let ((count-query (or (notmuch-saved-search-get elem :count-query) (notmuch-saved-search-get elem :query - (insert -(replace-regexp-in-string - "\n" " " - (notmuch-hello-filtered-query count-query - (or (plist-get options :filter-count) - (plist-get options :filter - "\n"))) + (unless (functionp count-query) + (insert + (replace-regexp-in-string + "\n" " " + (notmuch-hello-filtered-query count-query + (or (plist-get options :filter-count) + (plist-get options :filter + "\n" (unless (= (call-process-region (point-min) (point-max) notmuch-command t t nil "count" "--batch") 0) @@ -515,12 +519,17 @@ (defun notmuch-hello-query-counts (query-list options) (mapcar (lambda (elem) (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)) + (count-query (plist-get elem-plist :count-query)) (search-query (plist-get elem-plist :query)) (filtered-query (notmuch-hello-filtered-query search-query (plist-get options :filter))) - (message-count (prog1 (read (current-buffer)) - (forward-line 1 - (when
[RFC] [PATCH] emacs: Add support for saved search accelerators.
Hi Yes this looks nice modulo polishing. I think the nifty window-splitting Austin's notmuch-go does is moderately orthogonal to the keyboard shortcuts (since shortcuts can be used without it, and it could be used for other things too) On Tue, 06 May 2014, David Edmondson wrote: > Extended the saved search definition to allow the inclusion of an > accelerator key for the search. Bind 'j' in the common mode map as a > leader for such accelerator keys. > --- > > This arose out a conversation in #notmuch and Mark's patch to extend > the saved search custom specification based on requirements for an > external package (Austin's notmuch-go.el). > > Re-organising the layout of the saved searches is missing (as it's > lots of fiddling about with absolute numbers and I didn't want to > waste time on it if this is going nowhere), so the saved searches may > not all line up correctly in notmuch-hello. > > emacs/notmuch-hello.el | 8 ++-- > emacs/notmuch-lib.el | 27 +++ > 2 files changed, 33 insertions(+), 2 deletions(-) > > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el > index 3de5238..56379ef 100644 > --- a/emacs/notmuch-hello.el > +++ b/emacs/notmuch-hello.el > @@ -85,6 +85,7 @@ searches so they still work in customize." > (group :format "%v" :inline t (const :format " Query: " > :query) (string :format "%v"))) > (checklist :inline t >:format "%v" > + (group :format "%v" :inline t (const :format "Key: " > :key) (string :format "%v")) if you use key-sequence rather than string then this is a bit nicer. It allows a multiple key press binding: eg "n i" or "C-n". >(group :format "%v" :inline t (const :format "Count-Query: > " :count-query) (string :format "%v")) >(group :format "%v" :inline t (const :format "" > :sort-order) > (choice :tag " Sort Order" > @@ -551,7 +552,8 @@ with `notmuch-hello-query-counts'." > (when elem > (if (> column-indent 0) > (widget-insert (make-string column-indent ? ))) > - (let* ((name (plist-get elem :name)) > + (let* ((key (plist-get elem :key)) > + (name (plist-get elem :name)) >(query (plist-get elem :query)) >(oldest-first (case (plist-get elem :sort-order) >(newest-first nil) > @@ -564,7 +566,9 @@ with `notmuch-hello-query-counts'." > :notify #'notmuch-hello-widget-search > :notmuch-search-terms query > :notmuch-search-oldest-first oldest-first > -name) > +(if key > +(concat name " (" key ")") > + name)) I think it might be worth having an option to suppress the display of the binding: I think inbox (i) would annoy me, but it is good for discoverability. I, personally, would be completely happy without the displayed binding. Actually just a thought: could ? in jump-mode-map be bound to something that displayed the bindings? > (setq column-indent > (1+ (max 0 (- column-width (length name))) > (setq count (1+ count)) > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el > index 2941da3..9aa7ba7 100644 > --- a/emacs/notmuch-lib.el > +++ b/emacs/notmuch-lib.el > @@ -130,6 +130,7 @@ For example, if you wanted to remove an \"inbox\" tag and > add an > (define-key map "m" 'notmuch-mua-new-mail) > (define-key map "=" 'notmuch-refresh-this-buffer) > (define-key map "G" 'notmuch-poll-and-refresh-this-buffer) > +(define-key map "j" 'notmuch-jump) > map) >"Keymap shared by all notmuch modes.") > > @@ -845,6 +846,32 @@ status." > (defvar notmuch-show-process-crypto nil) > (make-variable-buffer-local 'notmuch-show-process-crypto) > > +;; Jump key support: > + > +(defvar notmuch-jump-search nil) > +(defun notmuch-jump-map () > + (let ((map (make-sparse-keymap))) > +(set-keymap-parent map nil) if you make the parent keymap the minibuffer-local-map then the various exits from the minibuffer work (ctrl-g and return for example) > +(suppress-keymap map) > +(dolist (saved-search notmuch-saved-searches) > + (let ((key (plist-get saved-search :key))) > + (when key > + (define-key map key `(lambda () > + (interactive) > + (setq notmuch-jump-search ',saved-search) > + (exit-minibuffer) > + ) > +map)) > + > +(defun notmuch-jump () > + "Read a saved search accelerator key and perform the associated > +search." > + (interactive) > + (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map)) > + (when
notmuch release 0.18 now available
reading, and tagging large collections of email messages in maildir or mh format. It uses the Xapian library to provide fast, full-text search with a convenient search syntax. For more about notmuch, see http://notmuchmail.org -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 647 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140506/af9ab4b9/attachment.pgp>
Improving spam-tagging keybinding function to act on region in emacs
Hello As this section was rather outdated I have updated to modern notmuch. (In fact the lisp snippets should work back to at least 0.13) On Tue, 06 May 2014, Olivier Berger wrote: > Hi. > > I've tried tu use the tips indicated at > http://notmuchmail.org/emacstips/#index8h2 so as to add a keybinding to > tag spam messages, and wonder if there's a possibility to make it apply > on selected regions, like what notmuch-search-archive-thread does. I have added a snippet showing how to do this (and noted that is not possible in notmuch-tree as we don't have a tag region option there). > I can achieve the same result using a macro to iterate over lines, but a > single key press to tag results of a search filter would be quite > convienent. > > And... at the moment, it seems to me that with the current suggested > lambdas, if one presses 'S' after selecting a whole region results in > tagging all sorts of messages (all ?) with the spam tag ! :-/ > > > Btw, I think that the current examples could be improved by adding a > (next-line) > at the end, like : > (define-key notmuch-search-mode-map "S" > (lambda () > "mark messages in thread as spam" > (interactive) > (notmuch-search-tag '("+spam" "-inbox")) > (next-line))) I have left this as it is as this works in search mode, but not show mode and I didn't want to have too many examples. Obviously feel free to edit the wiki if you like! Best wishes Mark
[RFC] [PATCH] emacs: Add support for saved search accelerators.
Extended the saved search definition to allow the inclusion of an accelerator key for the search. Bind 'j' in the common mode map as a leader for such accelerator keys. --- This arose out a conversation in #notmuch and Mark's patch to extend the saved search custom specification based on requirements for an external package (Austin's notmuch-go.el). Re-organising the layout of the saved searches is missing (as it's lots of fiddling about with absolute numbers and I didn't want to waste time on it if this is going nowhere), so the saved searches may not all line up correctly in notmuch-hello. emacs/notmuch-hello.el | 8 ++-- emacs/notmuch-lib.el | 27 +++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 3de5238..56379ef 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -85,6 +85,7 @@ searches so they still work in customize." (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v"))) (checklist :inline t :format "%v" +(group :format "%v" :inline t (const :format "Key: " :key) (string :format "%v")) (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")) (group :format "%v" :inline t (const :format "" :sort-order) (choice :tag " Sort Order" @@ -551,7 +552,8 @@ with `notmuch-hello-query-counts'." (when elem (if (> column-indent 0) (widget-insert (make-string column-indent ? ))) - (let* ((name (plist-get elem :name)) + (let* ((key (plist-get elem :key)) +(name (plist-get elem :name)) (query (plist-get elem :query)) (oldest-first (case (plist-get elem :sort-order) (newest-first nil) @@ -564,7 +566,9 @@ with `notmuch-hello-query-counts'." :notify #'notmuch-hello-widget-search :notmuch-search-terms query :notmuch-search-oldest-first oldest-first - name) + (if key + (concat name " (" key ")") +name)) (setq column-indent (1+ (max 0 (- column-width (length name))) (setq count (1+ count)) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 2941da3..9aa7ba7 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -130,6 +130,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an (define-key map "m" 'notmuch-mua-new-mail) (define-key map "=" 'notmuch-refresh-this-buffer) (define-key map "G" 'notmuch-poll-and-refresh-this-buffer) +(define-key map "j" 'notmuch-jump) map) "Keymap shared by all notmuch modes.") @@ -845,6 +846,32 @@ status." (defvar notmuch-show-process-crypto nil) (make-variable-buffer-local 'notmuch-show-process-crypto) +;; Jump key support: + +(defvar notmuch-jump-search nil) +(defun notmuch-jump-map () + (let ((map (make-sparse-keymap))) +(set-keymap-parent map nil) +(suppress-keymap map) +(dolist (saved-search notmuch-saved-searches) + (let ((key (plist-get saved-search :key))) + (when key + (define-key map key `(lambda () +(interactive) +(setq notmuch-jump-search ',saved-search) +(exit-minibuffer) +) +map)) + +(defun notmuch-jump () + "Read a saved search accelerator key and perform the associated +search." + (interactive) + (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map)) + (when notmuch-jump-search +(notmuch-search (plist-get notmuch-jump-search :query) + (plist-get notmuch-jump-search :oldest-first + (provide 'notmuch-lib) ;; Local Variables: -- 2.0.0.rc0
[PATCH] lib: Precede all function names in notmuch-private.h with an underscore.
An underscore should precede every function name in lib/notmuch-private.h. This was not true and was noted by the failure of test T360-symbol-hiding on Mac OS/X. This patch inserts an underscore before each function name in lib/notmuch-private.h where the underscore was missing and renames functions appropriately where they are used. Signed-off-by: Charles Celerier --- lib/database.cc | 24 lib/message-file.c| 8 lib/message.cc| 8 lib/notmuch-private.h | 14 +++--- lib/sha1.c| 4 ++-- lib/thread.cc | 4 ++-- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 1efb14d..d9a01b7 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -356,7 +356,7 @@ _message_id_compressed (void *ctx, const char *message_id) { char *sha1, *compressed; -sha1 = notmuch_sha1_of_string (message_id); +sha1 = _notmuch_sha1_of_string (message_id); compressed = talloc_asprintf (ctx, "notmuch-sha1-%s", sha1); free (sha1); @@ -1356,7 +1356,7 @@ _notmuch_database_get_directory_db_path (const char *path) int term_len = strlen (_find_prefix ("directory")) + strlen (path); if (term_len > NOTMUCH_TERM_MAX) - return notmuch_sha1_of_string (path); + return _notmuch_sha1_of_string (path); else return path; } @@ -1758,12 +1758,12 @@ _notmuch_database_link_message_to_parents (notmuch_database_t *notmuch, _my_talloc_free_for_g_hash, NULL); this_message_id = notmuch_message_get_message_id (message); -refs = notmuch_message_file_get_header (message_file, "references"); +refs = _notmuch_message_file_get_header (message_file, "references"); last_ref_message_id = parse_references (message, this_message_id, parents, refs); -in_reply_to = notmuch_message_file_get_header (message_file, "in-reply-to"); +in_reply_to = _notmuch_message_file_get_header (message_file, "in-reply-to"); in_reply_to_message_id = parse_references (message, this_message_id, parents, in_reply_to); @@ -1961,7 +1961,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (ret) return ret; -message_file = notmuch_message_file_open (filename); +message_file = _notmuch_message_file_open (filename); if (message_file == NULL) return NOTMUCH_STATUS_FILE_ERROR; @@ -1982,9 +1982,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch, * let's make sure that what we're looking at looks like an * actual email message. */ - from = notmuch_message_file_get_header (message_file, "from"); - subject = notmuch_message_file_get_header (message_file, "subject"); - to = notmuch_message_file_get_header (message_file, "to"); + from = _notmuch_message_file_get_header (message_file, "from"); + subject = _notmuch_message_file_get_header (message_file, "subject"); + to = _notmuch_message_file_get_header (message_file, "to"); if ((from == NULL || *from == '\0') && (subject == NULL || *subject == '\0') && @@ -1997,7 +1997,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, /* Now that we're sure it's mail, the first order of business * is to find a message ID (or else create one ourselves). */ - header = notmuch_message_file_get_header (message_file, "message-id"); + header = _notmuch_message_file_get_header (message_file, "message-id"); if (header && *header != '\0') { message_id = _parse_message_id (message_file, header, NULL); @@ -2018,7 +2018,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (message_id == NULL ) { /* No message-id at all, let's generate one by taking a * hash over the file's contents. */ - char *sha1 = notmuch_sha1_of_file (filename); + char *sha1 = _notmuch_sha1_of_file (filename); /* If that failed too, something is really wrong. Give up. */ if (sha1 == NULL) { @@ -2058,7 +2058,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (ret) goto DONE; - date = notmuch_message_file_get_header (message_file, "date"); + date = _notmuch_message_file_get_header (message_file, "date"); _notmuch_message_set_header_values (message, date, from, subject); ret = _notmuch_message_index_file (message, message_file); @@ -2087,7 +2087,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, } if (message_file) - notmuch_message_file_close (message_file); + _notmuch_message_file_close (message_file); ret2 = notmuch_database_end_atomic
Improving spam-tagging keybinding function to act on region in emacs
Hi. I've tried tu use the tips indicated at http://notmuchmail.org/emacstips/#index8h2 so as to add a keybinding to tag spam messages, and wonder if there's a possibility to make it apply on selected regions, like what notmuch-search-archive-thread does. I can achieve the same result using a macro to iterate over lines, but a single key press to tag results of a search filter would be quite convienent. And... at the moment, it seems to me that with the current suggested lambdas, if one presses 'S' after selecting a whole region results in tagging all sorts of messages (all ?) with the spam tag ! :-/ Btw, I think that the current examples could be improved by adding a (next-line) at the end, like : (define-key notmuch-search-mode-map "S" (lambda () "mark messages in thread as spam" (interactive) (notmuch-search-tag '("+spam" "-inbox")) (next-line))) Thanks in advance. Best regards, -- Olivier BERGER http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8 Ingenieur Recherche - Dept INF Institut Mines-Telecom, Telecom SudParis, Evry (France)
[PATCH 5/5] T360-symbol-hiding: Use nm instead of objdump.
The output of `objdump -t` depends on the format of the object files which are different across platforms (e.g. Mac OS X). Since we really just want to filter the symbols in the object file, nm is a more appropriate tool since it only lists symbols from object files (nm(1)) and has a consistent output format. Signed-off-by: Charles Celerier --- test/T360-symbol-hiding.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index 97c734a..c5bbf27 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -33,7 +33,8 @@ test_begin_subtest 'checking output' test_expect_equal "$result" "$output" test_begin_subtest 'comparing existing to exported symbols' -objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" {print $6}' | sort | uniq > ACTUAL + +nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' | sort | uniq > ACTUAL sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPORTED test_expect_equal_file EXPORTED ACTUAL -- 1.8.5.2 (Apple Git-48)
[PATCH 2/5] configure, test: Added variables for paths to true and false.
The path to true may not be the same on all platforms (e.g. on Mac OS X it is /usr/bin/true), so the hard-coded path of /bin/true is not portable. This is resolved by adding a step to the configure script to locate the path of true and to use the TRUE variable wherever /bin/true was needed. The same was done for false. Signed-off-by: Charles Celerier --- configure | 6 ++ test/Makefile.local | 8 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 9bde2eb..0bce0a3 100755 --- a/configure +++ b/configure @@ -50,6 +50,8 @@ CPPFLAGS=${CPPFLAGS:-} CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)} LDFLAGS=${LDFLAGS:-} XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config} +TRUE=$(which true) +FALSE=$(which false) # We don't allow the EMACS or GZIP Makefile variables inherit values # from the environment as we do with CC and CXX above. The reason is @@ -761,6 +763,10 @@ CXX = ${CXX} # Command to execute emacs from Makefiles EMACS = emacs --quick +# Define the paths to true and false. +TRUE = ${TRUE} +FALSE = ${FALSE} + # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g") CFLAGS = ${CFLAGS} diff --git a/test/Makefile.local b/test/Makefile.local index d622eaf..e422c06 100644 --- a/test/Makefile.local +++ b/test/Makefile.local @@ -37,16 +37,16 @@ $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o $(dir)/have-compact: Makefile.config ifeq ($(HAVE_XAPIAN_COMPACT),1) - ln -sf /bin/true $@ + ln -sf $(TRUE) $@ else - ln -sf /bin/false $@ + ln -sf $(FALSE) $@ endif $(dir)/have-man: Makefile.config ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00) - ln -sf /bin/false $@ + ln -sf $(FALSE) $@ else - ln -sf /bin/true $@ + ln -sf $(TRUE) $@ endif .PHONY: test check -- 1.8.5.2 (Apple Git-48)
[PATCH 1/5] test/Makefile.local: Added configured TALLOC_LDFLAGS.
The linking to talloc is hard-coded in the testing Makefile. This patch causes the linking to talloc to be done according to how TALLOC_LDFLAGS was configured. Signed-off-by: Charles Celerier --- test/Makefile.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Makefile.local b/test/Makefile.local index 987441f..d622eaf 100644 --- a/test/Makefile.local +++ b/test/Makefile.local @@ -16,7 +16,7 @@ $(dir)/arg-test: $(dir)/arg-test.o command-line-arguments.o util/libutil.a $(call quiet,CC) $^ -o $@ $(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o util/libutil.a - $(call quiet,CC) $^ -o $@ -ltalloc + $(call quiet,CC) $^ $(TALLOC_LDFLAGS) -o $@ random_corpus_deps = $(dir)/random-corpus.o $(dir)/database-test.o \ notmuch-config.o command-line-arguments.o \ -- 1.8.5.2 (Apple Git-48)
[PATCH 0/5] Improving portability to Mac OS X
The patches in this series include a number of minor changes intended to better support the portability of notmuch to Mac OS X. The changes are relatively non-intrusive. You may observe that these patches apply entirely to the notmuch tests; it turns out, with the exception of the tests, notmuch ports very well to Mac OS X. =] Note that I have used GNU programs where possible (e.g. nm, sed, date, etc.) so as to not introduce changes to the testing framework that are easily resolved by installing standard GNU programs. For example, on Mac OS X the date program is a BSD variant that does not include the '-d' option that allows specifying a time to display. This appears to be necessary when testing on Mac OS X; I will try to note this somewhere on the notmuch wiki soon. Best, Chuck P.S. This is my first time submitting patches to a mailing list, so forgive me if I have made any foolish mistakes in my attempt to submit changes. Charles Celerier (5): test/Makefile.local: Added configured TALLOC_LDFLAGS. configure, test: Added variables for paths to true and false. atomicity.gdb: Allow breakpoint symbols to be resolved later. T360-symbol-hiding: Added code to support testing on Mac OS X. T360-symbol-hiding: Use nm instead of objdump. configure | 6 ++ test/Makefile.local| 10 +- test/T360-symbol-hiding.sh | 12 ++-- test/atomicity.gdb | 3 +++ 4 files changed, 24 insertions(+), 7 deletions(-) -- 1.8.5.2 (Apple Git-48)
Linux-only fdatasync() in 3c13bc
Also, commit 3c13bc introduced a call to fdatasync() which is not available on FreeBSD, and probably not either on MacOS at least. Best, -- X?c? -- next part -- A non-text attachment was scrubbed... Name: 0002-Compatibility-for-Linux-s-fdatasync.patch Type: text/x-diff Size: 2827 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140506/6ef37585/attachment.patch>
pkg-config zlib check in 3c13bc
Dear notmuch, Although notmuch was configuring fine on FreeBSD before 3c13bc, the pkg-config check introduced for zlib does not work. Indeed, zlib is part of the base system, and always assumed to be present. Proposed patch puts platform test before pkg-config checks, and add a special case for zlib on FreeBSD. uname -U is used to get (numeric) OS version, and compared to lowest release where at least zlib 1.2.5.2 was available (that?s FreeBSD 9.1, with zlib 1.2.7). Best, -- X?c? -- next part -- A non-text attachment was scrubbed... Name: 0001-FreeBSD-check-for-zlib-version.patch Type: text/x-diff Size: 4774 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140506/a8e94213/attachment.patch>
Notmuch-tree add/remove/toggle tag
Quoting Mark Walters : > 'Mash writes: > >> I am trying to setup a tag toggle to be used in the Notmuch-tree. >> >> I referred to "Add a key binding to add/remove/toggle a tag": >> http://notmuchmail.org/emacstips/#index8h2 >> >> Looking at "notmuch-tree.el" I noticed >> >> (defun notmuch-tree-get-tags () >>"Return the tags of the current message." >>(notmuch-tree-get-prop :tags)) >> >> and >> >> (defun notmuch-tree-tag (tag-changes) >>"Change tags for the current message" >>(interactive >> (list (notmuch-read-tag-changes (notmuch-tree-get-tags) "Tag message"))) >>(notmuch-tag (notmuch-tree-get-message-id) tag-changes) >>(notmuch-tree-tag-update-display tag-changes)) >> >> Which in my mind would be substituted for "notmuch-show-tag-message" >> and "notmuch-show-get-tags" respectively in the "add a toggle >> "deleted" key" example. >> >> (define-key notmuch-tree-mode-map "d" >>(lambda () >> "toggle deleted tag for message" >> (interactive) >> (notmuch-tree-tag >> (if (member "deleted" (notmuch-tree-get-tags)) >> "-deleted" "+deleted" > > Hi > > I think you want > >(if (member "deleted" (notmuch-tree-get-tags)) >(list "-deleted") > (list "+deleted") > > at the end. It looks like the wiki could do some tidying, which I will > try and have a look at at some point. > > Best wishes > > Mark Excellent! Many thanks for your quick response. I am attempting to move from > 8 years of using Mutt in an Emacs Term to Notmuch. Slow going so far, especially trying to get the workflow sorted. (The reason for the move is Mutt in Emacs24 Term is horrifically sluggish for some reason I am yet to discover.) I need to investigate a keybinding to go straight to notmuch-tree now. Thanks again,
Notmuch-tree add/remove/toggle tag
I am trying to setup a tag toggle to be used in the Notmuch-tree. I referred to "Add a key binding to add/remove/toggle a tag": http://notmuchmail.org/emacstips/#index8h2 Looking at "notmuch-tree.el" I noticed (defun notmuch-tree-get-tags () "Return the tags of the current message." (notmuch-tree-get-prop :tags)) and (defun notmuch-tree-tag (tag-changes) "Change tags for the current message" (interactive (list (notmuch-read-tag-changes (notmuch-tree-get-tags) "Tag message"))) (notmuch-tag (notmuch-tree-get-message-id) tag-changes) (notmuch-tree-tag-update-display tag-changes)) Which in my mind would be substituted for "notmuch-show-tag-message" and "notmuch-show-get-tags" respectively in the "add a toggle "deleted" key" example. (define-key notmuch-tree-mode-map "d" (lambda () "toggle deleted tag for message" (interactive) (notmuch-tree-tag (if (member "deleted" (notmuch-tree-get-tags)) "-deleted" "+deleted" The problem is that in notmuch-tree when I get the following message: "Entering debugger... button-at: Args out of range: 0" and the tag fails to be toggled. Not quite sure where I am going wrong here? Thanks,
[PATCH] emacs: Correct the documentation for `notmuch-search-line-faces'.
Sorry for the duplicates - MTA troubles. The two versions are the same. -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 310 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140506/2d1a9e6c/attachment-0001.pgp>
[PATCH] emacs: Correct the documentation for `notmuch-search-line-faces'.
The implementation and documentation for `notmuch-search-line-faces' disagreed in how elements in the list were merged. Correct the documentation to match the implementation (that is, the earlier elements in the list have precedence over later elements). --- emacs/notmuch.el | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6c0bc1b..8aa0104 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -647,12 +647,12 @@ of the result." Here is an example of how to color search results based on tags. (the following text would be placed in your ~/.emacs file): - (setq notmuch-search-line-faces '((\"deleted\" . (:foreground \"red\" - :background \"blue\")) - (\"unread\" . (:foreground \"green\" + (setq notmuch-search-line-faces '((\"unread\" . (:foreground \"green\")) + (\"deleted\" . (:foreground \"red\" + :background \"blue\" -The attributes defined for matching tags are merged, with later -attributes overriding earlier. A message having both \"deleted\" +The attributes defined for matching tags are merged, with earlier +attributes overriding later. A message having both \"deleted\" and \"unread\" tags with the above settings would have a green foreground and blue background." :type '(alist :key-type (string) :value-type (custom-face-edit)) -- 2.0.0.rc0
[PATCH] emacs: Correct the documentation for `notmuch-search-line-faces'.
The implementation and documentation for `notmuch-search-line-faces' disagreed in how elements in the list were merged. Correct the documentation to match the implementation (that is, the earlier elements in the list have precedence over later elements). --- emacs/notmuch.el | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6c0bc1b..8aa0104 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -647,12 +647,12 @@ of the result." Here is an example of how to color search results based on tags. (the following text would be placed in your ~/.emacs file): - (setq notmuch-search-line-faces '((\"deleted\" . (:foreground \"red\" - :background \"blue\")) - (\"unread\" . (:foreground \"green\" + (setq notmuch-search-line-faces '((\"unread\" . (:foreground \"green\")) + (\"deleted\" . (:foreground \"red\" + :background \"blue\" -The attributes defined for matching tags are merged, with later -attributes overriding earlier. A message having both \"deleted\" +The attributes defined for matching tags are merged, with earlier +attributes overriding later. A message having both \"deleted\" and \"unread\" tags with the above settings would have a green foreground and blue background." :type '(alist :key-type (string) :value-type (custom-face-edit)) -- 2.0.0.rc0
precedence in `notmuch-search-line-faces'
On Sun, May 04 2014, Mark Walters wrote: > I have a slight preference for making it do the comment (ie reverse the > list). My reason is that we have some other cases such as > notmuch-tag-format that apply the first match, so users might be used to > having the specific first and the more general later. That makes sense. Patch follows. -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 310 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140506/ede9ce48/attachment.pgp>
[PATCH] emacs: put current query as default value in notmuch-read-query
On Tue, May 06 2014, Mark Walters wrote: > Hi > > On Tue, 06 May 2014, David Edmondson wrote: >> On Sat, May 03 2014, Mark Walters wrote: >>> An alternative to putting the logic in notmuch-read-query would be to >>> store the query in a consistently named buffer local variable in all >>> the modes. If we want to show the actually run query in notmuch-show >>> above then this is probably the neatest solution. >> >> Could per-mode query functions not simply pass the default as an >> optional second argument to `notmuch-read-query'? > > They could but at the moment notmuch-search and notmuch-tree are both > bound in the global key map and they in turn call notmuch-read-query. > > I guess we could add an argument to notmuch-search and notmuch-tree > for the default argument (which they would pass to > notmuch-read-query). Then calling modes which know a search value > (show,search and tree) could override the global keymap (probably using > remap or something to mean that they keep any customised binding) to > link into something which passes the default value through. I would probably replace the global keymap bindings, but others should chime in. > One variant which might be nicer than the current version would be to > have something like > (let ((current-query (case major-mode >(notmuch-show-mode > (notmuch-show-get-current-query)) >(notmuch-tree-mode > (notmuch-tree-get-current-query)) >(notmuch-search-mode > (notmuch-search-get-current-query)) > > so at least all the logic for calculating the current query can live in > the relevant file. > > What do you think? This is nicer than the current patch. -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 310 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140506/57bcc05a/attachment-0001.pgp>
folder and path completely broken in HEAD?
On Mon, 05 May 2014, Jani Nikula wrote: > Hi Carl - > > On Tue, 06 May 2014, Carl Worth wrote: >> dm-list-email-notmuch at scs.stanford.edu writes: >>> However, currently it seems strange that there are *two* different >>> search terms (folder and path), and that neither one lets you search for >>> a portion of your folder name. >> >> For what it's worth, I totally agree. I'm guilty as far as sitting out >> of the detailed design discussions, (I don't use any sort of >> folder-based searching, so I don't care too much). I was aware of the >> problems of the original "folder:" code I wrote, and I was happy to hear >> that people were addressing those problems. >> >> But it's terribly strange to me that notmuch now has two different >> search terms that overlap so much in functionality. I know that I will >> never trust myself to be able to distinguish/describe the folder: >> vs. path: semantics without consulting the documentation. And that's >> discouraging. > > The discussions about this were lengthy and tedious, and I was glad we > eventually reached some consensus about what we wanted. It's always > disappointing to find out one hasn't found the solution to satisfy > everyone, but in the end I think I'm happier we were able to reach a > decision, do something about the real issues people were facing with > folder: and move on, rather than just grind to a halt. I think we were > pretty close to everyone just dropping the ball and letting the folder: > prefix be, warts and all. I would just like to second what Jani said. There was a lot of discussion and, at the time, the outcome covered all use cases that anyone showed any sign of wanting. And these included things like distinguishing between messages in cur or new or the toplevel of a maildir, wanting to search all subdirectories of a particular path (if eg the main mail folder is split into 256 subsirectories 00..ff). > The idea of path: is that it's the exact filesystem directory, relative > from the maildir root, with an rsync like ** syntax for recursive > matching. Turns out people want folder: to hide maildir implementation > details like cur and new. These are not compatible, or you need to add a > syntax that's not easy or discoverable. > > path: is now pretty much complete, and allows one to do robust scripting > that won't break in surprising ways. folder: is something we can still > add new functionality into, for example fancier interpretations of > maildir++, or anchoring if we ever get the custom query parser. > >> I think the original "folder:" shortcomings could have been addressed >> without adding two terms, and also without losing some functionality, >> (as shown in David's use case). >> >> I would have liked to have seen some explicit syntax for anchoring the >> beginning and end of the directory name, (which could have then been >> re-used for anchoring subject: or even some future header: prefix). > > As I understood it, that would have required writing a custom query > parser, a significant effort. At least nobody came up with a scheme to > do the anchoring without the parser while addressing the other issues > with the old folder: prefix. > >> I've always thought that the "cur" and "new" directories were somewhere >> on the spectrum between pointless and annoying. The idea with the >> original "folder:" indexing was to implicitly ignore these, (when both >> existed). I think many of us would agree, but there were users who wanted to distinguish new and cur, and in at least one case, the toplevel as well. >> >> It seems that the new "folder:" continues this idea, while the new >> "path:" does not. > > Correct. > >> Meanwhile, the new "folder:" anchors the search to the beginning of >> the directory, while "path:" does not. > > Incorrect (or I don't understand you). > >> And finally, "path:" adds a magic syntax to do hierarchical matching >> while "folder:" does not. > > Correct. > >> That's an odd hodgepodge of non-orthogonal distinction in >> functionality. > > I'm sorry to hear you think that way. One is verbatim filesystem path, > the other hides mail store folder implementation details as a > convenience. I think it is unfortunate that we need two variants, but I think they do do different things. Also, I think any single user will find one matches their setup and use that one essentially exclusively: if everything is in maildirs then you probably want folder:, if you want exact control then use path:. Indeed, it may be that a third option of roughly a maildir++: search term might solve David's use case. Best wishes Mark
[PATCH] emacs: put current query as default value in notmuch-read-query
Hi On Tue, 06 May 2014, David Edmondson wrote: > On Sat, May 03 2014, Mark Walters wrote: >> An alternative to putting the logic in notmuch-read-query would be to >> store the query in a consistently named buffer local variable in all >> the modes. If we want to show the actually run query in notmuch-show >> above then this is probably the neatest solution. > > Could per-mode query functions not simply pass the default as an > optional second argument to `notmuch-read-query'? They could but at the moment notmuch-search and notmuch-tree are both bound in the global key map and they in turn call notmuch-read-query. I guess we could add an argument to notmuch-search and notmuch-tree for the default argument (which they would pass to notmuch-read-query). Then calling modes which know a search value (show,search and tree) could override the global keymap (probably using remap or something to mean that they keep any customised binding) to link into something which passes the default value through. One variant which might be nicer than the current version would be to have something like (let ((current-query (case major-mode (notmuch-show-mode (notmuch-show-get-current-query)) (notmuch-tree-mode (notmuch-tree-get-current-query)) (notmuch-search-mode (notmuch-search-get-current-query)) so at least all the logic for calculating the current query can live in the relevant file. What do you think? Best wishes Mark
[PATCH] emacs: put current query as default value in notmuch-read-query
On Sat, May 03 2014, Mark Walters wrote: > An alternative to putting the logic in notmuch-read-query would be to > store the query in a consistently named buffer local variable in all > the modes. If we want to show the actually run query in notmuch-show > above then this is probably the neatest solution. Could per-mode query functions not simply pass the default as an optional second argument to `notmuch-read-query'? -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 310 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140506/d5014b57/attachment.pgp>
folder and path completely broken in HEAD?
Hi Carl - On Tue, 06 May 2014, Carl Worth wrote: > dm-list-email-notmuch at scs.stanford.edu writes: >> However, currently it seems strange that there are *two* different >> search terms (folder and path), and that neither one lets you search for >> a portion of your folder name. > > For what it's worth, I totally agree. I'm guilty as far as sitting out > of the detailed design discussions, (I don't use any sort of > folder-based searching, so I don't care too much). I was aware of the > problems of the original "folder:" code I wrote, and I was happy to hear > that people were addressing those problems. > > But it's terribly strange to me that notmuch now has two different > search terms that overlap so much in functionality. I know that I will > never trust myself to be able to distinguish/describe the folder: > vs. path: semantics without consulting the documentation. And that's > discouraging. The discussions about this were lengthy and tedious, and I was glad we eventually reached some consensus about what we wanted. It's always disappointing to find out one hasn't found the solution to satisfy everyone, but in the end I think I'm happier we were able to reach a decision, do something about the real issues people were facing with folder: and move on, rather than just grind to a halt. I think we were pretty close to everyone just dropping the ball and letting the folder: prefix be, warts and all. The idea of path: is that it's the exact filesystem directory, relative from the maildir root, with an rsync like ** syntax for recursive matching. Turns out people want folder: to hide maildir implementation details like cur and new. These are not compatible, or you need to add a syntax that's not easy or discoverable. path: is now pretty much complete, and allows one to do robust scripting that won't break in surprising ways. folder: is something we can still add new functionality into, for example fancier interpretations of maildir++, or anchoring if we ever get the custom query parser. > I think the original "folder:" shortcomings could have been addressed > without adding two terms, and also without losing some functionality, > (as shown in David's use case). > > I would have liked to have seen some explicit syntax for anchoring the > beginning and end of the directory name, (which could have then been > re-used for anchoring subject: or even some future header: prefix). As I understood it, that would have required writing a custom query parser, a significant effort. At least nobody came up with a scheme to do the anchoring without the parser while addressing the other issues with the old folder: prefix. > I've always thought that the "cur" and "new" directories were somewhere > on the spectrum between pointless and annoying. The idea with the > original "folder:" indexing was to implicitly ignore these, (when both > existed). > > It seems that the new "folder:" continues this idea, while the new > "path:" does not. Correct. > Meanwhile, the new "folder:" anchors the search to the beginning of > the directory, while "path:" does not. Incorrect (or I don't understand you). > And finally, "path:" adds a magic syntax to do hierarchical matching > while "folder:" does not. Correct. > That's an odd hodgepodge of non-orthogonal distinction in > functionality. I'm sorry to hear you think that way. One is verbatim filesystem path, the other hides mail store folder implementation details as a convenience. BR, Jani.
Re: [PATCH] emacs: put current query as default value in notmuch-read-query
On Sat, May 03 2014, Mark Walters wrote: An alternative to putting the logic in notmuch-read-query would be to store the query in a consistently named buffer local variable in all the modes. If we want to show the actually run query in notmuch-show above then this is probably the neatest solution. Could per-mode query functions not simply pass the default as an optional second argument to `notmuch-read-query'? signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: folder and path completely broken in HEAD?
On Mon, 05 May 2014, Jani Nikula j...@nikula.org wrote: Hi Carl - On Tue, 06 May 2014, Carl Worth cwo...@cworth.org wrote: dm-list-email-notm...@scs.stanford.edu writes: However, currently it seems strange that there are *two* different search terms (folder and path), and that neither one lets you search for a portion of your folder name. For what it's worth, I totally agree. I'm guilty as far as sitting out of the detailed design discussions, (I don't use any sort of folder-based searching, so I don't care too much). I was aware of the problems of the original folder: code I wrote, and I was happy to hear that people were addressing those problems. But it's terribly strange to me that notmuch now has two different search terms that overlap so much in functionality. I know that I will never trust myself to be able to distinguish/describe the folder: vs. path: semantics without consulting the documentation. And that's discouraging. The discussions about this were lengthy and tedious, and I was glad we eventually reached some consensus about what we wanted. It's always disappointing to find out one hasn't found the solution to satisfy everyone, but in the end I think I'm happier we were able to reach a decision, do something about the real issues people were facing with folder: and move on, rather than just grind to a halt. I think we were pretty close to everyone just dropping the ball and letting the folder: prefix be, warts and all. I would just like to second what Jani said. There was a lot of discussion and, at the time, the outcome covered all use cases that anyone showed any sign of wanting. And these included things like distinguishing between messages in cur or new or the toplevel of a maildir, wanting to search all subdirectories of a particular path (if eg the main mail folder is split into 256 subsirectories 00..ff). The idea of path: is that it's the exact filesystem directory, relative from the maildir root, with an rsync like ** syntax for recursive matching. Turns out people want folder: to hide maildir implementation details like cur and new. These are not compatible, or you need to add a syntax that's not easy or discoverable. path: is now pretty much complete, and allows one to do robust scripting that won't break in surprising ways. folder: is something we can still add new functionality into, for example fancier interpretations of maildir++, or anchoring if we ever get the custom query parser. I think the original folder: shortcomings could have been addressed without adding two terms, and also without losing some functionality, (as shown in David's use case). I would have liked to have seen some explicit syntax for anchoring the beginning and end of the directory name, (which could have then been re-used for anchoring subject: or even some future header: prefix). As I understood it, that would have required writing a custom query parser, a significant effort. At least nobody came up with a scheme to do the anchoring without the parser while addressing the other issues with the old folder: prefix. I've always thought that the cur and new directories were somewhere on the spectrum between pointless and annoying. The idea with the original folder: indexing was to implicitly ignore these, (when both existed). I think many of us would agree, but there were users who wanted to distinguish new and cur, and in at least one case, the toplevel as well. It seems that the new folder: continues this idea, while the new path: does not. Correct. Meanwhile, the new folder: anchors the search to the beginning of the directory, while path: does not. Incorrect (or I don't understand you). And finally, path: adds a magic syntax to do hierarchical matching while folder: does not. Correct. That's an odd hodgepodge of non-orthogonal distinction in functionality. I'm sorry to hear you think that way. One is verbatim filesystem path, the other hides mail store folder implementation details as a convenience. I think it is unfortunate that we need two variants, but I think they do do different things. Also, I think any single user will find one matches their setup and use that one essentially exclusively: if everything is in maildirs then you probably want folder:, if you want exact control then use path:. Indeed, it may be that a third option of roughly a maildir++: search term might solve David's use case. Best wishes Mark ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: precedence in `notmuch-search-line-faces'
On Sun, May 04 2014, Mark Walters wrote: I have a slight preference for making it do the comment (ie reverse the list). My reason is that we have some other cases such as notmuch-tag-format that apply the first match, so users might be used to having the specific first and the more general later. That makes sense. Patch follows. signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] emacs: Correct the documentation for `notmuch-search-line-faces'.
Sorry for the duplicates - MTA troubles. The two versions are the same. signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Notmuch-tree add/remove/toggle tag
I am trying to setup a tag toggle to be used in the Notmuch-tree. I referred to Add a key binding to add/remove/toggle a tag: http://notmuchmail.org/emacstips/#index8h2 Looking at notmuch-tree.el I noticed (defun notmuch-tree-get-tags () Return the tags of the current message. (notmuch-tree-get-prop :tags)) and (defun notmuch-tree-tag (tag-changes) Change tags for the current message (interactive (list (notmuch-read-tag-changes (notmuch-tree-get-tags) Tag message))) (notmuch-tag (notmuch-tree-get-message-id) tag-changes) (notmuch-tree-tag-update-display tag-changes)) Which in my mind would be substituted for notmuch-show-tag-message and notmuch-show-get-tags respectively in the add a toggle deleted key example. (define-key notmuch-tree-mode-map d (lambda () toggle deleted tag for message (interactive) (notmuch-tree-tag (if (member deleted (notmuch-tree-get-tags)) -deleted +deleted The problem is that in notmuch-tree when I get the following message: Entering debugger... button-at: Args out of range: 0 and the tag fails to be toggled. Not quite sure where I am going wrong here? Thanks, ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Notmuch-tree add/remove/toggle tag
'Mash subscr...@toshine.net writes: I am trying to setup a tag toggle to be used in the Notmuch-tree. I referred to Add a key binding to add/remove/toggle a tag: http://notmuchmail.org/emacstips/#index8h2 Looking at notmuch-tree.el I noticed (defun notmuch-tree-get-tags () Return the tags of the current message. (notmuch-tree-get-prop :tags)) and (defun notmuch-tree-tag (tag-changes) Change tags for the current message (interactive (list (notmuch-read-tag-changes (notmuch-tree-get-tags) Tag message))) (notmuch-tag (notmuch-tree-get-message-id) tag-changes) (notmuch-tree-tag-update-display tag-changes)) Which in my mind would be substituted for notmuch-show-tag-message and notmuch-show-get-tags respectively in the add a toggle deleted key example. (define-key notmuch-tree-mode-map d (lambda () toggle deleted tag for message (interactive) (notmuch-tree-tag (if (member deleted (notmuch-tree-get-tags)) -deleted +deleted Hi I think you want (if (member deleted (notmuch-tree-get-tags)) (list -deleted) (list +deleted) at the end. It looks like the wiki could do some tidying, which I will try and have a look at at some point. Best wishes Mark The problem is that in notmuch-tree when I get the following message: Entering debugger... button-at: Args out of range: 0 and the tag fails to be toggled. Not quite sure where I am going wrong here? Thanks, ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Notmuch-tree add/remove/toggle tag
Quoting Mark Walters markwalters1...@gmail.com: 'Mash subscr...@toshine.net writes: I am trying to setup a tag toggle to be used in the Notmuch-tree. I referred to Add a key binding to add/remove/toggle a tag: http://notmuchmail.org/emacstips/#index8h2 Looking at notmuch-tree.el I noticed (defun notmuch-tree-get-tags () Return the tags of the current message. (notmuch-tree-get-prop :tags)) and (defun notmuch-tree-tag (tag-changes) Change tags for the current message (interactive (list (notmuch-read-tag-changes (notmuch-tree-get-tags) Tag message))) (notmuch-tag (notmuch-tree-get-message-id) tag-changes) (notmuch-tree-tag-update-display tag-changes)) Which in my mind would be substituted for notmuch-show-tag-message and notmuch-show-get-tags respectively in the add a toggle deleted key example. (define-key notmuch-tree-mode-map d (lambda () toggle deleted tag for message (interactive) (notmuch-tree-tag (if (member deleted (notmuch-tree-get-tags)) -deleted +deleted Hi I think you want (if (member deleted (notmuch-tree-get-tags)) (list -deleted) (list +deleted) at the end. It looks like the wiki could do some tidying, which I will try and have a look at at some point. Best wishes Mark Excellent! Many thanks for your quick response. I am attempting to move from 8 years of using Mutt in an Emacs Term to Notmuch. Slow going so far, especially trying to get the workflow sorted. (The reason for the move is Mutt in Emacs24 Term is horrifically sluggish for some reason I am yet to discover.) I need to investigate a keybinding to go straight to notmuch-tree now. Thanks again, ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Improving spam-tagging keybinding function to act on region in emacs
Hi. I've tried tu use the tips indicated at http://notmuchmail.org/emacstips/#index8h2 so as to add a keybinding to tag spam messages, and wonder if there's a possibility to make it apply on selected regions, like what notmuch-search-archive-thread does. I can achieve the same result using a macro to iterate over lines, but a single key press to tag results of a search filter would be quite convienent. And... at the moment, it seems to me that with the current suggested lambdas, if one presses 'S' after selecting a whole region results in tagging all sorts of messages (all ?) with the spam tag ! :-/ Btw, I think that the current examples could be improved by adding a (next-line) at the end, like : (define-key notmuch-search-mode-map S (lambda () mark messages in thread as spam (interactive) (notmuch-search-tag '(+spam -inbox)) (next-line))) Thanks in advance. Best regards, -- Olivier BERGER http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8 Ingenieur Recherche - Dept INF Institut Mines-Telecom, Telecom SudParis, Evry (France) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[no subject]
The first of these fixes a build failure on Debian Linux/armhf (and OS/X). If the patch seems ok, I'd like to roll it into a bug fix release. The second is more of a suggestion to make that atomicity test easier to debug, since it seems to find the dark corners of gdb. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 1/2] test: allow pending break points in atomicity script.
This seems to fix problems with the symbol rename not being defined at startup on at least OS/X and some Debian Linux architectures. --- test/atomicity.gdb | 4 1 file changed, 4 insertions(+) diff --git a/test/atomicity.gdb b/test/atomicity.gdb index fd67525..15adb16 100644 --- a/test/atomicity.gdb +++ b/test/atomicity.gdb @@ -18,6 +18,10 @@ shell echo 0 outcount shell touch inodes +# work around apparent issue with lazy library loading on some +# platforms +set breakpoint pending on + break rename commands # As an optimization, only consider snapshots after a Xapian commit. -- 1.9.2 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[RFC] [PATCH] emacs: Add support for saved search accelerators.
Extended the saved search definition to allow the inclusion of an accelerator key for the search. Bind 'j' in the common mode map as a leader for such accelerator keys. --- This arose out a conversation in #notmuch and Mark's patch to extend the saved search custom specification based on requirements for an external package (Austin's notmuch-go.el). Re-organising the layout of the saved searches is missing (as it's lots of fiddling about with absolute numbers and I didn't want to waste time on it if this is going nowhere), so the saved searches may not all line up correctly in notmuch-hello. emacs/notmuch-hello.el | 8 ++-- emacs/notmuch-lib.el | 27 +++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 3de5238..56379ef 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -85,6 +85,7 @@ searches so they still work in customize. (group :format %v :inline t (const :format Query: :query) (string :format %v))) (checklist :inline t :format %v +(group :format %v :inline t (const :format Key: :key) (string :format %v)) (group :format %v :inline t (const :format Count-Query: :count-query) (string :format %v)) (group :format %v :inline t (const :format :sort-order) (choice :tag Sort Order @@ -551,7 +552,8 @@ with `notmuch-hello-query-counts'. (when elem (if ( column-indent 0) (widget-insert (make-string column-indent ? ))) - (let* ((name (plist-get elem :name)) + (let* ((key (plist-get elem :key)) +(name (plist-get elem :name)) (query (plist-get elem :query)) (oldest-first (case (plist-get elem :sort-order) (newest-first nil) @@ -564,7 +566,9 @@ with `notmuch-hello-query-counts'. :notify #'notmuch-hello-widget-search :notmuch-search-terms query :notmuch-search-oldest-first oldest-first - name) + (if key + (concat name ( key )) +name)) (setq column-indent (1+ (max 0 (- column-width (length name))) (setq count (1+ count)) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 2941da3..9aa7ba7 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -130,6 +130,7 @@ For example, if you wanted to remove an \inbox\ tag and add an (define-key map m 'notmuch-mua-new-mail) (define-key map = 'notmuch-refresh-this-buffer) (define-key map G 'notmuch-poll-and-refresh-this-buffer) +(define-key map j 'notmuch-jump) map) Keymap shared by all notmuch modes.) @@ -845,6 +846,32 @@ status. (defvar notmuch-show-process-crypto nil) (make-variable-buffer-local 'notmuch-show-process-crypto) +;; Jump key support: + +(defvar notmuch-jump-search nil) +(defun notmuch-jump-map () + (let ((map (make-sparse-keymap))) +(set-keymap-parent map nil) +(suppress-keymap map) +(dolist (saved-search notmuch-saved-searches) + (let ((key (plist-get saved-search :key))) + (when key + (define-key map key `(lambda () +(interactive) +(setq notmuch-jump-search ',saved-search) +(exit-minibuffer) +) +map)) + +(defun notmuch-jump () + Read a saved search accelerator key and perform the associated +search. + (interactive) + (read-from-minibuffer Jump to saved search: nil (notmuch-jump-map)) + (when notmuch-jump-search +(notmuch-search (plist-get notmuch-jump-search :query) + (plist-get notmuch-jump-search :oldest-first + (provide 'notmuch-lib) ;; Local Variables: -- 2.0.0.rc0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Improving spam-tagging keybinding function to act on region in emacs
Hello As this section was rather outdated I have updated to modern notmuch. (In fact the lisp snippets should work back to at least 0.13) On Tue, 06 May 2014, Olivier Berger olivier.ber...@telecom-sudparis.eu wrote: Hi. I've tried tu use the tips indicated at http://notmuchmail.org/emacstips/#index8h2 so as to add a keybinding to tag spam messages, and wonder if there's a possibility to make it apply on selected regions, like what notmuch-search-archive-thread does. I have added a snippet showing how to do this (and noted that is not possible in notmuch-tree as we don't have a tag region option there). I can achieve the same result using a macro to iterate over lines, but a single key press to tag results of a search filter would be quite convienent. And... at the moment, it seems to me that with the current suggested lambdas, if one presses 'S' after selecting a whole region results in tagging all sorts of messages (all ?) with the spam tag ! :-/ Btw, I think that the current examples could be improved by adding a (next-line) at the end, like : (define-key notmuch-search-mode-map S (lambda () mark messages in thread as spam (interactive) (notmuch-search-tag '(+spam -inbox)) (next-line))) I have left this as it is as this works in search mode, but not show mode and I didn't want to have too many examples. Obviously feel free to edit the wiki if you like! Best wishes Mark ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [RFC] [PATCH] emacs: Add support for saved search accelerators.
Hi Yes this looks nice modulo polishing. I think the nifty window-splitting Austin's notmuch-go does is moderately orthogonal to the keyboard shortcuts (since shortcuts can be used without it, and it could be used for other things too) On Tue, 06 May 2014, David Edmondson d...@dme.org wrote: Extended the saved search definition to allow the inclusion of an accelerator key for the search. Bind 'j' in the common mode map as a leader for such accelerator keys. --- This arose out a conversation in #notmuch and Mark's patch to extend the saved search custom specification based on requirements for an external package (Austin's notmuch-go.el). Re-organising the layout of the saved searches is missing (as it's lots of fiddling about with absolute numbers and I didn't want to waste time on it if this is going nowhere), so the saved searches may not all line up correctly in notmuch-hello. emacs/notmuch-hello.el | 8 ++-- emacs/notmuch-lib.el | 27 +++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 3de5238..56379ef 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -85,6 +85,7 @@ searches so they still work in customize. (group :format %v :inline t (const :format Query: :query) (string :format %v))) (checklist :inline t :format %v + (group :format %v :inline t (const :format Key: :key) (string :format %v)) if you use key-sequence rather than string then this is a bit nicer. It allows a multiple key press binding: eg n i or C-n. (group :format %v :inline t (const :format Count-Query: :count-query) (string :format %v)) (group :format %v :inline t (const :format :sort-order) (choice :tag Sort Order @@ -551,7 +552,8 @@ with `notmuch-hello-query-counts'. (when elem (if ( column-indent 0) (widget-insert (make-string column-indent ? ))) - (let* ((name (plist-get elem :name)) + (let* ((key (plist-get elem :key)) + (name (plist-get elem :name)) (query (plist-get elem :query)) (oldest-first (case (plist-get elem :sort-order) (newest-first nil) @@ -564,7 +566,9 @@ with `notmuch-hello-query-counts'. :notify #'notmuch-hello-widget-search :notmuch-search-terms query :notmuch-search-oldest-first oldest-first -name) +(if key +(concat name ( key )) + name)) I think it might be worth having an option to suppress the display of the binding: I think inbox (i) would annoy me, but it is good for discoverability. I, personally, would be completely happy without the displayed binding. Actually just a thought: could ? in jump-mode-map be bound to something that displayed the bindings? (setq column-indent (1+ (max 0 (- column-width (length name))) (setq count (1+ count)) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 2941da3..9aa7ba7 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -130,6 +130,7 @@ For example, if you wanted to remove an \inbox\ tag and add an (define-key map m 'notmuch-mua-new-mail) (define-key map = 'notmuch-refresh-this-buffer) (define-key map G 'notmuch-poll-and-refresh-this-buffer) +(define-key map j 'notmuch-jump) map) Keymap shared by all notmuch modes.) @@ -845,6 +846,32 @@ status. (defvar notmuch-show-process-crypto nil) (make-variable-buffer-local 'notmuch-show-process-crypto) +;; Jump key support: + +(defvar notmuch-jump-search nil) +(defun notmuch-jump-map () + (let ((map (make-sparse-keymap))) +(set-keymap-parent map nil) if you make the parent keymap the minibuffer-local-map then the various exits from the minibuffer work (ctrl-g and return for example) +(suppress-keymap map) +(dolist (saved-search notmuch-saved-searches) + (let ((key (plist-get saved-search :key))) + (when key + (define-key map key `(lambda () + (interactive) + (setq notmuch-jump-search ',saved-search) + (exit-minibuffer) + ) +map)) + +(defun notmuch-jump () + Read a saved search accelerator key and perform the associated +search. + (interactive) + (read-from-minibuffer Jump to saved search: nil (notmuch-jump-map)) + (when notmuch-jump-search +(notmuch-search (plist-get notmuch-jump-search :query) + (plist-get notmuch-jump-search :oldest-first These
[PATCH 1/5] test/Makefile.local: Added configured TALLOC_LDFLAGS.
The linking to talloc is hard-coded in the testing Makefile. This patch causes the linking to talloc to be done according to how TALLOC_LDFLAGS was configured. Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- test/Makefile.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Makefile.local b/test/Makefile.local index 987441f..d622eaf 100644 --- a/test/Makefile.local +++ b/test/Makefile.local @@ -16,7 +16,7 @@ $(dir)/arg-test: $(dir)/arg-test.o command-line-arguments.o util/libutil.a $(call quiet,CC) $^ -o $@ $(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o util/libutil.a - $(call quiet,CC) $^ -o $@ -ltalloc + $(call quiet,CC) $^ $(TALLOC_LDFLAGS) -o $@ random_corpus_deps = $(dir)/random-corpus.o $(dir)/database-test.o \ notmuch-config.o command-line-arguments.o \ -- 1.8.5.2 (Apple Git-48) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 5/5] T360-symbol-hiding: Use nm instead of objdump.
The output of `objdump -t` depends on the format of the object files which are different across platforms (e.g. Mac OS X). Since we really just want to filter the symbols in the object file, nm is a more appropriate tool since it only lists symbols from object files (nm(1)) and has a consistent output format. Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- test/T360-symbol-hiding.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index 97c734a..c5bbf27 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -33,7 +33,8 @@ test_begin_subtest 'checking output' test_expect_equal $result $output test_begin_subtest 'comparing existing to exported symbols' -objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == .text $6 ~ ^notmuch {print $6}' | sort | uniq ACTUAL + +nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' | sort | uniq ACTUAL sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq EXPORTED test_expect_equal_file EXPORTED ACTUAL -- 1.8.5.2 (Apple Git-48) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re:
On Tue, May 06 2014, David Bremner da...@tethera.net wrote: The first of these fixes a build failure on Debian Linux/armhf (and OS/X). If the patch seems ok, I'd like to roll it into a bug fix release. The second is more of a suggestion to make that atomicity test easier to debug, since it seems to find the dark corners of gdb. Hey, David. It looks like Charles's series fixes some of these same issues and more: id:1399395748-44920-1-git-send-email-ccel...@cs.stanford.edu jamie. pgpLxkBoffw_g.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.
On Tue, May 06 2014, Charles Celerier ccel...@cs.stanford.edu wrote: The Mac OS X platform uses *.dylib object files instead of *.so object files for linking. Adding the path to notmuch.dylib to the end of DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see dyld(1)). This series LGTM. I don't understand this difference suffixing DYLD_FALLBACK_LIBRARY_PATH with $TEST_DIRECTORY/../lib on Mac OS X compared to prefixing LD_LIBRARY_PATH with the same on other systems, so I take your word that it works :D Tomi Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- test/T360-symbol-hiding.sh | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index 636ec91..97c734a 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -12,7 +12,14 @@ test_description='exception symbol hiding' . ./test-lib.sh run_test(){ - result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +case $(uname -s) in +Darwin) + result=$(DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH:+$DYLD_FALLBACK_LIBRARY_PATH:}$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test 21) +;; +*) + result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +;; +esac } output=A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian' -- 1.8.5.2 (Apple Git-48) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH 3/5] atomicity.gdb: Allow breakpoint symbols to be resolved later.
On Tue, May 06 2014, Charles Celerier ccel...@cs.stanford.edu wrote: On the Mac OS X platform, the rename() function symbol is not found until the debugger begins running. The reason for this is unknown, but allowing breakpoint symbols to be resolved later both solves the problem and does not change the test. Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- test/atomicity.gdb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/atomicity.gdb b/test/atomicity.gdb index fd67525..127dc8f 100644 --- a/test/atomicity.gdb +++ b/test/atomicity.gdb @@ -18,6 +18,9 @@ shell echo 0 outcount shell touch inodes +# for gdb on mac +set breakpoint pending on + actually this particular patch could be taken from David's series as it has better comment: id:1399381588-26271-2-git-send-email-da...@tethera.net break rename commands # As an optimization, only consider snapshots after a Xapian commit. -- 1.8.5.2 (Apple Git-48) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re:
On Tue, May 06 2014, David Bremner da...@tethera.net wrote: The first of these fixes a build failure on Debian Linux/armhf (and OS/X). If the patch seems ok, I'd like to roll it into a bug fix release. The second is more of a suggestion to make that atomicity test easier to debug, since it seems to find the dark corners of gdb. Series LGTM. Tomi ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] emacs: hello: allow arbitrary lisp for generating the count.
This allows a function to be given for the count-query of a saved search. The function will be called with the query plist as an argument to generate the count shown and should return either a string or a number to be displayed as the count. If this option is a function then its query will not be part of the normal bacth query used so it may make notmuch-hello slower to display. --- There was some discussion on irc today about notmuch hello being slow (because it can make a lot of queries). This extends the new saved-searches :count-query option to allow aribtrary lisp functions. Thus a user could configure some searches to be (lambda (elem) --) so that these searches do not have a count executed and just display --. Alternatively (and at the risk of some slow down) they could configure them to be my-notmuch-count where (defun my-notmuch-count (elem) (concat (notmuch-hello-nice-number (string-to-number (car (process-lines notmuch-command count --output=messages (plist-get elem :query) / (notmuch-hello-nice-number (string-to-number (car (process-lines notmuch-command count --output=threads (plist-get elem :query))) which would display messages/threads for that particular query. Maybe the interface is too complicated but I can actually imagine using this (possibly even both of the above for different of my saved searches!) Best wishes Mark emacs/notmuch-hello.el | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 3de5238..877c84f 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -85,7 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list (group :format %v :inline t (const :format Query: :query) (string :format %v))) (checklist :inline t :format %v -(group :format %v :inline t (const :format Count-Query: :count-query) (string :format %v)) +(group :format %v :inline t (const :format Count-Query: :count-query) (sexp :format %v)) (group :format %v :inline t (const :format :sort-order) (choice :tag Sort Order (const :tag Default nil) @@ -101,9 +101,12 @@ (defcustom notmuch-saved-searches '((:name inbox :query tag:inbox) :nameName of the search (required). :query Search to run (required). - :count-query Optional extra query to generate the count - shown. If not present then the :query property - is used. + :count-query Optional extra lisp to generate the count + shown. If it is a string then it is a query + string for generating the count. If it is a + function then the function is called with the + query plist as a parameter. If it is nil or not + present then the :query property is used. :sort-order Specify the sort order to be used for the search. Possible values are 'oldest-first 'newest-first or nil. Nil means use the default sort order. @@ -493,13 +496,14 @@ (defun notmuch-hello-query-counts (query-list rest options) (dolist (elem query-list nil) (let ((count-query (or (notmuch-saved-search-get elem :count-query) (notmuch-saved-search-get elem :query - (insert -(replace-regexp-in-string - \n - (notmuch-hello-filtered-query count-query - (or (plist-get options :filter-count) - (plist-get options :filter - \n))) + (unless (functionp count-query) + (insert + (replace-regexp-in-string + \n + (notmuch-hello-filtered-query count-query + (or (plist-get options :filter-count) + (plist-get options :filter + \n (unless (= (call-process-region (point-min) (point-max) notmuch-command t t nil count --batch) 0) @@ -515,12 +519,17 @@ (defun notmuch-hello-query-counts (query-list rest options) (mapcar (lambda (elem) (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)) + (count-query (plist-get elem-plist :count-query)) (search-query (plist-get elem-plist :query)) (filtered-query (notmuch-hello-filtered-query search-query (plist-get options :filter))) - (message-count (prog1 (read (current-buffer)) - (forward-line 1 - (when (and filtered-query (or (plist-get options
Re: [PATCH 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.
Tomi Ollila tomi.oll...@iki.fi writes: On Tue, May 06 2014, Charles Celerier ccel...@cs.stanford.edu wrote: The Mac OS X platform uses *.dylib object files instead of *.so object files for linking. Adding the path to notmuch.dylib to the end of DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see dyld(1)). This series LGTM. I don't understand this difference suffixing DYLD_FALLBACK_LIBRARY_PATH with $TEST_DIRECTORY/../lib on Mac OS X compared to prefixing LD_LIBRARY_PATH with the same on other systems, so I take your word that it works :D I just went back and read dyld(1) again. Prefixing would be fine, and I agree it would look cleaner. Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- test/T360-symbol-hiding.sh | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index 636ec91..97c734a 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -12,7 +12,14 @@ test_description='exception symbol hiding' . ./test-lib.sh run_test(){ - result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +case $(uname -s) in +Darwin) + result=$(DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH:+$DYLD_FALLBACK_LIBRARY_PATH:}$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test 21) +;; +*) + result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +;; +esac } output=A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian' -- 1.8.5.2 (Apple Git-48) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch pgpaHdsikiQIi.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] lib: Precede all function names in notmuch-private.h with an underscore.
An underscore should precede every function name in lib/notmuch-private.h. This was not true and was noted by the failure of test T360-symbol-hiding on Mac OS/X. This patch inserts an underscore before each function name in lib/notmuch-private.h where the underscore was missing and renames functions appropriately where they are used. Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- lib/database.cc | 24 lib/message-file.c| 8 lib/message.cc| 8 lib/notmuch-private.h | 14 +++--- lib/sha1.c| 4 ++-- lib/thread.cc | 4 ++-- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 1efb14d..d9a01b7 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -356,7 +356,7 @@ _message_id_compressed (void *ctx, const char *message_id) { char *sha1, *compressed; -sha1 = notmuch_sha1_of_string (message_id); +sha1 = _notmuch_sha1_of_string (message_id); compressed = talloc_asprintf (ctx, notmuch-sha1-%s, sha1); free (sha1); @@ -1356,7 +1356,7 @@ _notmuch_database_get_directory_db_path (const char *path) int term_len = strlen (_find_prefix (directory)) + strlen (path); if (term_len NOTMUCH_TERM_MAX) - return notmuch_sha1_of_string (path); + return _notmuch_sha1_of_string (path); else return path; } @@ -1758,12 +1758,12 @@ _notmuch_database_link_message_to_parents (notmuch_database_t *notmuch, _my_talloc_free_for_g_hash, NULL); this_message_id = notmuch_message_get_message_id (message); -refs = notmuch_message_file_get_header (message_file, references); +refs = _notmuch_message_file_get_header (message_file, references); last_ref_message_id = parse_references (message, this_message_id, parents, refs); -in_reply_to = notmuch_message_file_get_header (message_file, in-reply-to); +in_reply_to = _notmuch_message_file_get_header (message_file, in-reply-to); in_reply_to_message_id = parse_references (message, this_message_id, parents, in_reply_to); @@ -1961,7 +1961,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (ret) return ret; -message_file = notmuch_message_file_open (filename); +message_file = _notmuch_message_file_open (filename); if (message_file == NULL) return NOTMUCH_STATUS_FILE_ERROR; @@ -1982,9 +1982,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch, * let's make sure that what we're looking at looks like an * actual email message. */ - from = notmuch_message_file_get_header (message_file, from); - subject = notmuch_message_file_get_header (message_file, subject); - to = notmuch_message_file_get_header (message_file, to); + from = _notmuch_message_file_get_header (message_file, from); + subject = _notmuch_message_file_get_header (message_file, subject); + to = _notmuch_message_file_get_header (message_file, to); if ((from == NULL || *from == '\0') (subject == NULL || *subject == '\0') @@ -1997,7 +1997,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, /* Now that we're sure it's mail, the first order of business * is to find a message ID (or else create one ourselves). */ - header = notmuch_message_file_get_header (message_file, message-id); + header = _notmuch_message_file_get_header (message_file, message-id); if (header *header != '\0') { message_id = _parse_message_id (message_file, header, NULL); @@ -2018,7 +2018,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (message_id == NULL ) { /* No message-id at all, let's generate one by taking a * hash over the file's contents. */ - char *sha1 = notmuch_sha1_of_file (filename); + char *sha1 = _notmuch_sha1_of_file (filename); /* If that failed too, something is really wrong. Give up. */ if (sha1 == NULL) { @@ -2058,7 +2058,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (ret) goto DONE; - date = notmuch_message_file_get_header (message_file, date); + date = _notmuch_message_file_get_header (message_file, date); _notmuch_message_set_header_values (message, date, from, subject); ret = _notmuch_message_index_file (message, message_file); @@ -2087,7 +2087,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, } if (message_file) - notmuch_message_file_close (message_file); + _notmuch_message_file_close (message_file); ret2 = notmuch_database_end_atomic
Re: [PATCH 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.
On Tue, May 06 2014, Charles Celerier ccel...@cs.stanford.edu wrote: Tomi Ollila tomi.oll...@iki.fi writes: On Tue, May 06 2014, Charles Celerier ccel...@cs.stanford.edu wrote: The Mac OS X platform uses *.dylib object files instead of *.so object files for linking. Adding the path to notmuch.dylib to the end of DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see dyld(1)). This series LGTM. I don't understand this difference suffixing DYLD_FALLBACK_LIBRARY_PATH with $TEST_DIRECTORY/../lib on Mac OS X compared to prefixing LD_LIBRARY_PATH with the same on other systems, so I take your word that it works :D I just went back and read dyld(1) again. Prefixing would be fine, and I agree it would look cleaner. That would also be less confusing. You could send a replacement patch 4/5 and use id:1399395748-44920-5-git-send-email-ccel...@cs.stanford.edu as reply-to: let's see how nmbug sorts those patches, then :D Tomi Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- test/T360-symbol-hiding.sh | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index 636ec91..97c734a 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -12,7 +12,14 @@ test_description='exception symbol hiding' . ./test-lib.sh run_test(){ - result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +case $(uname -s) in +Darwin) + result=$(DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH:+$DYLD_FALLBACK_LIBRARY_PATH:}$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test 21) +;; +*) + result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +;; +esac } output=A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian' -- 1.8.5.2 (Apple Git-48) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] build: check .git directory existence in srcdir (for out-of-tree builds)
So that $(VERSION) and version.stamp uses the git-describe -based version data instead of the content of `version' file. For consistency also the git commands in Makefile[.local] target `verify-no-dirty-code' uses the git --git-dir=$srcdir/.git ... commands (inside ifeq($(IS_GIT),yes)). Attempting to make this target outside of the tree will fail in any case. --- Makefile.local | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.local b/Makefile.local index f0c4453574b8..a9a6df8bf0e0 100644 --- a/Makefile.local +++ b/Makefile.local @@ -10,10 +10,10 @@ # repository), we let git append identification of the actual commit. PACKAGE=notmuch -IS_GIT=$(shell if [ -d .git ] ; then echo yes ; else echo no; fi) +IS_GIT=$(shell if [ -d ${srcdir}/.git ] ; then echo yes ; else echo no; fi) ifeq ($(IS_GIT),yes) -DATE:=$(shell git log --date=short -1 --pretty=format:%cd) +DATE:=$(shell git --git-dir=${srcdir}/.git log --date=short -1 --pretty=format:%cd) else DATE:=$(shell date +%F) endif @@ -21,7 +21,7 @@ endif VERSION:=$(shell cat ${srcdir}/version) ifeq ($(filter release release-message pre-release update-versions,$(MAKECMDGOALS)),) ifeq ($(IS_GIT),yes) -VERSION:=$(shell git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/) +VERSION:=$(shell git --git-dir=${srcdir}/.git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/) # Write the file 'version.stamp' in case its contents differ from $(VERSION) FILE_VERSION:=$(shell test -f version.stamp read vs version.stamp || vs=; echo $$vs) ifneq ($(FILE_VERSION),$(VERSION)) @@ -200,11 +200,11 @@ verify-source-tree-and-version: verify-no-dirty-code verify-no-dirty-code: release-checks ifeq ($(IS_GIT),yes) @printf Checking that source tree is clean... -ifneq ($(shell git ls-files -m),) +ifneq ($(shell git --git-dir=${srcdir}/.git ls-files -m),) @echo No @echo The following files have been modified since the most recent git commit: @echo - @git ls-files -m + @git --git-dir=${srcdir}/.git ls-files -m @echo @echo The release will be made from the committed state, but perhaps you meant @echo to commit this code first? Please clean this up to make it more clear. -- 1.8.0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
pkg-config zlib check in 3c13bc
Dear notmuch, Although notmuch was configuring fine on FreeBSD before 3c13bc, the pkg-config check introduced for zlib does not work. Indeed, zlib is part of the base system, and always assumed to be present. Proposed patch puts platform test before pkg-config checks, and add a special case for zlib on FreeBSD. uname -U is used to get (numeric) OS version, and compared to lowest release where at least zlib 1.2.5.2 was available (that’s FreeBSD 9.1, with zlib 1.2.7). Best, -- Xīcò From ca0b168ac01391b4137de504bea2845d39d0fff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?X=C4=ABc=C3=B2?= x...@atelo.org Date: Tue, 6 May 2014 12:37:32 -0700 Subject: [PATCH 1/1] FreeBSD check for zlib version. --- configure | 130 +- 1 file changed, 69 insertions(+), 61 deletions(-) diff --git a/configure b/configure index 9bde2eb..7204812 100755 --- a/configure +++ b/configure @@ -270,6 +270,62 @@ EOF errors=0 +libdir_in_ldconfig=0 + +printf Checking which platform we are on... +uname=`uname` +if [ $uname = Darwin ] ; then +printf Mac OS X.\n +platform=MACOSX +linker_resolves_library_dependencies=0 +elif [ $uname = SunOS ] ; then +printf Solaris.\n +platform=SOLARIS +linker_resolves_library_dependencies=0 +elif [ $uname = FreeBSD ] ; then +printf FreeBSD.\n +platform=FREEBSD +linker_resolves_library_dependencies=0 +elif [ $uname = OpenBSD ] ; then +printf OpenBSD.\n +platform=OPENBSD +linker_resolves_library_dependencies=0 +elif [ $uname = Linux ] || [ $uname = GNU ] ; then +printf $uname\n +platform=$uname +linker_resolves_library_dependencies=1 + +printf Checking for $libdir_expanded in ldconfig... +ldconfig_paths=$(/sbin/ldconfig -N -X -v 2/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p') +# Separate ldconfig_paths only on newline (not on any potential +# embedded space characters in any filenames). Note, we use a +# literal newline in the source here rather than something like: +# +# IFS=$(printf '\n') +# +# because the shell's command substitution deletes any trailing newlines. +IFS= + +for path in $ldconfig_paths; do + if [ $path = $libdir_expanded ]; then + libdir_in_ldconfig=1 + fi +done +IFS=$DEFAULT_IFS +if [ $libdir_in_ldconfig = '0' ]; then + printf No (will set RPATH)\n +else + printf Yes\n +fi +else +printf Unknown.\n +cat EOF + +*** Warning: Unknown platform. Notmuch might or might not build correctly. + +EOF +fi + if pkg-config --version /dev/null 21; then have_pkg_config=1 else @@ -342,14 +398,22 @@ fi printf Checking for zlib (= 1.2.5.2)... have_zlib=0 -if pkg-config --atleast-version=1.2.5.2 zlib; then +# zlib is part of base in FreeBSD. version 9.1 included 1.2.7 +if [ $platform = FREEBSD -a `uname -U` -ge 901000 ] ; then printf Yes.\n have_zlib=1 -zlib_cflags=$(pkg-config --cflags zlib) -zlib_ldflags=$(pkg-config --libs zlib) +zlib_cflags= +zlib_ldflags=-lz else -printf No.\n -errors=$((errors + 1)) +if pkg-config --atleast-version=1.2.5.2 zlib; then +printf Yes.\n +have_zlib=1 +zlib_cflags=$(pkg-config --cflags zlib) +zlib_ldflags=$(pkg-config --libs zlib) +else +printf No.\n +errors=$((errors + 1)) +fi fi printf Checking for talloc development files... @@ -427,62 +491,6 @@ else fi fi -libdir_in_ldconfig=0 - -printf Checking which platform we are on... -uname=`uname` -if [ $uname = Darwin ] ; then -printf Mac OS X.\n -platform=MACOSX -linker_resolves_library_dependencies=0 -elif [ $uname = SunOS ] ; then -printf Solaris.\n -platform=SOLARIS -linker_resolves_library_dependencies=0 -elif [ $uname = FreeBSD ] ; then -printf FreeBSD.\n -platform=FREEBSD -linker_resolves_library_dependencies=0 -elif [ $uname = OpenBSD ] ; then -printf OpenBSD.\n -platform=OPENBSD -linker_resolves_library_dependencies=0 -elif [ $uname = Linux ] || [ $uname = GNU ] ; then -printf $uname\n -platform=$uname -linker_resolves_library_dependencies=1 - -printf Checking for $libdir_expanded in ldconfig... -ldconfig_paths=$(/sbin/ldconfig -N -X -v 2/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p') -# Separate ldconfig_paths only on newline (not on any potential -# embedded space characters in any filenames). Note, we use a -# literal newline in the source here rather than something like: -# -# IFS=$(printf '\n') -# -# because the shell's command substitution deletes any trailing newlines. -IFS= - -for path in $ldconfig_paths; do - if [ $path = $libdir_expanded ]; then - libdir_in_ldconfig=1 - fi -done -IFS=$DEFAULT_IFS -if [ $libdir_in_ldconfig = '0' ]; then - printf No (will set RPATH)\n -else - printf Yes\n -fi -else -printf Unknown.\n -cat EOF - -*** Warning: Unknown
Linux-only fdatasync() in 3c13bc
Also, commit 3c13bc introduced a call to fdatasync() which is not available on FreeBSD, and probably not either on MacOS at least. Best, -- Xīcò From e2b9520e69e52b35348d07eb53a6a88d1397fa3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?X=C4=ABc=C3=B2?= x...@atelo.org Date: Tue, 6 May 2014 12:56:03 -0700 Subject: [PATCH 1/1] =?UTF-8?q?Compatibility=20for=20Linux=E2=80=99s=20fda?= =?UTF-8?q?tasync().?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configure | 7 +++ notmuch-dump.c | 4 2 files changed, 11 insertions(+) diff --git a/configure b/configure index 7204812..7bc602d 100755 --- a/configure +++ b/configure @@ -271,6 +271,7 @@ EOF errors=0 libdir_in_ldconfig=0 +have_fdatasync=0 printf Checking which platform we are on... uname=`uname` @@ -294,6 +295,7 @@ elif [ $uname = Linux ] || [ $uname = GNU ] ; then printf $uname\n platform=$uname linker_resolves_library_dependencies=1 +have_fdatasync=1 printf Checking for $libdir_expanded in ldconfig... ldconfig_paths=$(/sbin/ldconfig -N -X -v 2/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p') @@ -859,6 +861,9 @@ HAVE_D_TYPE = ${have_d_type} # Whether the Xapian version in use supports compaction HAVE_XAPIAN_COMPACT = ${have_xapian_compact} +# Optimized fsync() on Linux +HAVE_FDATASYNC = ${have_fdatasync} + # Whether the getpwuid_r function is standards-compliant # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS # to enable the standards-compliant version -- needed for Solaris) @@ -926,6 +931,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ -DSTD_GETPWUID=\$(STD_GETPWUID) \\ -DSTD_ASCTIME=\$(STD_ASCTIME) \\ -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\ + -DHAVE_FDATASYNC=\$(HAVE_FDATASYNC) \\ -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER) CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)\\ @@ -939,6 +945,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)\\ -DSTD_GETPWUID=\$(STD_GETPWUID) \\ -DSTD_ASCTIME=\$(STD_ASCTIME) \\ -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\ + -DHAVE_FDATASYNC=\$(HAVE_FDATASYNC) \\ -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER) CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS) diff --git a/notmuch-dump.c b/notmuch-dump.c index 2849eab..86b275a 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -169,7 +169,11 @@ notmuch_database_dump (notmuch_database_t *notmuch, } if (output_file_name) { +#if HAVE_FDATASYNC ret = fdatasync (outfd); +#else + ret = fsync (outfd); +#endif if (ret) { fprintf (stderr, Error syncing %s to disk: %s\n, name_for_error, strerror (errno)); -- 1.9.2 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: pkg-config zlib check in 3c13bc
On Tue, May 06 2014, Xīcò x...@atelo.org wrote: Dear notmuch, Although notmuch was configuring fine on FreeBSD before 3c13bc, the pkg-config check introduced for zlib does not work. Indeed, zlib is part of the base system, and always assumed to be present. Proposed patch puts platform test before pkg-config checks, and add a special case for zlib on FreeBSD. uname -U is used to get (numeric) OS version, and compared to lowest release where at least zlib 1.2.5.2 was available (that’s FreeBSD 9.1, with zlib 1.2.7). Best, This line: if [ $platform = FREEBSD -a `uname -U` -ge 901000 ] ; then fails on systems where uname does not have -U option as `uname -U` is executed always... if [ $platform = FREEBSD ] [ `uname -U` -ge 901000 ] ; then would work better there... But, I'd like suggest alternate option to create a test c program and test whether it compiles (analogous to what there is already done with many other checks) -- this same would apply to fdatasync() case too. If we cared about cross-compilability one could also do zlib_vernum=$(printf '#include zlib.h\nZLIB_VERNUM' | gcc -E - | sed -n '$ s/^0x/0x/p') if [ $((${zlib_vernum:-0})) -ge 4690 ]; then # 4690 == 0x1252 printf Yes\n ... But that would be so inconsistent what we have now (and possibly fragile?) -- Xīcò Tomi From ca0b168ac01391b4137de504bea2845d39d0fff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?X=C4=ABc=C3=B2?= x...@atelo.org Date: Tue, 6 May 2014 12:37:32 -0700 Subject: [PATCH 1/1] FreeBSD check for zlib version. --- configure | 130 +- 1 file changed, 69 insertions(+), 61 deletions(-) diff --git a/configure b/configure index 9bde2eb..7204812 100755 --- a/configure +++ b/configure @@ -270,6 +270,62 @@ EOF errors=0 +libdir_in_ldconfig=0 + +printf Checking which platform we are on... +uname=`uname` +if [ $uname = Darwin ] ; then +printf Mac OS X.\n +platform=MACOSX +linker_resolves_library_dependencies=0 +elif [ $uname = SunOS ] ; then +printf Solaris.\n +platform=SOLARIS +linker_resolves_library_dependencies=0 +elif [ $uname = FreeBSD ] ; then +printf FreeBSD.\n +platform=FREEBSD +linker_resolves_library_dependencies=0 +elif [ $uname = OpenBSD ] ; then +printf OpenBSD.\n +platform=OPENBSD +linker_resolves_library_dependencies=0 +elif [ $uname = Linux ] || [ $uname = GNU ] ; then +printf $uname\n +platform=$uname +linker_resolves_library_dependencies=1 + +printf Checking for $libdir_expanded in ldconfig... +ldconfig_paths=$(/sbin/ldconfig -N -X -v 2/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p') +# Separate ldconfig_paths only on newline (not on any potential +# embedded space characters in any filenames). Note, we use a +# literal newline in the source here rather than something like: +# +#IFS=$(printf '\n') +# +# because the shell's command substitution deletes any trailing newlines. +IFS= + +for path in $ldconfig_paths; do + if [ $path = $libdir_expanded ]; then + libdir_in_ldconfig=1 + fi +done +IFS=$DEFAULT_IFS +if [ $libdir_in_ldconfig = '0' ]; then + printf No (will set RPATH)\n +else + printf Yes\n +fi +else +printf Unknown.\n +cat EOF + +*** Warning: Unknown platform. Notmuch might or might not build correctly. + +EOF +fi + if pkg-config --version /dev/null 21; then have_pkg_config=1 else @@ -342,14 +398,22 @@ fi printf Checking for zlib (= 1.2.5.2)... have_zlib=0 -if pkg-config --atleast-version=1.2.5.2 zlib; then +# zlib is part of base in FreeBSD. version 9.1 included 1.2.7 +if [ $platform = FREEBSD -a `uname -U` -ge 901000 ] ; then printf Yes.\n have_zlib=1 -zlib_cflags=$(pkg-config --cflags zlib) -zlib_ldflags=$(pkg-config --libs zlib) +zlib_cflags= +zlib_ldflags=-lz else -printf No.\n -errors=$((errors + 1)) +if pkg-config --atleast-version=1.2.5.2 zlib; then +printf Yes.\n +have_zlib=1 +zlib_cflags=$(pkg-config --cflags zlib) +zlib_ldflags=$(pkg-config --libs zlib) +else +printf No.\n +errors=$((errors + 1)) +fi fi printf Checking for talloc development files... @@ -427,62 +491,6 @@ else fi fi -libdir_in_ldconfig=0 - -printf Checking which platform we are on... -uname=`uname` -if [ $uname = Darwin ] ; then -printf Mac OS X.\n -platform=MACOSX -linker_resolves_library_dependencies=0 -elif [ $uname = SunOS ] ; then -printf Solaris.\n -platform=SOLARIS -linker_resolves_library_dependencies=0 -elif [ $uname = FreeBSD ] ; then -printf FreeBSD.\n -platform=FREEBSD -linker_resolves_library_dependencies=0 -elif [ $uname = OpenBSD ] ; then -printf OpenBSD.\n -
Re: [PATCH v2 00/10] add insert --must-index option
On Wed, Apr 16 2014, Peter Wang noval...@gmail.com wrote: Follow up to id:1374365254-13227-1-git-send-email-noval...@gmail.com The main changes are to take into account failures during tagging and flushing of the database. I took Jani's patch id:1390152046-6509-1-git-send-email-j...@nikula.org without modification. The soname bump is included in case it is required. I guess it is -- then changing in that file is not enough, lib/notmuch.h needs to have the same change. But, would a MINOR value update work -- anyone who needs only 3.1.0 could also work with 3.2.0... If MINOR update were sufficient then we would not need to add api changes that supports logging (etc.) to this conversation... ... but anyone interested these changes should also take a look of the actual changes... :D Tomi The python/go/ruby changes are untested. Jani Nikula (1): lib: add return status to database close and destroy Peter Wang (9): lib: bump soname python: handle return status of database close and destroy go: add return status to database close method ruby: handle return status of database close cli: refactor insert cli: indicate insert failure mode in exit status cli: add insert --must-index option test: test insert --must-index man: update insert documentation bindings/go/src/notmuch/notmuch.go | 4 +- bindings/python/notmuch/database.py | 12 ++-- bindings/ruby/database.c| 4 +- doc/man1/notmuch-insert.rst | 24 +-- lib/Makefile.local | 2 +- lib/database.cc | 30 ++-- lib/notmuch.h | 15 +++- notmuch-insert.c| 134 +--- test/T070-insert.sh | 32 +++-- 9 files changed, 176 insertions(+), 81 deletions(-) -- 1.8.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 5/5] T360-symbol-hiding: Use nm instead of objdump.
The output of `objdump -t` depends on the format of the object files which are different across platforms (e.g. Mac OS X). Since we really just want to filter the symbols in the object file, nm is a more appropriate tool since it only lists symbols from object files (nm(1)) and has a consistent output format. Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- test/T360-symbol-hiding.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index 9239fc1..21cabca 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -33,7 +33,7 @@ test_begin_subtest 'checking output' test_expect_equal $result $output test_begin_subtest 'comparing existing to exported symbols' -objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == .text $6 ~ ^notmuch {print $6}' | sort | uniq ACTUAL +nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' | sort | uniq ACTUAL sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq EXPORTED test_expect_equal_file EXPORTED ACTUAL -- 1.8.5.2 (Apple Git-48) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.
The Mac OS X platform uses *.dylib object files instead of *.so object files for linking. Adding the path to notmuch.dylib to the end of DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see dyld(1)). Signed-off-by: Charles Celerier ccel...@cs.stanford.edu --- test/T360-symbol-hiding.sh | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index 636ec91..9239fc1 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -12,7 +12,14 @@ test_description='exception symbol hiding' . ./test-lib.sh run_test(){ - result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +case $(uname -s) in +Darwin) + result=$(DYLD_FALLBACK_LIBRARY_PATH=$TEST_DIRECTORY/../lib${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +;; +*) + result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} $TEST_DIRECTORY/symbol-test 21) +;; +esac } output=A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian' -- 1.8.5.2 (Apple Git-48) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] emacs: hello: allow arbitrary lisp for generating the count.
Looks good, two nits: On Tue, May 06 2014, Mark Walters markwalters1...@gmail.com wrote: This allows a function to be given for the count-query of a saved search. The function will be called with the query plist as an argument to generate the count shown and should return either a string or a number to be displayed as the count. If this option is a function then its query will not be part of the normal bacth query used so it may make notmuch-hello slower to display. batch --- There was some discussion on irc today about notmuch hello being slow (because it can make a lot of queries). This extends the new saved-searches :count-query option to allow aribtrary lisp functions. Thus a user could configure some searches to be (lambda (elem) --) so that these searches do not have a count executed and just display --. Alternatively (and at the risk of some slow down) they could configure them to be my-notmuch-count where (defun my-notmuch-count (elem) (concat (notmuch-hello-nice-number (string-to-number (car (process-lines notmuch-command count --output=messages (plist-get elem :query) / (notmuch-hello-nice-number (string-to-number (car (process-lines notmuch-command count --output=threads (plist-get elem :query))) which would display messages/threads for that particular query. Maybe the interface is too complicated but I can actually imagine using this (possibly even both of the above for different of my saved searches!) Best wishes Mark emacs/notmuch-hello.el | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 3de5238..877c84f 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -85,7 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list (group :format %v :inline t (const :format Query: :query) (string :format %v))) (checklist :inline t :format %v - (group :format %v :inline t (const :format Count-Query: :count-query) (string :format %v)) + (group :format %v :inline t (const :format Count-Query: :count-query) (sexp :format %v)) (group :format %v :inline t (const :format :sort-order) (choice :tag Sort Order (const :tag Default nil) @@ -101,9 +101,12 @@ (defcustom notmuch-saved-searches '((:name inbox :query tag:inbox) :nameName of the search (required). :query Search to run (required). - :count-query Optional extra query to generate the count - shown. If not present then the :query property - is used. + :count-query Optional extra lisp to generate the count Optional function to generate the count + shown. If it is a string then it is a query + string for generating the count. If it is a + function then the function is called with the + query plist as a parameter. If it is nil or not + present then the :query property is used. :sort-order Specify the sort order to be used for the search. Possible values are 'oldest-first 'newest-first or nil. Nil means use the default sort order. @@ -493,13 +496,14 @@ (defun notmuch-hello-query-counts (query-list rest options) (dolist (elem query-list nil) (let ((count-query (or (notmuch-saved-search-get elem :count-query) (notmuch-saved-search-get elem :query - (insert - (replace-regexp-in-string - \n - (notmuch-hello-filtered-query count-query - (or (plist-get options :filter-count) - (plist-get options :filter - \n))) + (unless (functionp count-query) + (insert +(replace-regexp-in-string + \n + (notmuch-hello-filtered-query count-query + (or (plist-get options :filter-count) + (plist-get options :filter +\n (unless (= (call-process-region (point-min) (point-max) notmuch-command t t nil count --batch) 0) @@ -515,12 +519,17 @@ (defun notmuch-hello-query-counts (query-list rest options) (mapcar (lambda (elem) (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)) +(count-query (plist-get elem-plist :count-query)) (search-query (plist-get elem-plist :query)) (filtered-query (notmuch-hello-filtered-query search-query (plist-get options