[PATCH v2] emacs: search: allow command line args as part of query
This allows command line arguments for notmuch-search to be part of the query-string. The string must be of the form [:blank:]*--cli-arguments -- query. I hope this doesn't clash with xapian: I believe that queries shouldn't start with a "-". Correctly parsed example queries are --sort=oldest-first -- tag:inbox --exclude=false -- from:fred Some options (currently only sort-order) we parse in emacs, the rest we just pass to the cli. In light testing it seems to work. A full custom parser would be nicer but at least here we are only parsing the non-query part of a string which is relatively simple: indeed we already do that in the c code. We could just implement the option for sort-order, but I thought for interface consistency making all the options (sort-order exclude limit and offset) work was worth the small extra hassle. --- This is a rather more complete version of the parent patch with a key bugfix (thanks to Jani): saved searches with cli arguments work, refreshing a query works correctly, filtering a query works correctly (and can take extra cli arguments). It may all be too complex, and it may be too hackish but it does seem to work. Best wishes Mark emacs/notmuch-hello.el |5 +++-- emacs/notmuch-lib.el | 23 +++ emacs/notmuch.el | 36 +--- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index c1c6f4b..bcc1843 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -383,10 +383,11 @@ options will be handled as specified for `notmuch-hello-insert-searches'." (with-temp-buffer (dolist (elem query-alist nil) - (let ((count-query (if (consp (cdr elem)) + (let* ((full-count-query (if (consp (cdr elem)) ;; do we have a different query for the message count? (third elem) - (cdr elem + (cdr elem))) +(count-query (car (notmuch-parse-query full-count-query (insert (notmuch-hello-filtered-query count-query (or (plist-get options :filter-count) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 28f78e0..705d4f3 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -189,6 +189,29 @@ user-friendly queries." "Return a query that matches the message with id ID." (concat "id:" (notmuch-escape-boolean-term id))) +(defun notmuch-search-parse-sort-order (args oldest-first) + (dolist (arg args nil) +(when (equal arg "--sort=oldest-first") + (setq oldest-first t)) +(when (equal arg "--sort=newest-first") + (setq oldest-first nil))) + (setq args (delete "--sort=oldest-first" args)) + (setq args (delete "--sort=newest-first" args)) + (cons oldest-first args)) + +(defun notmuch-parse-query (query) + "Parse a query into a search and cli arguments + +Returns a list consisting of query followed by the cli-args (as a +list). If the string does not have cli-args then this will be nil." + + (if (string-match "^[[:blank:]]*--.*? -- " query) + (let ((actual-query (substring query (match-end 0))) + (args (split-string (match-string 0 query) " " t))) + (message "Parsing query") + (cons actual-query args)) +;; no cli arguments +(list query))) ;; (defun notmuch-common-do-stash (text) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 7994d74..6a4052e 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -255,6 +255,7 @@ For a mouse binding, return nil." (notmuch-common-do-stash (notmuch-search-find-thread-id))) (defvar notmuch-search-query-string) +(defvar notmuch-search-query-args) (defvar notmuch-search-target-thread) (defvar notmuch-search-target-line) (defvar notmuch-search-continuation) @@ -409,6 +410,7 @@ Complete list of currently available key bindings: (interactive) (kill-all-local-variables) (make-local-variable 'notmuch-search-query-string) + (make-local-variable 'notmuch-search-query-args) (make-local-variable 'notmuch-search-oldest-first) (make-local-variable 'notmuch-search-target-thread) (make-local-variable 'notmuch-search-target-line) @@ -897,7 +899,7 @@ PROMPT is the string to prompt with." 'notmuch-search-history nil nil) ;;;###autoload -(defun notmuch-search ( query oldest-first target-thread target-line continuation) +(defun notmuch-search ( query oldest-first target-thread target-line continuation cli-args) "Run \"notmuch search\" with the given `query' and display results. If `query' is nil, it is read interactively from the minibuffer. @@ -909,13 +911,20 @@ Other optional parameters are used as follows: target-line: The line number to move to if the target thread does not appear in the search results." (interactive) - (let* ((query (or query (notmuch-read-query "Notmuch
[PATCH] emacs: update search sort order help to match code
--- emacs/notmuch-lib.el |7 ++- emacs/notmuch.el | 13 ++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 28f78e0..c43d5a9 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -68,7 +68,12 @@ :group 'notmuch) (defcustom notmuch-search-oldest-first t - "Show the oldest mail first when searching." + "Show the oldest mail first when searching. + +This variable defines the default sort order for displaying +search results. Note that any filtered searches created by +`notmuch-search-filter' retain the search order of the parent +search." :type 'boolean :group 'notmuch-search) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 26ba7e7..cc62088 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -1030,17 +1030,8 @@ depending on the value of `notmuch-poll-script'." (defun notmuch-search-toggle-order () "Toggle the current search order. -By default, the \"inbox\" view created by `notmuch' is displayed -in chronological order (oldest thread at the beginning of the -buffer), while any global searches created by `notmuch-search' -are displayed in reverse-chronological order (newest thread at -the beginning of the buffer). - -This command toggles the sort order for the current search. - -Note that any filtered searches created by -`notmuch-search-filter' retain the search order of the parent -search." +This command toggles the sort order for the current search. The +default sort order is defined by `notmuch-search-oldest-first'." (interactive) (set 'notmuch-search-oldest-first (not notmuch-search-oldest-first)) (notmuch-search-refresh-view)) -- 1.7.10.4
[RFC PATCH] emacs: Remove v command
On Mon, Jun 03 2013, Austin Clements wrote: > This removes the v command, since we now have much nicer part commands, > and deprecates the underlying notmuch-show-view-all-mime-parts. This > also means that people who try using the old unprefixed 'v' command on > a part button will no longer be greeted by ALL of their parts popping > up. > --- +1 Tomi > emacs/notmuch-show.el |4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 5771950..bae3171 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -213,6 +213,9 @@ For example, if you wanted to remove an \"unread\" tag > and add a >"Enable Visual Line mode." >(visual-line-mode t)) > > +;; DEPRECATED in Notmuch 0.16 since we now have convenient part > +;; commands. We'll keep the command around for a version or two in > +;; case people want to bind it themselves. > (defun notmuch-show-view-all-mime-parts () >"Use external viewers to view all attachments from the current message." >(interactive) > @@ -1216,7 +1219,6 @@ reset based on the original query." > (define-key map "|" 'notmuch-show-pipe-message) > (define-key map "w" 'notmuch-show-save-attachments) > (define-key map "V" 'notmuch-show-view-raw-message) > - (define-key map "v" 'notmuch-show-view-all-mime-parts) > (define-key map "c" 'notmuch-show-stash-map) > (define-key map "=" 'notmuch-show-refresh-view) > (define-key map "h" 'notmuch-show-toggle-visibility-headers) > -- > 1.7.10.4 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] emacs: Fix applying stickiness to the :notmuch-part property
On Mon, Jun 03 2013, Austin Clements wrote: > Previously, we simply called pushnew to add :notmuch-part to the > front-sticky and rear-nonsticky text property lists. This works if > these are nil or lists, but they can also have the value t, meaning > that all properties are front-sticky/rear-nonsticky. In this case, > pushnew will signal an error because t is not a list. We never set > these properties to t ourselves, but since we apply these property > changes over arbitrary renderer output, we have to deal with this > possibility. > --- LGTM (took a while to understand :D). Tomi > emacs/notmuch-show.el | 13 ++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 5771950..83bb9ad 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part." > (notmuch-map-text-property beg (point) :notmuch-part > (lambda (v) (or v part))) > ;; Make :notmuch-part front sticky and rear non-sticky so it stays > -;; applied to the beginning of each line when we indent the message. > +;; applied to the beginning of each line when we indent the > +;; message. Since we're operating on arbitrary renderer output, > +;; watch out for sticky specs of t, which means all properties are > +;; front-sticky/rear-nonsticky. > (notmuch-map-text-property beg (point) 'front-sticky > -(lambda (v) (pushnew :notmuch-part v))) > +(lambda (v) (if (listp v) > +(pushnew :notmuch-part v) > + v))) > (notmuch-map-text-property beg (point) 'rear-nonsticky > -(lambda (v) (pushnew :notmuch-part v) > +(lambda (v) (if (listp v) > +(pushnew :notmuch-part v) > + v) > > (defun notmuch-show-insert-body (msg body depth) >"Insert the body BODY at depth DEPTH in the current thread." > -- > 1.7.10.4 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] emacs: Fix applying stickiness to the :notmuch-part property
LGTM +1. This fixes the test failures (and errors in the emacs display) I was seeing on one of my systems. Best wishes Mark Austin Clements writes: > Previously, we simply called pushnew to add :notmuch-part to the > front-sticky and rear-nonsticky text property lists. This works if > these are nil or lists, but they can also have the value t, meaning > that all properties are front-sticky/rear-nonsticky. In this case, > pushnew will signal an error because t is not a list. We never set > these properties to t ourselves, but since we apply these property > changes over arbitrary renderer output, we have to deal with this > possibility. > --- > emacs/notmuch-show.el | 13 ++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 5771950..83bb9ad 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part." > (notmuch-map-text-property beg (point) :notmuch-part > (lambda (v) (or v part))) > ;; Make :notmuch-part front sticky and rear non-sticky so it stays > -;; applied to the beginning of each line when we indent the message. > +;; applied to the beginning of each line when we indent the > +;; message. Since we're operating on arbitrary renderer output, > +;; watch out for sticky specs of t, which means all properties are > +;; front-sticky/rear-nonsticky. > (notmuch-map-text-property beg (point) 'front-sticky > -(lambda (v) (pushnew :notmuch-part v))) > +(lambda (v) (if (listp v) > +(pushnew :notmuch-part v) > + v))) > (notmuch-map-text-property beg (point) 'rear-nonsticky > -(lambda (v) (pushnew :notmuch-part v) > +(lambda (v) (if (listp v) > +(pushnew :notmuch-part v) > + v) > > (defun notmuch-show-insert-body (msg body depth) >"Insert the body BODY at depth DEPTH in the current thread." > -- > 1.7.10.4
[PATCH] news: Be louder about s/v/o on part buttons going away
Austin Clements writes: > This change is likely to affect most people, so put this information > right in the news header and be more explicit about it in the news > detail. > --- > NEWS | 19 ++- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/NEWS b/NEWS > index 6f09cdb..0c0cf82 100644 > --- a/NEWS > +++ b/NEWS > @@ -66,15 +66,16 @@ notmuch-vim, but of course that is their decision. > Emacs Interface > --- > > -New keymap to view/save parts > - > - To view or save a single MIME part of a message, use the new "." > - submap (e.g., ". s" to save, ". v" to view). Previously, these keys > - were only available when point was on a part button and they did not > - have the "." prefix, so they were difficult to invoke (impossible if > - a part did not have a button) and clashed with other bindings. > - These new bindings also appear in show's help, so you don't have to > - memorize them. > +New keymap to view/save parts; removed s/v/o part button bindings > + > + The commands to view, save, and open MIME parts are now prefixed > + with "." (". s" to save, ". v" to view, etc) and can be invoked with > + point anywhere in a part, unlike the old commands, which were > + restricted to part buttons. The old "s"/"v"/"o" commands on part > + buttons have been removed since they clashed with other bindings > + (notably "s" for search!) and could not be invoked when there was no > + part button. The new, prefixed bindings appear in show's help, so > + you no longer have to memorize them. Looks good to me but probably worth adding the | key for piping a part? Best wishes Mark > > Default part save directory is now `mm-default-directory` > > -- > 1.7.10.4 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[RFC PATCH] emacs: Remove v command
I like the change. +1 from me. Mark Austin Clements writes: > This removes the v command, since we now have much nicer part commands, > and deprecates the underlying notmuch-show-view-all-mime-parts. This > also means that people who try using the old unprefixed 'v' command on > a part button will no longer be greeted by ALL of their parts popping > up. > --- > emacs/notmuch-show.el |4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 5771950..bae3171 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -213,6 +213,9 @@ For example, if you wanted to remove an \"unread\" tag > and add a >"Enable Visual Line mode." >(visual-line-mode t)) > > +;; DEPRECATED in Notmuch 0.16 since we now have convenient part > +;; commands. We'll keep the command around for a version or two in > +;; case people want to bind it themselves. > (defun notmuch-show-view-all-mime-parts () >"Use external viewers to view all attachments from the current message." >(interactive) > @@ -1216,7 +1219,6 @@ reset based on the original query." > (define-key map "|" 'notmuch-show-pipe-message) > (define-key map "w" 'notmuch-show-save-attachments) > (define-key map "V" 'notmuch-show-view-raw-message) > - (define-key map "v" 'notmuch-show-view-all-mime-parts) > (define-key map "c" 'notmuch-show-stash-map) > (define-key map "=" 'notmuch-show-refresh-view) > (define-key map "h" 'notmuch-show-toggle-visibility-headers) > -- > 1.7.10.4 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
New notmuch vim plugin pushed to master
On Mon, 03 Jun 2013, Felipe Contreras wrote: > The old plugin has been deprecated and moving to contrib. The new > plugin has much better support and should replace it for all intents > and purposes. Felipe, even though I don't personally use it, I'm glad you're working on the vim plugin. The old one was neglected for too long. > I've pushed the changes and hopefully the packages will be updated > accordingly. I don't think I saw the patches on the list, though. I am not sure if one could have expected much in terms of review, but at least giving people the *chance* for review and discussion about changes of this scale would have been fair. BR, Jani.
[PATCH v2] news: Be louder about s/v/o/| on part buttons going away
This change is likely to affect most people, so put this information right in the news header and be more explicit about it in the news detail. --- As Mark pointed out, I forgot to mention the | part command. NEWS | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 6f09cdb..5f0e15f 100644 --- a/NEWS +++ b/NEWS @@ -66,15 +66,16 @@ notmuch-vim, but of course that is their decision. Emacs Interface --- -New keymap to view/save parts - - To view or save a single MIME part of a message, use the new "." - submap (e.g., ". s" to save, ". v" to view). Previously, these keys - were only available when point was on a part button and they did not - have the "." prefix, so they were difficult to invoke (impossible if - a part did not have a button) and clashed with other bindings. - These new bindings also appear in show's help, so you don't have to - memorize them. +New keymap to view/save parts; removed s/v/o/| part button bindings + + The commands to view, save, and open MIME parts are now prefixed + with "." (". s" to save, ". v" to view, etc) and can be invoked with + point anywhere in a part, unlike the old commands, which were + restricted to part buttons. The old "s"/"v"/"o"/"|" commands on + part buttons have been removed since they clashed with other + bindings (notably "s" for search!) and could not be invoked when + there was no part button. The new, prefixed bindings appear in + show's help, so you no longer have to memorize them. Default part save directory is now `mm-default-directory` -- 1.7.10.4
[RFC PATCH] emacs: Remove v command
This removes the v command, since we now have much nicer part commands, and deprecates the underlying notmuch-show-view-all-mime-parts. This also means that people who try using the old unprefixed 'v' command on a part button will no longer be greeted by ALL of their parts popping up. --- emacs/notmuch-show.el |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 5771950..bae3171 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -213,6 +213,9 @@ For example, if you wanted to remove an \"unread\" tag and add a "Enable Visual Line mode." (visual-line-mode t)) +;; DEPRECATED in Notmuch 0.16 since we now have convenient part +;; commands. We'll keep the command around for a version or two in +;; case people want to bind it themselves. (defun notmuch-show-view-all-mime-parts () "Use external viewers to view all attachments from the current message." (interactive) @@ -1216,7 +1219,6 @@ reset based on the original query." (define-key map "|" 'notmuch-show-pipe-message) (define-key map "w" 'notmuch-show-save-attachments) (define-key map "V" 'notmuch-show-view-raw-message) - (define-key map "v" 'notmuch-show-view-all-mime-parts) (define-key map "c" 'notmuch-show-stash-map) (define-key map "=" 'notmuch-show-refresh-view) (define-key map "h" 'notmuch-show-toggle-visibility-headers) -- 1.7.10.4
[RFC PATCH 1/2] news: Be louder about s/v/o on part buttons going away
Please ignore this semi-duplicate message. I screwed up my git send-email invocation. Quoth myself on Jun 03 at 11:52 am: > This change is likely to affect most people, so put this information > right in the news header and be more explicit about it in the news > detail.
[RFC PATCH 1/2] news: Be louder about s/v/o on part buttons going away
This change is likely to affect most people, so put this information right in the news header and be more explicit about it in the news detail. --- NEWS | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 6f09cdb..0c0cf82 100644 --- a/NEWS +++ b/NEWS @@ -66,15 +66,16 @@ notmuch-vim, but of course that is their decision. Emacs Interface --- -New keymap to view/save parts - - To view or save a single MIME part of a message, use the new "." - submap (e.g., ". s" to save, ". v" to view). Previously, these keys - were only available when point was on a part button and they did not - have the "." prefix, so they were difficult to invoke (impossible if - a part did not have a button) and clashed with other bindings. - These new bindings also appear in show's help, so you don't have to - memorize them. +New keymap to view/save parts; removed s/v/o part button bindings + + The commands to view, save, and open MIME parts are now prefixed + with "." (". s" to save, ". v" to view, etc) and can be invoked with + point anywhere in a part, unlike the old commands, which were + restricted to part buttons. The old "s"/"v"/"o" commands on part + buttons have been removed since they clashed with other bindings + (notably "s" for search!) and could not be invoked when there was no + part button. The new, prefixed bindings appear in show's help, so + you no longer have to memorize them. Default part save directory is now `mm-default-directory` -- 1.7.10.4
[PATCH] news: Be louder about s/v/o on part buttons going away
This change is likely to affect most people, so put this information right in the news header and be more explicit about it in the news detail. --- NEWS | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 6f09cdb..0c0cf82 100644 --- a/NEWS +++ b/NEWS @@ -66,15 +66,16 @@ notmuch-vim, but of course that is their decision. Emacs Interface --- -New keymap to view/save parts - - To view or save a single MIME part of a message, use the new "." - submap (e.g., ". s" to save, ". v" to view). Previously, these keys - were only available when point was on a part button and they did not - have the "." prefix, so they were difficult to invoke (impossible if - a part did not have a button) and clashed with other bindings. - These new bindings also appear in show's help, so you don't have to - memorize them. +New keymap to view/save parts; removed s/v/o part button bindings + + The commands to view, save, and open MIME parts are now prefixed + with "." (". s" to save, ". v" to view, etc) and can be invoked with + point anywhere in a part, unlike the old commands, which were + restricted to part buttons. The old "s"/"v"/"o" commands on part + buttons have been removed since they clashed with other bindings + (notably "s" for search!) and could not be invoked when there was no + part button. The new, prefixed bindings appear in show's help, so + you no longer have to memorize them. Default part save directory is now `mm-default-directory` -- 1.7.10.4
[PATCH] emacs: Fix applying stickiness to the :notmuch-part property
Previously, we simply called pushnew to add :notmuch-part to the front-sticky and rear-nonsticky text property lists. This works if these are nil or lists, but they can also have the value t, meaning that all properties are front-sticky/rear-nonsticky. In this case, pushnew will signal an error because t is not a list. We never set these properties to t ourselves, but since we apply these property changes over arbitrary renderer output, we have to deal with this possibility. --- emacs/notmuch-show.el | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 5771950..83bb9ad 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part." (notmuch-map-text-property beg (point) :notmuch-part (lambda (v) (or v part))) ;; Make :notmuch-part front sticky and rear non-sticky so it stays -;; applied to the beginning of each line when we indent the message. +;; applied to the beginning of each line when we indent the +;; message. Since we're operating on arbitrary renderer output, +;; watch out for sticky specs of t, which means all properties are +;; front-sticky/rear-nonsticky. (notmuch-map-text-property beg (point) 'front-sticky - (lambda (v) (pushnew :notmuch-part v))) + (lambda (v) (if (listp v) + (pushnew :notmuch-part v) +v))) (notmuch-map-text-property beg (point) 'rear-nonsticky - (lambda (v) (pushnew :notmuch-part v) + (lambda (v) (if (listp v) + (pushnew :notmuch-part v) +v) (defun notmuch-show-insert-body (msg body depth) "Insert the body BODY at depth DEPTH in the current thread." -- 1.7.10.4
[RFC PATCH] emacs: search: allow command line args as part of query
This allows command line arguments for notmuch-search to be part of the query-string. The string must be of the form [:blank:]*--cli-arguments -- query. I hope this doesn't clash with xapian: I believe that queries shouldn't start with a "-". Correctly parsed example queries are --sort=oldest-first -- tag:inbox --exclude=false -- from:fred Some options (currently only sort-order) we parse in emacs, the rest we just pass to the cli. In light testing it seems to work. A full custom parser would be nicer but at least here we are only parsing the non-query part of a string which is relatively simple: indeed we already do that in the c code. We could just implement the option for sort-order, but I thought for interface consistency making all the options (sort-order exclude limit and offset) work was worth the small extra hassle. --- This is an attempt to achieve the same as id:1349209083-7170-1-git-send-email-jani at nikula.org : that is allow a saved search to specify the query sort order. However, this is a rather more complete solution (note as this might be viewed a hack minimal may be *better* than complete): it works for any search (saved or from "s") and lets other options (exclude etc) work. What do people think? Best wishes Mark emacs/notmuch.el | 31 ++- 1 files changed, 26 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 7994d74..26ba7e7 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -255,6 +255,7 @@ For a mouse binding, return nil." (notmuch-common-do-stash (notmuch-search-find-thread-id))) (defvar notmuch-search-query-string) +(defvar notmuch-search-full-query) (defvar notmuch-search-target-thread) (defvar notmuch-search-target-line) (defvar notmuch-search-continuation) @@ -409,6 +410,7 @@ Complete list of currently available key bindings: (interactive) (kill-all-local-variables) (make-local-variable 'notmuch-search-query-string) + (make-local-variable 'notmuch-search-full-query) (make-local-variable 'notmuch-search-oldest-first) (make-local-variable 'notmuch-search-target-thread) (make-local-variable 'notmuch-search-target-line) @@ -896,6 +898,26 @@ PROMPT is the string to prompt with." (read-from-minibuffer prompt nil keymap nil 'notmuch-search-history nil nil) +(defun notmuch-search-parse-query (query oldest-first) + (setq notmuch-search-oldest-first oldest-first) + (if (string-match "^[:blank:]*--.*? -- " query) + (let ((actual-query (substring query (match-end 0))) + (args (split-string (match-string 0 query) " " t))) + (setq notmuch-search-query-string actual-query) + (dolist (arg args nil) + (when (equal arg "--sort=oldest-first") + (setq notmuch-search-oldest-first t) + (message "oldest first found")) + (when (equal arg "--sort=newest-first") + (setq notmuch-search-oldest-first nil) + (message "newest first found"))) + (setq args (delete "--sort=oldest-first" args)) + (setq args (delete "--sort=newest-first" args)) + (setq notmuch-search-full-query (append args (list actual-query +;; no special arguments +(setq notmuch-search-full-query (list query)) +(setq notmuch-search-query-string query))) + ;;;###autoload (defun notmuch-search ( query oldest-first target-thread target-line continuation) "Run \"notmuch search\" with the given `query' and display results. @@ -915,8 +937,7 @@ Other optional parameters are used as follows: (notmuch-search-mode) ;; Don't track undo information for this buffer (set 'buffer-undo-list t) -(set 'notmuch-search-query-string query) -(set 'notmuch-search-oldest-first oldest-first) +(notmuch-search-parse-query query oldest-first) (set 'notmuch-search-target-thread target-thread) (set 'notmuch-search-target-line target-line) (set 'notmuch-search-continuation continuation) @@ -928,13 +949,13 @@ Other optional parameters are used as follows: (erase-buffer) (goto-char (point-min)) (save-excursion - (let ((proc (notmuch-start-notmuch + (let ((proc (apply #'notmuch-start-notmuch "notmuch-search" buffer #'notmuch-search-process-sentinel "search" "--format=sexp" "--format-version=1" -(if oldest-first +(if notmuch-search-oldest-first "--sort=oldest-first" "--sort=newest-first") -query)) +notmuch-search-full-query)) ;; Use a scratch buffer to accumulate partial output. ;; This buffer will be killed by the sentinel, which ;; should be called no matter how the process dies. -- 1.7.9.1
[RFC PATCH] revert: Removed top level --stderr= option
On Fri, 31 May 2013, Tomi Ollila wrote: > While looked good on paper, its attempted use caused confusion, complexity, > and potential for information leak when passed through wrapper scripts. > For slimmer code and to lessen demand for maintenance/support the set of > commits which added top level --stderr= option is now reverted. > --- > > Change was easy, commit message hard. Opinions? Revert is easiest to do now. > Also, if someone comes with a novel idea how to utilize --stderr option > please tell it now -- I'd be most eager to hear it :D > > > This change was done the following way: > > $ git checkout -b rvrt b9020448bd > $ git reset --hard HEAD > $ git reset b9020448bd > $ git commit -a > $ git diff HEAD~5..HEAD Protip ;) $ git revert -n b9020448bd..b9020448bd $ git commit BR, Jani. > > (last one to reveal HEAD~5 & HEAD have identical trees). > > Question why: > id:20130521195549.6550.53636 at thinkbox.jade-hamburg.de > > Good reason why not: > id:1369934016-22308-1-git-send-email-amdragon at mit.edu > > > NEWS | 5 - > man/man1/notmuch.1 | 7 --- > notmuch-client.h | 1 - > notmuch.c | 32 > test/help-test | 9 - > 5 files changed, 54 deletions(-) > > diff --git a/NEWS b/NEWS > index 80abd97..a7f2ec6 100644 > --- a/NEWS > +++ b/NEWS > @@ -35,11 +35,6 @@ Top level option to specify configuration file >It's now possible to specify the configuration file to use on the >command line using the `notmuch --config=FILE` option. > > -Top level option to redirect writes to stderr > - > - With `notmuch --stderr=FILE` all writes to stderr are redirected to > - the specified file. If FILE is '-', stderr is redirected to stdout. > - > Deprecated commands "part" and "search-tags" are removed. > > Bash command-line completion > diff --git a/man/man1/notmuch.1 b/man/man1/notmuch.1 > index f5ca0ad..033cc10 100644 > --- a/man/man1/notmuch.1 > +++ b/man/man1/notmuch.1 > @@ -76,14 +76,7 @@ Print the installed version of notmuch, and exit. > > Specify the configuration file to use. This overrides any > configuration file specified by ${NOTMUCH_CONFIG}. > -.RE > - > -.RS 4 > -.TP 4 > -.B \-\-stderr=FILE > > -Redirect all writes to stderr to the specified file. > -If FILE is '-', stderr is redirected to stdout. > .RE > > .SH COMMANDS > diff --git a/notmuch-client.h b/notmuch-client.h > index 4a3c7ac..45749a6 100644 > --- a/notmuch-client.h > +++ b/notmuch-client.h > @@ -54,7 +54,6 @@ typedef GMimeCipherContext notmuch_crypto_context_t; > #include > #include > #include > -#include > #include > #include > #include > diff --git a/notmuch.c b/notmuch.c > index 15e90c8..f51a84f 100644 > --- a/notmuch.c > +++ b/notmuch.c > @@ -251,32 +251,6 @@ notmuch_command (notmuch_config_t *config, > return 0; > } > > -static int > -redirect_stderr (const char * stderr_file) > -{ > -if (strcmp (stderr_file, "-") == 0) { > - if (dup2 (STDOUT_FILENO, STDERR_FILENO) < 0) { > - perror ("dup2"); > - return 1; > - } > -} else { > - int fd = open (stderr_file, O_WRONLY|O_CREAT|O_TRUNC, 0666); > - if (fd < 0) { > - fprintf (stderr, "Error: Cannot redirect stderr to '%s': %s\n", > - stderr_file, strerror (errno)); > - return 1; > - } > - if (fd != STDERR_FILENO) { > - if (dup2 (fd, STDERR_FILENO) < 0) { > - perror ("dup2"); > - return 1; > - } > - close (fd); > - } > -} > -return 0; > -} > - > int > main (int argc, char *argv[]) > { > @@ -285,7 +259,6 @@ main (int argc, char *argv[]) > const char *command_name = NULL; > command_t *command; > char *config_file_name = NULL; > -char *stderr_file = NULL; > notmuch_config_t *config; > notmuch_bool_t print_help=FALSE, print_version=FALSE; > int opt_index; > @@ -295,7 +268,6 @@ main (int argc, char *argv[]) > { NOTMUCH_OPT_BOOLEAN, _help, "help", 'h', 0 }, > { NOTMUCH_OPT_BOOLEAN, _version, "version", 'v', 0 }, > { NOTMUCH_OPT_STRING, _file_name, "config", 'c', 0 }, > - { NOTMUCH_OPT_STRING, _file, "stderr", '\0', 0 }, > { 0, 0, 0, 0, 0 } > }; > > @@ -315,10 +287,6 @@ main (int argc, char *argv[]) > return 1; > } > > -if (stderr_file && redirect_stderr (stderr_file) != 0) { > - /* error already printed */ > - return 1; > -} > if (print_help) > return notmuch_help_command (NULL, argc - 1, [1]); > > diff --git a/test/help-test b/test/help-test > index bd0111c..f7df725 100755 > --- a/test/help-test > +++ b/test/help-test > @@ -9,13 +9,4 @@ test_expect_success 'notmuch help' 'notmuch help' > test_expect_success 'notmuch help tag' 'notmuch help tag' > test_expect_success 'notmuch --version' 'notmuch --version' > > -test_begin_subtest "notmuch --stderr=stderr help %" > -notmuch --stderr=stderr help % >
[PATCH 3/4] bindings/go: ignore downloaded source from github.com
Justus Winter <4winter at informatik.uni-hamburg.de> writes: > Quoting david at tethera.net (2013-06-02 15:39:46) >> From: David Bremner >> >> Start a .gitignore for go bindings. >> --- >> bindings/go/.gitignore | 1 + >> 1 file changed, 1 insertion(+) >> create mode 100644 bindings/go/.gitignore >> >> diff --git a/bindings/go/.gitignore b/bindings/go/.gitignore >> new file mode 100644 >> index 000..a2670c1 >> --- /dev/null >> +++ b/bindings/go/.gitignore >> @@ -0,0 +1 @@ >> +src/github.com/ > > This looks fine too, but you might want to add bin/ and pkg/ while you > are at it. > Done, and the remaining 2 patches pushed. d
[PATCH] debian: build notmuch-vim again
Felipe Contreras writes: > Signed-off-by: Felipe Contreras > --- > debian/control | 15 +++ > 1 file changed, 15 insertions(+) > Build fails with: , | cp: cannot stat `debian/tmp/vim/plugin/notmuch.vim': No such file or directory | dh_install: cp -a debian/tmp/vim/plugin/notmuch.vim debian/notmuch-vim/usr/share/vim/addons/plugin/ returned exit code 1 | make: *** [binary] Error 2 | dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2 | debuild: fatal error at line 1357: ` b.t.w, do you know if an extra ruby-ish dependency is needed for the binary package now? d
[RFC PATCH] emacs: search: allow command line args as part of query
This allows command line arguments for notmuch-search to be part of the query-string. The string must be of the form [:blank:]*--cli-arguments -- query. I hope this doesn't clash with xapian: I believe that queries shouldn't start with a -. Correctly parsed example queries are --sort=oldest-first -- tag:inbox --exclude=false -- from:fred Some options (currently only sort-order) we parse in emacs, the rest we just pass to the cli. In light testing it seems to work. A full custom parser would be nicer but at least here we are only parsing the non-query part of a string which is relatively simple: indeed we already do that in the c code. We could just implement the option for sort-order, but I thought for interface consistency making all the options (sort-order exclude limit and offset) work was worth the small extra hassle. --- This is an attempt to achieve the same as id:1349209083-7170-1-git-send-email-j...@nikula.org : that is allow a saved search to specify the query sort order. However, this is a rather more complete solution (note as this might be viewed a hack minimal may be *better* than complete): it works for any search (saved or from s) and lets other options (exclude etc) work. What do people think? Best wishes Mark emacs/notmuch.el | 31 ++- 1 files changed, 26 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 7994d74..26ba7e7 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -255,6 +255,7 @@ For a mouse binding, return nil. (notmuch-common-do-stash (notmuch-search-find-thread-id))) (defvar notmuch-search-query-string) +(defvar notmuch-search-full-query) (defvar notmuch-search-target-thread) (defvar notmuch-search-target-line) (defvar notmuch-search-continuation) @@ -409,6 +410,7 @@ Complete list of currently available key bindings: (interactive) (kill-all-local-variables) (make-local-variable 'notmuch-search-query-string) + (make-local-variable 'notmuch-search-full-query) (make-local-variable 'notmuch-search-oldest-first) (make-local-variable 'notmuch-search-target-thread) (make-local-variable 'notmuch-search-target-line) @@ -896,6 +898,26 @@ PROMPT is the string to prompt with. (read-from-minibuffer prompt nil keymap nil 'notmuch-search-history nil nil) +(defun notmuch-search-parse-query (query oldest-first) + (setq notmuch-search-oldest-first oldest-first) + (if (string-match ^[:blank:]*--.*? -- query) + (let ((actual-query (substring query (match-end 0))) + (args (split-string (match-string 0 query) t))) + (setq notmuch-search-query-string actual-query) + (dolist (arg args nil) + (when (equal arg --sort=oldest-first) + (setq notmuch-search-oldest-first t) + (message oldest first found)) + (when (equal arg --sort=newest-first) + (setq notmuch-search-oldest-first nil) + (message newest first found))) + (setq args (delete --sort=oldest-first args)) + (setq args (delete --sort=newest-first args)) + (setq notmuch-search-full-query (append args (list actual-query +;; no special arguments +(setq notmuch-search-full-query (list query)) +(setq notmuch-search-query-string query))) + ;;;###autoload (defun notmuch-search (optional query oldest-first target-thread target-line continuation) Run \notmuch search\ with the given `query' and display results. @@ -915,8 +937,7 @@ Other optional parameters are used as follows: (notmuch-search-mode) ;; Don't track undo information for this buffer (set 'buffer-undo-list t) -(set 'notmuch-search-query-string query) -(set 'notmuch-search-oldest-first oldest-first) +(notmuch-search-parse-query query oldest-first) (set 'notmuch-search-target-thread target-thread) (set 'notmuch-search-target-line target-line) (set 'notmuch-search-continuation continuation) @@ -928,13 +949,13 @@ Other optional parameters are used as follows: (erase-buffer) (goto-char (point-min)) (save-excursion - (let ((proc (notmuch-start-notmuch + (let ((proc (apply #'notmuch-start-notmuch notmuch-search buffer #'notmuch-search-process-sentinel search --format=sexp --format-version=1 -(if oldest-first +(if notmuch-search-oldest-first --sort=oldest-first --sort=newest-first) -query)) +notmuch-search-full-query)) ;; Use a scratch buffer to accumulate partial output. ;; This buffer will be killed by the sentinel, which ;; should be called no matter how the process dies. -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH 3/4] bindings/go: ignore downloaded source from github.com
Justus Winter 4win...@informatik.uni-hamburg.de writes: Quoting da...@tethera.net (2013-06-02 15:39:46) From: David Bremner brem...@debian.org Start a .gitignore for go bindings. --- bindings/go/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 bindings/go/.gitignore diff --git a/bindings/go/.gitignore b/bindings/go/.gitignore new file mode 100644 index 000..a2670c1 --- /dev/null +++ b/bindings/go/.gitignore @@ -0,0 +1 @@ +src/github.com/ This looks fine too, but you might want to add bin/ and pkg/ while you are at it. Done, and the remaining 2 patches pushed. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] emacs: Fix applying stickiness to the :notmuch-part property
Previously, we simply called pushnew to add :notmuch-part to the front-sticky and rear-nonsticky text property lists. This works if these are nil or lists, but they can also have the value t, meaning that all properties are front-sticky/rear-nonsticky. In this case, pushnew will signal an error because t is not a list. We never set these properties to t ourselves, but since we apply these property changes over arbitrary renderer output, we have to deal with this possibility. --- emacs/notmuch-show.el | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 5771950..83bb9ad 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part. (notmuch-map-text-property beg (point) :notmuch-part (lambda (v) (or v part))) ;; Make :notmuch-part front sticky and rear non-sticky so it stays -;; applied to the beginning of each line when we indent the message. +;; applied to the beginning of each line when we indent the +;; message. Since we're operating on arbitrary renderer output, +;; watch out for sticky specs of t, which means all properties are +;; front-sticky/rear-nonsticky. (notmuch-map-text-property beg (point) 'front-sticky - (lambda (v) (pushnew :notmuch-part v))) + (lambda (v) (if (listp v) + (pushnew :notmuch-part v) +v))) (notmuch-map-text-property beg (point) 'rear-nonsticky - (lambda (v) (pushnew :notmuch-part v) + (lambda (v) (if (listp v) + (pushnew :notmuch-part v) +v) (defun notmuch-show-insert-body (msg body depth) Insert the body BODY at depth DEPTH in the current thread. -- 1.7.10.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] news: Be louder about s/v/o on part buttons going away
This change is likely to affect most people, so put this information right in the news header and be more explicit about it in the news detail. --- NEWS | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 6f09cdb..0c0cf82 100644 --- a/NEWS +++ b/NEWS @@ -66,15 +66,16 @@ notmuch-vim, but of course that is their decision. Emacs Interface --- -New keymap to view/save parts - - To view or save a single MIME part of a message, use the new . - submap (e.g., . s to save, . v to view). Previously, these keys - were only available when point was on a part button and they did not - have the . prefix, so they were difficult to invoke (impossible if - a part did not have a button) and clashed with other bindings. - These new bindings also appear in show's help, so you don't have to - memorize them. +New keymap to view/save parts; removed s/v/o part button bindings + + The commands to view, save, and open MIME parts are now prefixed + with . (. s to save, . v to view, etc) and can be invoked with + point anywhere in a part, unlike the old commands, which were + restricted to part buttons. The old s/v/o commands on part + buttons have been removed since they clashed with other bindings + (notably s for search!) and could not be invoked when there was no + part button. The new, prefixed bindings appear in show's help, so + you no longer have to memorize them. Default part save directory is now `mm-default-directory` -- 1.7.10.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [RFC PATCH 1/2] news: Be louder about s/v/o on part buttons going away
Please ignore this semi-duplicate message. I screwed up my git send-email invocation. Quoth myself on Jun 03 at 11:52 am: This change is likely to affect most people, so put this information right in the news header and be more explicit about it in the news detail. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [RFC PATCH] emacs: Remove v command
I like the change. +1 from me. Mark Austin Clements amdra...@mit.edu writes: This removes the v command, since we now have much nicer part commands, and deprecates the underlying notmuch-show-view-all-mime-parts. This also means that people who try using the old unprefixed 'v' command on a part button will no longer be greeted by ALL of their parts popping up. --- emacs/notmuch-show.el |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 5771950..bae3171 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -213,6 +213,9 @@ For example, if you wanted to remove an \unread\ tag and add a Enable Visual Line mode. (visual-line-mode t)) +;; DEPRECATED in Notmuch 0.16 since we now have convenient part +;; commands. We'll keep the command around for a version or two in +;; case people want to bind it themselves. (defun notmuch-show-view-all-mime-parts () Use external viewers to view all attachments from the current message. (interactive) @@ -1216,7 +1219,6 @@ reset based on the original query. (define-key map | 'notmuch-show-pipe-message) (define-key map w 'notmuch-show-save-attachments) (define-key map V 'notmuch-show-view-raw-message) - (define-key map v 'notmuch-show-view-all-mime-parts) (define-key map c 'notmuch-show-stash-map) (define-key map = 'notmuch-show-refresh-view) (define-key map h 'notmuch-show-toggle-visibility-headers) -- 1.7.10.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
Re: [PATCH] news: Be louder about s/v/o on part buttons going away
Austin Clements amdra...@mit.edu writes: This change is likely to affect most people, so put this information right in the news header and be more explicit about it in the news detail. --- NEWS | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 6f09cdb..0c0cf82 100644 --- a/NEWS +++ b/NEWS @@ -66,15 +66,16 @@ notmuch-vim, but of course that is their decision. Emacs Interface --- -New keymap to view/save parts - - To view or save a single MIME part of a message, use the new . - submap (e.g., . s to save, . v to view). Previously, these keys - were only available when point was on a part button and they did not - have the . prefix, so they were difficult to invoke (impossible if - a part did not have a button) and clashed with other bindings. - These new bindings also appear in show's help, so you don't have to - memorize them. +New keymap to view/save parts; removed s/v/o part button bindings + + The commands to view, save, and open MIME parts are now prefixed + with . (. s to save, . v to view, etc) and can be invoked with + point anywhere in a part, unlike the old commands, which were + restricted to part buttons. The old s/v/o commands on part + buttons have been removed since they clashed with other bindings + (notably s for search!) and could not be invoked when there was no + part button. The new, prefixed bindings appear in show's help, so + you no longer have to memorize them. Looks good to me but probably worth adding the | key for piping a part? Best wishes Mark Default part save directory is now `mm-default-directory` -- 1.7.10.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
Re: [PATCH] emacs: Fix applying stickiness to the :notmuch-part property
LGTM +1. This fixes the test failures (and errors in the emacs display) I was seeing on one of my systems. Best wishes Mark Austin Clements amdra...@mit.edu writes: Previously, we simply called pushnew to add :notmuch-part to the front-sticky and rear-nonsticky text property lists. This works if these are nil or lists, but they can also have the value t, meaning that all properties are front-sticky/rear-nonsticky. In this case, pushnew will signal an error because t is not a list. We never set these properties to t ourselves, but since we apply these property changes over arbitrary renderer output, we have to deal with this possibility. --- emacs/notmuch-show.el | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 5771950..83bb9ad 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part. (notmuch-map-text-property beg (point) :notmuch-part (lambda (v) (or v part))) ;; Make :notmuch-part front sticky and rear non-sticky so it stays -;; applied to the beginning of each line when we indent the message. +;; applied to the beginning of each line when we indent the +;; message. Since we're operating on arbitrary renderer output, +;; watch out for sticky specs of t, which means all properties are +;; front-sticky/rear-nonsticky. (notmuch-map-text-property beg (point) 'front-sticky -(lambda (v) (pushnew :notmuch-part v))) +(lambda (v) (if (listp v) +(pushnew :notmuch-part v) + v))) (notmuch-map-text-property beg (point) 'rear-nonsticky -(lambda (v) (pushnew :notmuch-part v) +(lambda (v) (if (listp v) +(pushnew :notmuch-part v) + v) (defun notmuch-show-insert-body (msg body depth) Insert the body BODY at depth DEPTH in the current thread. -- 1.7.10.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2] news: Be louder about s/v/o/| on part buttons going away
This change is likely to affect most people, so put this information right in the news header and be more explicit about it in the news detail. --- As Mark pointed out, I forgot to mention the | part command. NEWS | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 6f09cdb..5f0e15f 100644 --- a/NEWS +++ b/NEWS @@ -66,15 +66,16 @@ notmuch-vim, but of course that is their decision. Emacs Interface --- -New keymap to view/save parts - - To view or save a single MIME part of a message, use the new . - submap (e.g., . s to save, . v to view). Previously, these keys - were only available when point was on a part button and they did not - have the . prefix, so they were difficult to invoke (impossible if - a part did not have a button) and clashed with other bindings. - These new bindings also appear in show's help, so you don't have to - memorize them. +New keymap to view/save parts; removed s/v/o/| part button bindings + + The commands to view, save, and open MIME parts are now prefixed + with . (. s to save, . v to view, etc) and can be invoked with + point anywhere in a part, unlike the old commands, which were + restricted to part buttons. The old s/v/o/| commands on + part buttons have been removed since they clashed with other + bindings (notably s for search!) and could not be invoked when + there was no part button. The new, prefixed bindings appear in + show's help, so you no longer have to memorize them. Default part save directory is now `mm-default-directory` -- 1.7.10.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] emacs: Fix applying stickiness to the :notmuch-part property
On Mon, Jun 03 2013, Austin Clements amdra...@mit.edu wrote: Previously, we simply called pushnew to add :notmuch-part to the front-sticky and rear-nonsticky text property lists. This works if these are nil or lists, but they can also have the value t, meaning that all properties are front-sticky/rear-nonsticky. In this case, pushnew will signal an error because t is not a list. We never set these properties to t ourselves, but since we apply these property changes over arbitrary renderer output, we have to deal with this possibility. --- LGTM (took a while to understand :D). Tomi emacs/notmuch-show.el | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 5771950..83bb9ad 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part. (notmuch-map-text-property beg (point) :notmuch-part (lambda (v) (or v part))) ;; Make :notmuch-part front sticky and rear non-sticky so it stays -;; applied to the beginning of each line when we indent the message. +;; applied to the beginning of each line when we indent the +;; message. Since we're operating on arbitrary renderer output, +;; watch out for sticky specs of t, which means all properties are +;; front-sticky/rear-nonsticky. (notmuch-map-text-property beg (point) 'front-sticky -(lambda (v) (pushnew :notmuch-part v))) +(lambda (v) (if (listp v) +(pushnew :notmuch-part v) + v))) (notmuch-map-text-property beg (point) 'rear-nonsticky -(lambda (v) (pushnew :notmuch-part v) +(lambda (v) (if (listp v) +(pushnew :notmuch-part v) + v) (defun notmuch-show-insert-body (msg body depth) Insert the body BODY at depth DEPTH in the current thread. -- 1.7.10.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
Re: [RFC PATCH] emacs: Remove v command
On Mon, Jun 03 2013, Austin Clements amdra...@mit.edu wrote: This removes the v command, since we now have much nicer part commands, and deprecates the underlying notmuch-show-view-all-mime-parts. This also means that people who try using the old unprefixed 'v' command on a part button will no longer be greeted by ALL of their parts popping up. --- +1 Tomi emacs/notmuch-show.el |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 5771950..bae3171 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -213,6 +213,9 @@ For example, if you wanted to remove an \unread\ tag and add a Enable Visual Line mode. (visual-line-mode t)) +;; DEPRECATED in Notmuch 0.16 since we now have convenient part +;; commands. We'll keep the command around for a version or two in +;; case people want to bind it themselves. (defun notmuch-show-view-all-mime-parts () Use external viewers to view all attachments from the current message. (interactive) @@ -1216,7 +1219,6 @@ reset based on the original query. (define-key map | 'notmuch-show-pipe-message) (define-key map w 'notmuch-show-save-attachments) (define-key map V 'notmuch-show-view-raw-message) - (define-key map v 'notmuch-show-view-all-mime-parts) (define-key map c 'notmuch-show-stash-map) (define-key map = 'notmuch-show-refresh-view) (define-key map h 'notmuch-show-toggle-visibility-headers) -- 1.7.10.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] emacs: update search sort order help to match code
--- emacs/notmuch-lib.el |7 ++- emacs/notmuch.el | 13 ++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 28f78e0..c43d5a9 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -68,7 +68,12 @@ :group 'notmuch) (defcustom notmuch-search-oldest-first t - Show the oldest mail first when searching. + Show the oldest mail first when searching. + +This variable defines the default sort order for displaying +search results. Note that any filtered searches created by +`notmuch-search-filter' retain the search order of the parent +search. :type 'boolean :group 'notmuch-search) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 26ba7e7..cc62088 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -1030,17 +1030,8 @@ depending on the value of `notmuch-poll-script'. (defun notmuch-search-toggle-order () Toggle the current search order. -By default, the \inbox\ view created by `notmuch' is displayed -in chronological order (oldest thread at the beginning of the -buffer), while any global searches created by `notmuch-search' -are displayed in reverse-chronological order (newest thread at -the beginning of the buffer). - -This command toggles the sort order for the current search. - -Note that any filtered searches created by -`notmuch-search-filter' retain the search order of the parent -search. +This command toggles the sort order for the current search. The +default sort order is defined by `notmuch-search-oldest-first'. (interactive) (set 'notmuch-search-oldest-first (not notmuch-search-oldest-first)) (notmuch-search-refresh-view)) -- 1.7.10.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2] emacs: search: allow command line args as part of query
This allows command line arguments for notmuch-search to be part of the query-string. The string must be of the form [:blank:]*--cli-arguments -- query. I hope this doesn't clash with xapian: I believe that queries shouldn't start with a -. Correctly parsed example queries are --sort=oldest-first -- tag:inbox --exclude=false -- from:fred Some options (currently only sort-order) we parse in emacs, the rest we just pass to the cli. In light testing it seems to work. A full custom parser would be nicer but at least here we are only parsing the non-query part of a string which is relatively simple: indeed we already do that in the c code. We could just implement the option for sort-order, but I thought for interface consistency making all the options (sort-order exclude limit and offset) work was worth the small extra hassle. --- This is a rather more complete version of the parent patch with a key bugfix (thanks to Jani): saved searches with cli arguments work, refreshing a query works correctly, filtering a query works correctly (and can take extra cli arguments). It may all be too complex, and it may be too hackish but it does seem to work. Best wishes Mark emacs/notmuch-hello.el |5 +++-- emacs/notmuch-lib.el | 23 +++ emacs/notmuch.el | 36 +--- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index c1c6f4b..bcc1843 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -383,10 +383,11 @@ options will be handled as specified for `notmuch-hello-insert-searches'. (with-temp-buffer (dolist (elem query-alist nil) - (let ((count-query (if (consp (cdr elem)) + (let* ((full-count-query (if (consp (cdr elem)) ;; do we have a different query for the message count? (third elem) - (cdr elem + (cdr elem))) +(count-query (car (notmuch-parse-query full-count-query (insert (notmuch-hello-filtered-query count-query (or (plist-get options :filter-count) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 28f78e0..705d4f3 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -189,6 +189,29 @@ user-friendly queries. Return a query that matches the message with id ID. (concat id: (notmuch-escape-boolean-term id))) +(defun notmuch-search-parse-sort-order (args oldest-first) + (dolist (arg args nil) +(when (equal arg --sort=oldest-first) + (setq oldest-first t)) +(when (equal arg --sort=newest-first) + (setq oldest-first nil))) + (setq args (delete --sort=oldest-first args)) + (setq args (delete --sort=newest-first args)) + (cons oldest-first args)) + +(defun notmuch-parse-query (query) + Parse a query into a search and cli arguments + +Returns a list consisting of query followed by the cli-args (as a +list). If the string does not have cli-args then this will be nil. + + (if (string-match ^[[:blank:]]*--.*? -- query) + (let ((actual-query (substring query (match-end 0))) + (args (split-string (match-string 0 query) t))) + (message Parsing query) + (cons actual-query args)) +;; no cli arguments +(list query))) ;; (defun notmuch-common-do-stash (text) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 7994d74..6a4052e 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -255,6 +255,7 @@ For a mouse binding, return nil. (notmuch-common-do-stash (notmuch-search-find-thread-id))) (defvar notmuch-search-query-string) +(defvar notmuch-search-query-args) (defvar notmuch-search-target-thread) (defvar notmuch-search-target-line) (defvar notmuch-search-continuation) @@ -409,6 +410,7 @@ Complete list of currently available key bindings: (interactive) (kill-all-local-variables) (make-local-variable 'notmuch-search-query-string) + (make-local-variable 'notmuch-search-query-args) (make-local-variable 'notmuch-search-oldest-first) (make-local-variable 'notmuch-search-target-thread) (make-local-variable 'notmuch-search-target-line) @@ -897,7 +899,7 @@ PROMPT is the string to prompt with. 'notmuch-search-history nil nil) ;;;###autoload -(defun notmuch-search (optional query oldest-first target-thread target-line continuation) +(defun notmuch-search (optional query oldest-first target-thread target-line continuation cli-args) Run \notmuch search\ with the given `query' and display results. If `query' is nil, it is read interactively from the minibuffer. @@ -909,13 +911,20 @@ Other optional parameters are used as follows: target-line: The line number to move to if the target thread does not appear in the search results. (interactive) - (let* ((query (or query (notmuch-read-query Notmuch search:
[PATCH] contrib: pick: remove reference to inbox in docstring
Copy the recent changes in show to use just notmuch-archive-tags (as a link) rather than saying '(defaults to inbox)'. --- contrib/notmuch-pick/notmuch-pick.el |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el index 10a2bf7..16f8d15 100644 --- a/contrib/notmuch-pick/notmuch-pick.el +++ b/contrib/notmuch-pick/notmuch-pick.el @@ -443,10 +443,9 @@ Does NOT change the database. Archive the current message. Archive the current message by applying the tag changes in -`notmuch-archive-tags' to it (remove the \inbox\ tag by -default). If a prefix argument is given, the message will be -\unarchived\, i.e. the tag changes in `notmuch-archive-tags' -will be reversed. +`notmuch-archive-tags' to it. If a prefix argument is given, the +message will be \unarchived\, i.e. the tag changes in +`notmuch-archive-tags' will be reversed. (interactive P) (when notmuch-archive-tags (apply 'notmuch-pick-tag -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] contrib: pick: remove unnecessary funcall
Remove unnecessary funcall. This keeps the pick function inline with the recently tweaked show function. --- contrib/notmuch-pick/notmuch-pick.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el index 0e66efa..10a2bf7 100644 --- a/contrib/notmuch-pick/notmuch-pick.el +++ b/contrib/notmuch-pick/notmuch-pick.el @@ -282,7 +282,7 @@ Does NOT change the database. (defun notmuch-pick-tag (optional tag-changes) Change tags for the current message (interactive) - (setq tag-changes (funcall 'notmuch-tag (notmuch-pick-get-message-id) tag-changes)) + (setq tag-changes (notmuch-tag (notmuch-pick-get-message-id) tag-changes)) (notmuch-pick-tag-update-display tag-changes)) (defun notmuch-pick-add-tag () -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] emacs: remove hardcoded defaults values from docstrings
I realize this already got pushed, but to me this seems like a reversion for the 95% of users who haven't customized notmuch-archive-tags and just want to know that archiving means removing the inbox tag. Why is this less confusing? Users who have customized notmuch-archive-tags will probably know that the default doesn't apply to them. Quoth da...@tethera.net on Jun 02 at 11:04 am: From: David Bremner brem...@debian.org These functions refer to default values of variables, but it seems less confusing and less likely to get out of date to just allow the user to follow the help cross-reference links. --- emacs/notmuch-show.el | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) another proposed change from our notmuch-pick discussions. diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 613e666..600e802 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1835,10 +1835,9 @@ search results instead. Archive each message in thread. Archive each message currently shown by applying the tag changes -in `notmuch-archive-tags' to each (remove the \inbox\ tag by -default). If a prefix argument is given, the messages will be -\unarchived\, i.e. the tag changes in `notmuch-archive-tags' -will be reversed. +in `notmuch-archive-tags' to each. If a prefix argument is given, +the messages will be \unarchived\, i.e. the tag changes in +`notmuch-archive-tags' will be reversed. Note: This command is safe from any race condition of new messages being delivered to the same thread. It does not archive the @@ -1865,10 +1864,9 @@ buffer. Archive the current message. Archive the current message by applying the tag changes in -`notmuch-archive-tags' to it (remove the \inbox\ tag by -default). If a prefix argument is given, the message will be -\unarchived\, i.e. the tag changes in `notmuch-archive-tags' -will be reversed. +`notmuch-archive-tags' to it. If a prefix argument is given, the +message will be \unarchived\, i.e. the tag changes in +`notmuch-archive-tags' will be reversed. (interactive P) (when notmuch-archive-tags (apply 'notmuch-show-tag-message ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Error when viewing mails.
Sorry; this one's my fault. You should apply id:1370272679-20175-1-git-send-email-amdra...@mit.edu, which is currently sitting the ready queue, but hasn't been pushed to master yet. Quoth Aneesh Kumar K.V on Jun 04 at 10:43 am: I started seeing this with latest notmuch update. Debugger entered--Lisp error: (wrong-type-argument listp t) memql(:notmuch-part t) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 0/6] Make Emacs search use sexp format
On Sun, 02 Jun 2013, Jameson Graef Rollins jroll...@finestructure.net wrote: On Sat, Jun 01 2013, David Bremner da...@tethera.net wrote: Austin Clements amdra...@mit.edu writes: This is v3 of id:1369934016-22308-1-git-send-email-amdra...@mit.edu. This tweaks the shell invocation as suggested by Tomi and fixes two comment typos pointed out by Mark. It also adds a NEWS patch. I'm going to go ahead and mark this ready because of Tomi's and Mark's reviews of v2. The first 5 I pushed. The NEWS patch has a conflict. I'm very happy to see the long-coming sexp handling working here. Good work, folks, particularly to Austin for getting the awesome asynchronous processing stuff working. Searches are now definitely noticeably faster. I am, however, seeing a couple of issues that we might want to address. * Killing a search buffer that is still in the process of being filled causes errors to be thrown. I'm seeing both of the following intermittently: [Sun Jun 2 08:26:40 2013] notmuch exited with status killed command: notmuch search --format\=sexp --format-version\=1 --sort\=newest-first to\:jrollins exit signal: killed [Sun Jun 2 08:32:26 2013] notmuch exited with status hangup command: notmuch search --format\=sexp --format-version\=1 --sort\=newest-first to\:jrollins exit signal: hangup This is somewhat understandable, as the notmuch binary exits with an error if it hasn't finished dumping the output, but given how common this particular scenario is I think we should try to avoid throwing errors in this circumstance. I wonder if we shouldn't just modify the binary to not return non-zero if it was manually killed while processing the output, or at least special-case the particular error caused by manually killing the search. Your assessment is correct, of course. The right place to fix this is in Emacs, not the CLI (the CLI *can't* do anything about this, since it gets killed by a signal). Probably we should do something different in the sentinel if the search process's buffer is no longer live. Clearly we should suppress the status error for the signal, but I think we still should report anything that appeared in err-file because it may be relevant to why the user killed the buffer (e.g., maybe a notmuch wrapper was blocked on something). * The next thing I'm seeing is this: Opening input file: no such file or directory, /home/jrollins/tmp/nmerr5390CAY I'm not exactly sure what causes this error, but it looks to me like the temporary error file was removed before we were finished with it. This one's pretty awesome (and I think is a bug in Emacs). At a high level, the sentinel is getting run twice and since the first call deletes the error file, the second call fails. At a low level, what causes this is fascinating. 1) You kill the search buffer. This invokes kill_buffer_processes, which sends a SIGHUP to notmuch, but doesn't do anything else. Meanwhile, the notmuch search process has printed some more output, but Emacs hasn't consumed it yet (this is critical). 2) Emacs gets a SIGCHLD from the dying notmuch process, which invokes handle_child_signal, which sets the new process status, but can't do anything else because it's a signal handler. 3) Emacs returns to its idle loop, which calls status_notify, which sees that the notmuch process has a new status. This is where things get interesting. 3.1) Emacs guarantees that it will run process filters on any unconsumed output before running the process sentinel, so status_notify calls read_process_output, which consumes the final output and calls notmuch-search-process-filter. 3.1.1) notmuch-search-process-filter contains code to check if the search buffer is still alive and, since it's not, it calls delete-process. 3.1.1.1) delete-process correctly sees that the process is already dead and doesn't try to send another signal, *but* it still modifies the status to killed. To deal with the new status, it calls status_notify. Dun dun dun. We've seen this function before. 3.1.1.1.1) The *recursive* status_notify invocation sees that the process has a new status and doesn't have any more output to consume, so it invokes our sentinel and returns. 3.2) The outer status_notify call (which we're still in) is now done flushing pending process output, so it *also* invokes our sentinel. It might be that the answer is to just remove the delete-process call from the filter. It seems completely redundant (and racy) with Emacs' automatic SIGHUP'ing. * Finally, something happened that caused *12,000* of the following lines to be sent to the *Notmuch errors* buffer: A Xapian exception occurred performing query: The revision being read has been discarded - you should call Xapian::Database::reopen() and retry the operation Again, this was related to killing a search