[PATCH v3 1/4] emacs: Let the user choose where to compose new mails
On Thu, 15 Dec 2011 19:50:36 -0400, David Bremner wrote: > I think the problem is related to emacsclient. > > With 'm' I have the following behaviour: > > emacs -q --daemon > M-x notmuch (to load variable definitions) > M-x customize-variable notmuch-mua-compose-in > (select compose in new window, save for current session) > M-x notmuch > m ;; new window is opened as it should be > C-c C-c ;; frame is closed. I just tried, and I cannot reproduce this behavior. IIUC, here is what happened to you: you set nm-mua-compose-in to 'new-window. You began a new message, this opened a new window as expected. Your emacs frame now has two windows in it. You sent this message, which deleted the window showing it. Your emacs frame was deleted as well, which made the other window, showing notmuch-hello (or some other notmuch buffer, from which you began writing the email message) disappear as well, unexpectedly. Is this a correct description of what happened? Here?s the recipe I used for replicating: emacs -q --daemon emacsclient -c C-x b *scratch* (add-to-list 'load-path "/path/to/notmuch/emacs/") C-j (load-library "notmuch") C-j C-x C-f /path/to/notmuch/emacs/notmuch-mua.el M-x eval-buffer (in order to pick up changes not in byte-compiled file) M-x customize-variable notmuch-mua-compose-in (set to 'new-window, save for session) M-x notmuch m (new window is created in current frame, below the window showing notmuch-hello) (type mail) C-c C-c (enter smtp settings, since emacs doesn?t know them) (new window disappears, the window with notmuch-hello fills whole frame) I also tried with notmuch-mua-compose-in set to 'new-frame, and got the expected behavior (m -> create new frame, C-c C-c -> new frame is deleted) What version of emacs did you have this problem with? The window/frame handling code has undergone several intrusive rewrites post-v.23, each of which fixed some bugs and introduced others. The version I used is a trunk build from Dec. 12-ish. It would be nice to pinpoint which emacs versions/configurations show undesired behavior ? this is a useful patch and it should be included once we can be sure it will work correctly. Thanks, -- Aaron Ecay
[PATCH] emacs: Don't signal an error when reaching the end of the search results.
On Tue, 20 Dec 2011 08:45:14 +, David Edmondson wrote: > With the default configuration ('space' moves through the messages > matching the search and back to the results index at the end) it's > unnecessary to signal an error when the last message has been read, as > this is the common case. > > Moreover, it's very annoying when `debug-on-error' is t. +1 from me on this change. I had added this to `debug-ignored-errors' long ago, and forgotten how annoying it was. -- Aaron Ecay
[RFC][PATCH v4] emacs: Re-implement advance/rewind functions of notmuch-show-mode.
On Sat, 24 Dec 2011 20:06:35 -0500, Austin Clements wrote: > Awesome. This looks significantly cleaner. I think this is worth > pushing for the comment you added to notmuch-show-advance alone. +1 > Quoth David Edmondson on Dec 23 at 6:41 pm: > > The advance/rewind functions had become complex, which made it hard to > > determine how they are expected to behave. Re-implement them simply in > > order to poll user-experience and expectation. > > --- > > > > Switched back to using `previous-single-char-property-change' now that > > Aaron explained it. Fix a bug rewinding when the start of the current > > message is visible. > > > > emacs/notmuch-show.el | 132 > > +++-- > > 1 files changed, 73 insertions(+), 59 deletions(-) > > > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > > index 46525aa..e914ce1 100644 > > --- a/emacs/notmuch-show.el > > +++ b/emacs/notmuch-show.el > > @@ -1156,38 +1156,56 @@ Some useful entries are: > > ;; Commands typically bound to keys. > > > > (defun notmuch-show-advance () > > - "Advance through thread. > > + "Advance through the current thread. > > > > -If the current message in the thread is not yet fully visible, > > -scroll by a near screenful to read more of the message. > > +Scroll the current message if the end of it is not visible, > > +otherwise move to the next message. > > > > -Otherwise, (the end of the current message is already within the > > -current window), advance to the next open message." > > +Return `t' if we are at the end of the last message, otherwise > > +`nil'." > >(interactive) > > - (let* ((end-of-this-message (notmuch-show-message-bottom)) > > -(visible-end-of-this-message (1- end-of-this-message)) > > -(ret nil)) > > -(while (invisible-p visible-end-of-this-message) > > - (setq visible-end-of-this-message > > - (previous-single-char-property-change visible-end-of-this-message > > - 'invisible))) > > -(cond > > - ;; Ideally we would test `end-of-this-message' against the result > > - ;; of `window-end', but that doesn't account for the fact that > > - ;; the end of the message might be hidden. > > - ((and visible-end-of-this-message > > - (> visible-end-of-this-message (window-end))) > > - ;; The bottom of this message is not visible - scroll. > > - (scroll-up nil)) > > - > > - ((not (= end-of-this-message (point-max))) > > - ;; This is not the last message - move to the next visible one. > > - (notmuch-show-next-open-message)) > > - > > - (t > > - ;; This is the last message - change the return value > > - (setq ret t))) > > -ret)) > > + (cond > > + ((eobp) > > +;; We are at the end of the buffer - move to the next thread. > > +t) > > + > > + ;; Ideally we would simply do: > > + ;; > > Tailing whitespace. > > > + ;; ((> (notmuch-show-message-bottom) (window-end)) > > + ;; > > More trailing whitespace. > > > + ;; here, but that fails if the trailing text in the buffer is > > + ;; invisible (`window-end' returns the last _visible_ character, > > + ;; which can then be smaller than `notmuch-show-message-bottom'). > > + ;; > > + ;; So we need to find the last visible character of the message. We > > + ;; do this by searching backwards from > > + ;; `notmuch-show-message-bottom' for changes in the `invisible' > > + ;; property until we find a non-invisible character. When we find > > + ;; such a character we test to see whether it is visible in the > > + ;; window. > > + ;; > > + ;; Properties change between characters - the return value of > > + ;; `previous-single-char-property-change' points to the first > > + ;; character _inside_ the region with the `invisible' property > > + ;; set. To allow for this we step backwards one character upon > > + ;; finding the start of the invisible region. > > + > > + ((> (let ((visible-bottom (notmuch-show-message-bottom))) > > +(while (invisible-p visible-bottom) > > + (setq visible-bottom (max (point-min) > > +(1- (previous-single-char-property-change > > + visible-bottom 'invisible) > > +visible-bottom) (window-end)) Can this (let...) be lifted out of the (cond...)? IMO it is very confusing to be doing non-trivial computation in the test portion of a cond form. > > +;; The end of this message is not visible - scroll to show more of > > +;; it. > > +(scroll-up) > > +nil) > > + > > + (t > > +;; All of the current message has been seen - show the start of > > +;; the next open message. > > +(notmuch-show-next-open-message) > > +nil))) > > > > (defun notmuch-show-advance-and-archive () > >"Advance through thread and archive. > > @@ -1201,44 +1219,40 @@ from each message), kills the buffer, and displays > > the
[PATCH v5 0/4] First step of 'show' rewrite
On Sat, 24 Dec 2011 13:52:42 -0500, Austin Clements wrote: > Rename sig_attempted to verify_attempted. > Pushed. d
[alot] announcing bugfix release v0.21
Good news everyone! I have just tagged the bugfix release version 0.21 of my terminal GUI `alot`. You can get a tarball here: https://github.com/pazz/alot/tarball/0.21 NEWS: * avoid traceback infos from getting written on top of the ui * new "--help" output, autogenerated manpage * version string extracted from git for cli option "--version" * command line subcommands: compose and search * properly display multiple headers with the same key * envelope.set option "--append" * more detailed CUSTOMIZE docs * multiple fixes for the envelope buffer * exit on closing of last buffer is now optional * die gracefully when config parsing fails * random bugfixes in the ui * determine attachments via the "Content-Disposition" header * nicer alignment for messages in thread buffers * deal with external commands as lists of strings instead of strings * better filetype detection in attachments via magic numbers * errbacks and correct calling of post-hooks for deferred commands * add packaging info for debian * envelope.headers stores lists of values for each key now * default binding: 's' to 'toggletag unread' in search buffers The bleeding-edge development version lives in branch 'testing' and is already a few cool features ahead of this release. Check it out from https://github.com/pazz/alot Thanks goes to dtk, teyphoon, mortbauer and murks for fixes and bugreports. Happy holidays, /p
0.11 is frozen, please update NEWS
Well, it's -19C outside, so guess that is appropriate. I have merged master to release in preparation for release. There should only be additions to NEWS or fixes for serious bugs for branch release until 0.11 is out the door. Speaking of NEWS, please have a look at the commits listed under your name, and if they impact user experience, then consider a patch for NEWS. As an experiment, I set up write access to branch "news" of git at pivot.cs.unb.ca:pub/notmuch I used the ssh keys people sent me for nmbug; feel free to send me more (public) keys. The idea is it might be less painful to edit NEWS on that branch. Of course, all the old methods are fine too. Aaron Ecay (3): Ignore dynamic libraries on OS X. Add an argument to notmuch-mua-mail emacs: fix off-by-one bug in notmuch-show-archive Ali Polatel (2): notmuch-deliver: Import from maildrop-2.5.5 notmuch-deliver: GPL-3+ Austin Clements (2): emacs: Don't record undo information for search or show buffers. emacs: Avoid unnecessary markers. David Edmondson (1): emacs: Add `notmuch-jump-to-recent-buffer'. Dmitry Kurochkin (31): emacs: do not call notmuch show for non-inlinable parts emacs: put the last search on top of recent searches in notmuch-hello Gregor Zattler (1): emacs: make message indentation width customisable Ivy Foster (1): emacs: Add notmuch-hello-mode-hook Jameson Graef Rollins (2): emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive emacs: call notmuch-show instead of notmuch-search in buttonised id: links Jani Nikula (8): emacs: Add new customization option to sort saved searches emacs: Make saving new saved searches append, not prepend cli: introduce the concept of user defined hooks cli: add support for pre and post notmuch new hooks emacs: support "notmuch new" as a notmuch-poll-script emacs: Fix notmuch-hello-tag-list-make-query defcustom emacs: Fix notmuch-mua-user-agent defcustom Justus Winter (2): python: add classes to wrap all notmuch_*_t types python: annotate all calls into libnotmuch with types Louis Rilling (2): lib: Kill last usage of C++ type bool tags_to_maildir_flags: Cleanup double assignement Patrick Totzke (3): use __unicode__ for string representation errors='ignore' when decode to unicode fix format string in Message.__unicode__ Sebastian Spaeth (2): python: Return a STATUS value in tags_to_flags and flags_to_tags python: Remove stray debug comment Thomas Jost (6): python: use wrapped notmuch_*_t types instead of raw pointers emacs: Add a face for crypto parts headers Fix build with binutils-2.22 emacs: add notmuch-hello-refresh-hook emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator emacs: Change the default thousands separator to a space Thomas Schwinge (1): dump: Don't sort the output by message id. Tomi Ollila (2): Release memory allocated by internet_address_list_parse_string() notmuch: unref charset_filter to fix one memory leak pazz (2): test: date_relative in notmuch search json output json: date_relative for threads -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20111225/b90e5311/attachment.pgp>
[PATCH 4/4] test: fix Emacs tests expected output after notmuch-hello search changes
--- test/emacs.expected-output/notmuch-hello |6 +++--- .../notmuch-hello-no-saved-searches|6 +++--- .../emacs.expected-output/notmuch-hello-with-empty |6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello index 48143bd..4e47cde 100644 --- a/test/emacs.expected-output/notmuch-hello +++ b/test/emacs.expected-output/notmuch-hello @@ -4,11 +4,11 @@ Saved searches: [edit] 50 inbox 50 unread -Search: +[ Search! ] [Show all tags] -Type a search query and hit RET to view matching threads. +Use the `search' button or hit `s' to enter search query. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. -`=' refreshes this screen. `s' jumps to the search box. `q' to quit. + `=' refreshes this screen. `s' to search messages. `q' to quit. diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches index 7c09e40..5f79b92 100644 --- a/test/emacs.expected-output/notmuch-hello-no-saved-searches +++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches @@ -1,10 +1,10 @@ Welcome to notmuch. You have 50 messages. -Search: +[ Search! ] [Show all tags] -Type a search query and hit RET to view matching threads. +Use the `search' button or hit `s' to enter search query. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. -`=' refreshes this screen. `s' jumps to the search box. `q' to quit. + `=' refreshes this screen. `s' to search messages. `q' to quit. diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty index 2a267c9..28b8a1f 100644 --- a/test/emacs.expected-output/notmuch-hello-with-empty +++ b/test/emacs.expected-output/notmuch-hello-with-empty @@ -4,11 +4,11 @@ Saved searches: [edit] 50 inbox 50 unread 0 empty -Search: +[ Search! ] [Show all tags] -Type a search query and hit RET to view matching threads. +Use the `search' button or hit `s' to enter search query. Edit saved searches with the `edit' button. Hit RET or click on a saved search or tag name to view matching threads. -`=' refreshes this screen. `s' jumps to the search box. `q' to quit. + `=' refreshes this screen. `s' to search messages. `q' to quit. -- 1.7.7.3
[PATCH 3/4] emacs: hide recent searches if `notmuch-hello-recent-searches-max' is zero
--- emacs/notmuch-hello.el | 13 ++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index fa33500..6015af4 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -30,7 +30,10 @@ (declare-function notmuch-poll "notmuch" ()) (defcustom notmuch-hello-recent-searches-max 10 - "The number of recent searches to display." + "The number of recent searches to display. + +Recent searches section is not shown if +`notmuch-hello-recent-searches-max' is set to 0." :type 'integer :group 'notmuch) @@ -151,6 +154,10 @@ International Bureau of Weights and Measures." (defvar notmuch-hello-url "http://notmuchmail.org; "The `notmuch' web site.") +(defun notmuch-hello-show-recent-searches () + (and (> notmuch-hello-recent-searches-max 0) + notmuch-search-history)) + (defun notmuch-hello-nice-number (n) (let (result) (while (> n 0) @@ -482,7 +489,7 @@ Complete list of currently available key bindings: " Search! ") (widget-insert "\n") - (when notmuch-search-history + (when (notmuch-hello-show-recent-searches) (widget-insert "\nRecent searches: ") (widget-create 'push-button :notify (lambda ( ignore) @@ -549,7 +556,7 @@ Complete list of currently available key bindings: (let ((start (point))) (widget-insert "\n\n") (widget-insert "Use the `search' button or hit `s' to enter search query.\n") - (when notmuch-search-history + (when (notmuch-hello-show-recent-searches) (widget-insert "Hit RET to re-submit a previous search. Edit it first if you like.\n") (widget-insert "Save recent searches with the `save' button.\n")) (when notmuch-saved-searches -- 1.7.7.3
[PATCH 2/4] emacs: reindent `notmuch-hello' function
Reindent `notmuch-hello' function after the search history changes. --- emacs/notmuch-hello.el | 56 1 files changed, 28 insertions(+), 28 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index eb08a09..fa33500 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -493,34 +493,34 @@ Complete list of currently available key bindings: (let ((start (point))) (loop for i from 1 to notmuch-hello-recent-searches-max for search in notmuch-search-history do - (let ((widget-symbol (intern (format "notmuch-hello-search-%d" i - (set widget-symbol - (widget-create 'editable-field - ;; Don't let the search boxes be - ;; less than 8 characters wide. - :size (max 8 -(- (window-width) - ;; Leave some space - ;; at the start and - ;; end of the - ;; boxes. - (* 2 notmuch-hello-indent) - ;; 1 for the space - ;; before the - ;; `[save]' button. 6 - ;; for the `[save]' - ;; button. - 1 6)) - :action (lambda (widget ignore) - (notmuch-hello-search (widget-value widget))) - search)) - (widget-insert " ") - (widget-create 'push-button -:notify (lambda (widget ignore) - (notmuch-hello-add-saved-search widget)) -:notmuch-saved-search-widget widget-symbol -"save")) - (widget-insert "\n")) + (let ((widget-symbol (intern (format "notmuch-hello-search-%d" i + (set widget-symbol +(widget-create 'editable-field + ;; Don't let the search boxes be + ;; less than 8 characters wide. + :size (max 8 + (- (window-width) + ;; Leave some space + ;; at the start and + ;; end of the + ;; boxes. + (* 2 notmuch-hello-indent) + ;; 1 for the space + ;; before the + ;; `[save]' button. 6 + ;; for the `[save]' + ;; button. + 1 6)) + :action (lambda (widget ignore) + (notmuch-hello-search (widget-value widget))) + search)) + (widget-insert " ") + (widget-create 'push-button + :notify (lambda (widget ignore) +(notmuch-hello-add-saved-search widget)) + :notmuch-saved-search-widget widget-symbol + "save")) + (widget-insert "\n")) (indent-rigidly start (point) notmuch-hello-indent))) (when alltags-alist -- 1.7.7.3
[PATCH 1/4] emacs: unify search mechanisms
Before the change, there were two ways to do search in Emacs UI: search widget in notmuch-hello buffer and `notmuch-search' function bound to "s". Internally, notmuch-hello search widget uses `notmuch-search' function. But it uses widget field input instead of minibuffer. Such duplication is a major issue for notmuch-hello usability: search interface is inconsistent and lacks features that are available in minibuffer (e.g. history and auto completion). Some of these features may be relatively easy to implement for notmuch-hello search, others would be much more tricky. So to avoid duplication, make UI more consistent, bring notmuch-hello search to feature parity with the minibuffer search, the patch replaces notmuch-hello search widget and with a button that works the same way as "s" key binding. --- emacs/notmuch-hello.el | 84 +++- emacs/notmuch-lib.el |9 + emacs/notmuch.el | 20 ++- 3 files changed, 46 insertions(+), 67 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 333d4c1..eb08a09 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -29,11 +29,8 @@ (declare-function notmuch-search "notmuch" (query oldest-first target-thread target-line continuation)) (declare-function notmuch-poll "notmuch" ()) -(defvar notmuch-hello-search-bar-marker nil - "The position of the search bar within the notmuch-hello buffer.") - -(defcustom notmuch-recent-searches-max 10 - "The number of recent searches to store and display." +(defcustom notmuch-hello-recent-searches-max 10 + "The number of recent searches to display." :type 'integer :group 'notmuch) @@ -154,16 +151,6 @@ International Bureau of Weights and Measures." (defvar notmuch-hello-url "http://notmuchmail.org; "The `notmuch' web site.") -(defvar notmuch-hello-recent-searches nil) - -(defun notmuch-hello-remember-search (search) - (setq notmuch-hello-recent-searches - (delete search notmuch-hello-recent-searches)) - (push search notmuch-hello-recent-searches) - (if (> (length notmuch-hello-recent-searches) -notmuch-recent-searches-max) - (setq notmuch-hello-recent-searches (butlast notmuch-hello-recent-searches - (defun notmuch-hello-nice-number (n) (let (result) (while (> n 0) @@ -176,16 +163,10 @@ International Bureau of Weights and Measures." (format "%s%03d" notmuch-hello-thousands-separator elem)) (cdr result) -(defun notmuch-hello-trim (search) - "Trim whitespace." - (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search) - (match-string 1 search) -search)) - -(defun notmuch-hello-search (search) - (let ((search (notmuch-hello-trim search))) -(notmuch-hello-remember-search search) -(notmuch-search search notmuch-search-oldest-first nil nil #'notmuch-hello-search-continuation))) +(defun notmuch-hello-search ( search) + (interactive) + (notmuch-search search notmuch-search-oldest-first nil nil + #'notmuch-hello-search-continuation)) (defun notmuch-hello-add-saved-search (widget) (interactive) @@ -319,11 +300,6 @@ should be. Returns a cons cell `(tags-per-line width)'." (widget-insert "\n")) found-target-pos)) -(defun notmuch-hello-goto-search () - "Put point inside the `search' widget." - (interactive) - (goto-char notmuch-hello-search-bar-marker)) - (defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png"))) (defun notmuch-hello-search-continuation() @@ -353,7 +329,7 @@ should be. Returns a cons cell `(tags-per-line width)'." (define-key map "G" 'notmuch-hello-poll-and-update) (define-key map (kbd "") 'widget-backward) (define-key map "m" 'notmuch-mua-new-mail) -(define-key map "s" 'notmuch-hello-goto-search) +(define-key map "s" 'notmuch-hello-search) map) "Keymap for \"notmuch hello\" buffers.") (fset 'notmuch-hello-mode-map notmuch-hello-mode-map) @@ -466,7 +442,8 @@ Complete list of currently available key bindings: (widget-insert " messages.\n")) (let ((found-target-pos nil) - (final-target-pos nil)) + (final-target-pos nil) + (default-pos)) (let* ((saved-alist ;; Filter out empty saved searches if required. (if notmuch-show-empty-saved-searches @@ -497,33 +474,26 @@ Complete list of currently available key bindings: (setq final-target-pos found-target-pos)) (indent-rigidly start (point) notmuch-hello-indent))) - (widget-insert "\nSearch: ") - (setq notmuch-hello-search-bar-marker (point-marker)) - (widget-create 'editable-field - ;; Leave some space at the start and end of the - ;; search boxes. - :size (max 8 (- (window-width) notmuch-hello-indent - (length "Search: "))) - :action
[alot] announcing bugfix release v0.21
Good news everyone! I have just tagged the bugfix release version 0.21 of my terminal GUI `alot`. You can get a tarball here: https://github.com/pazz/alot/tarball/0.21 NEWS: * avoid traceback infos from getting written on top of the ui * new --help output, autogenerated manpage * version string extracted from git for cli option --version * command line subcommands: compose and search * properly display multiple headers with the same key * envelope.set option --append * more detailed CUSTOMIZE docs * multiple fixes for the envelope buffer * exit on closing of last buffer is now optional * die gracefully when config parsing fails * random bugfixes in the ui * determine attachments via the Content-Disposition header * nicer alignment for messages in thread buffers * deal with external commands as lists of strings instead of strings * better filetype detection in attachments via magic numbers * errbacks and correct calling of post-hooks for deferred commands * add packaging info for debian * envelope.headers stores lists of values for each key now * default binding: 's' to 'toggletag unread' in search buffers The bleeding-edge development version lives in branch 'testing' and is already a few cool features ahead of this release. Check it out from https://github.com/pazz/alot Thanks goes to dtk, teyphoon, mortbauer and murks for fixes and bugreports. Happy holidays, /p ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
0.11 is frozen, please update NEWS
Well, it's -19C outside, so guess that is appropriate. I have merged master to release in preparation for release. There should only be additions to NEWS or fixes for serious bugs for branch release until 0.11 is out the door. Speaking of NEWS, please have a look at the commits listed under your name, and if they impact user experience, then consider a patch for NEWS. As an experiment, I set up write access to branch news of g...@pivot.cs.unb.ca:pub/notmuch I used the ssh keys people sent me for nmbug; feel free to send me more (public) keys. The idea is it might be less painful to edit NEWS on that branch. Of course, all the old methods are fine too. Aaron Ecay (3): Ignore dynamic libraries on OS X. Add an argument to notmuch-mua-mail emacs: fix off-by-one bug in notmuch-show-archive Ali Polatel (2): notmuch-deliver: Import from maildrop-2.5.5 notmuch-deliver: GPL-3+ Austin Clements (2): emacs: Don't record undo information for search or show buffers. emacs: Avoid unnecessary markers. David Edmondson (1): emacs: Add `notmuch-jump-to-recent-buffer'. Dmitry Kurochkin (31): emacs: do not call notmuch show for non-inlinable parts emacs: put the last search on top of recent searches in notmuch-hello Gregor Zattler (1): emacs: make message indentation width customisable Ivy Foster (1): emacs: Add notmuch-hello-mode-hook Jameson Graef Rollins (2): emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive emacs: call notmuch-show instead of notmuch-search in buttonised id: links Jani Nikula (8): emacs: Add new customization option to sort saved searches emacs: Make saving new saved searches append, not prepend cli: introduce the concept of user defined hooks cli: add support for pre and post notmuch new hooks emacs: support notmuch new as a notmuch-poll-script emacs: Fix notmuch-hello-tag-list-make-query defcustom emacs: Fix notmuch-mua-user-agent defcustom Justus Winter (2): python: add classes to wrap all notmuch_*_t types python: annotate all calls into libnotmuch with types Louis Rilling (2): lib: Kill last usage of C++ type bool tags_to_maildir_flags: Cleanup double assignement Patrick Totzke (3): use __unicode__ for string representation errors='ignore' when decode to unicode fix format string in Message.__unicode__ Sebastian Spaeth (2): python: Return a STATUS value in tags_to_flags and flags_to_tags python: Remove stray debug comment Thomas Jost (6): python: use wrapped notmuch_*_t types instead of raw pointers emacs: Add a face for crypto parts headers Fix build with binutils-2.22 emacs: add notmuch-hello-refresh-hook emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator emacs: Change the default thousands separator to a space Thomas Schwinge (1): dump: Don't sort the output by message id. Tomi Ollila (2): Release memory allocated by internet_address_list_parse_string() notmuch: unref charset_filter to fix one memory leak pazz (2): test: date_relative in notmuch search json output json: date_relative for threads pgpyH22AkYseQ.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 0/2] emacs: patch filename from subject
Hi all, v2 with the following changes: * split the conversion function into three * figure out patch sequence number from the [PATCH N/M] style prefixes * write a bunch of tests for the functions * update the regexps according to bugs found in tests :) BR, Jani. Jani Nikula (2): emacs: create patch filename from subject for inline patch fake parts test: emacs: test notmuch-wash-subject-to-* functions emacs/notmuch-wash.el | 43 - test/emacs-subject-to-filename | 138 test/notmuch-test |1 + 3 files changed, 181 insertions(+), 1 deletions(-) create mode 100755 test/emacs-subject-to-filename -- 1.7.5.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 1/2] emacs: create patch filename from subject for inline patch fake parts
Use the mail subject line for creating a descriptive filename for the wash generated inline patch fake parts. The names are similar to the ones created by 'git format-patch'. If the user has notmuch-wash-convert-inline-patch-to-part hook enabled in notmuch-show-insert-text/plain-hook, this will change the old default filename of inline patch: [ inline patch: text/x-diff ] into, for example: [ 0001-emacs-create-patch-filename-from-subject-for-inline.patch: text/x-diff ] which is typically the same filename the sender had if he was using 'git format-patch' and 'git send-email'. Signed-off-by: Jani Nikula j...@nikula.org --- emacs/notmuch-wash.el | 43 ++- 1 files changed, 42 insertions(+), 1 deletions(-) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index 1f420b2..7d037f5 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -290,6 +290,44 @@ When doing so, maintaining citation leaders in the wrapped text. (defvar diff-file-header-re) ; From `diff-mode.el'. +(defun notmuch-wash-subject-to-filename (subject optional maxlen) + Convert a mail SUBJECT into a filename. + +The resulting filename is similar to the names generated by \git +format-patch\, without the leading patch sequence number +\0001-\ and \.patch\ extension. Any leading \[PREFIX]\ +style strings are removed prior to conversion. + +Optional argument MAXLEN is the maximum length of the resulting +filename, before trimming any trailing . and - characters. + (let* ((s (replace-regexp-in-string ^ *\\(\\[[^]]*\\] *\\)* subject)) +(s (replace-regexp-in-string [^A-Za-z0-9._]+ - s)) +(s (replace-regexp-in-string \\.+ . s)) +(s (if maxlen (substring s 0 (min (length s) maxlen)) s)) +(s (replace-regexp-in-string [.-]*$ s))) +s)) + +(defun notmuch-wash-subject-to-patch-sequence-number (subject) + Convert a patch mail SUBJECT into a patch sequence number. + +Return the patch sequence number N from the last \[PATCH N/M]\ +style prefix in SUBJECT, or nil if such a prefix can't be found. + (when (string-match +^ *\\(\\[[^]]*\\] *\\)*\\[[^]]*?\\([0-9]+\\)/[0-9]+[^]]*\\].* +subject) + (string-to-number (substring subject (match-beginning 2) (match-end 2) + +(defun notmuch-wash-subject-to-patch-filename (subject) + Convert a patch mail SUBJECT into a filename. + +The resulting filename is similar to the names generated by \git +format-patch\. If the patch mail was generated and sent using +\git format-patch/send-email\, this should re-create the +original filename the sender had. + (let* ((n (notmuch-wash-subject-to-patch-sequence-number subject)) +(n (if n n 1))) +(format %04d-%s.patch n (notmuch-wash-subject-to-filename subject 52 + (defun notmuch-wash-convert-inline-patch-to-part (msg depth) Convert an inline patch into a fake 'text/x-diff' attachment. @@ -316,7 +354,10 @@ for error. (setq part (plist-put part :content-type text/x-diff)) (setq part (plist-put part :content (buffer-string))) (setq part (plist-put part :id -1)) - (setq part (plist-put part :filename inline patch)) + (setq part (plist-put part :filename + (notmuch-wash-subject-to-patch-filename + (plist-get + (plist-get msg :headers) :Subject (delete-region (point-min) (point-max)) (notmuch-show-insert-bodypart nil part depth)) -- 1.7.5.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 2/2] test: emacs: test notmuch-wash-subject-to-* functions
Signed-off-by: Jani Nikula j...@nikula.org --- test/emacs-subject-to-filename | 138 test/notmuch-test |1 + 2 files changed, 139 insertions(+), 0 deletions(-) create mode 100755 test/emacs-subject-to-filename diff --git a/test/emacs-subject-to-filename b/test/emacs-subject-to-filename new file mode 100755 index 000..176e685 --- /dev/null +++ b/test/emacs-subject-to-filename @@ -0,0 +1,138 @@ +#!/usr/bin/env bash + +test_description=emacs: mail subject to filename +. test-lib.sh + +# emacs server can't be started in a child process with $(test_emacs ...) +test_emacs '(ignore)' + +# test notmuch-wash-subject-to-patch-sequence-number (subject) +test_begin_subtest no patch sequence number +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number + [PATCH] A normal patch subject without numbers)' +) +test_expect_equal $output + +test_begin_subtest patch sequence number #1 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number + [PATCH 2/3] A most regular patch subject)' +) +test_expect_equal $output 2 + +test_begin_subtest patch sequence number #2 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number +[dummy list prefix] [RFC PATCH v2 13/42] Special prefixes)' +) +test_expect_equal $output 13 + +test_begin_subtest patch sequence number #3 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number + [PATCH 2/3] [PATCH 032/037] use the last prefix)' +) +test_expect_equal $output 32 + +test_begin_subtest patch sequence number #4 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number + [dummy list prefix] [PATCH 2/3] PATCH 3/3] do not use a broken prefix)' +) +test_expect_equal $output 2 + +test_begin_subtest patch sequence number #5 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number + [RFC][PATCH 3/5][PATCH 4/5][PATCH 5/5] A made up test)' +) +test_expect_equal $output 5 + +test_begin_subtest patch sequence number #6 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number + [PATCH 2/3] this - [PATCH 3/3] is not a prefix anymore [nor this 4/4])' +) +test_expect_equal $output 2 + +test_begin_subtest patch sequence number #7 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number + [liberally accept crapola right before123/456and after] the numbers)' +) +test_expect_equal $output 123 + +# test notmuch-wash-subject-to-filename (subject optional maxlen) +test_begin_subtest filename #1 +output=$(test_emacs '(notmuch-wash-subject-to-filename + just a subject line)' +) +test_expect_equal $output 'just-a-subject-line' + +test_begin_subtest filename #2 +output=$(test_emacs '(notmuch-wash-subject-to-filename + [any] [prefixes are ] [removed!] from the subject)' +) +test_expect_equal $output 'from-the-subject' + +test_begin_subtest filename #3 +output=$(test_emacs '(notmuch-wash-subject-to-filename +leading and trailing space )' +) +test_expect_equal $output 'leading-and-trailing-space' + +test_begin_subtest filename #4 +output=$(test_emacs '(notmuch-wash-subject-to-filename + !# leading ()// %, and in between_and_trailing garbage ()(%%)' +) +test_expect_equal $output '-leading-and-in-between_and_trailing-garbage' + +test_begin_subtest filename #5 +output=$(test_emacs '(notmuch-wash-subject-to-filename + ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890)' +) +test_expect_equal $output 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890' + +test_begin_subtest filename #6 +output=$(test_emacs '(notmuch-wash-subject-to-filename + sequences of ... are squashed and trailing are removed ...)' +) +test_expect_equal $output 'sequences-of-.-are-squashed-and-trailing-are-removed' + +test_begin_subtest filename #7 +output=$(test_emacs '(notmuch-wash-subject-to-filename + max length test 1)' +) +test_expect_equal $output 'm' + +test_begin_subtest filename #8 +output=$(test_emacs '(notmuch-wash-subject-to-filename + max length test /(/%/%%¤%¤ 20)' +) +test_expect_equal $output 'max-length-test' + +test_begin_subtest filename #9 +output=$(test_emacs '(notmuch-wash-subject-to-filename + [a prefix] [is only separated] by [spaces], so \by\ is not okay!)' +) +test_expect_equal $output 'by-spaces-so-by-is-not-okay' + +# test notmuch-wash-subject-to-patch-filename (subject) +test_begin_subtest patch filename #1 +output=$(test_emacs '(notmuch-wash-subject-to-patch-filename + [RFC][PATCH 099/100] rewrite notmuch)' +) +test_expect_equal $output '0099-rewrite-notmuch.patch' + +test_begin_subtest patch filename #2 +output=$(test_emacs '(notmuch-wash-subject-to-patch-filename + [RFC PATCH v1] has no patch number, default to 1)' +) +test_expect_equal $output '0001-has-no-patch-number-default-to-1.patch' + +test_begin_subtest patch filename #3 +output=$(test_emacs '(notmuch-wash-subject-to-patch-filename + [PATCH 4/5] the maximum
Re: [PATCH v5 0/4] First step of 'show' rewrite
All looks good to me. Let's push it. I have some minor comments, but they are all more of a style preference (e.g. sig_validity vs signature_validity, using conditional operator (x ? y : z) where possible). Regards, Dmitry ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH 3/4] Utility function to seek in MIME trees in depth-first order.
On Fri, 23 Dec 2011 22:46:19 -0500, Austin Clements amdra...@mit.edu wrote: Quoth Dmitry Kurochkin on Dec 10 at 3:43 pm: On Fri, 9 Dec 2011 14:54:27 -0500, Austin Clements amdra...@mit.edu wrote: This function matches how we number parts for the --part argument to show. It will allow us to jump directly to the desired part, rather than traversing the entire tree and carefully tracking whether or not we're in the zone. --- mime-node.c | 25 + notmuch-client.h |5 + 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/mime-node.c b/mime-node.c index a8e4a59..207818e 100644 --- a/mime-node.c +++ b/mime-node.c @@ -232,3 +232,28 @@ mime_node_child (const mime_node_t *parent, int child) g_type_name (G_OBJECT_TYPE (parent-part))); } } + +static mime_node_t * +_mime_node_seek_dfs_walk (mime_node_t *node, int *n) +{ +mime_node_t *ret = NULL; +int i; + Can we move declarations below the if (which does not need them)? I always have troubles remembering if (recent enough) C standard allows that or it is a GCC extension. FWIW in the previous patch there are declarations in the middle of a block, e.g.: } else { out-is_signed = TRUE; ... GMimeSignatureValidity *sig_validity = g_mime_multipart_signed_verify (GMIME_MULTIPART_SIGNED (part), out-ctx-cryptoctx, err); So either we can move these declarations to where they are needed, or we should fix it in _mime_node_create(). Since prevailing notmuch style seems to be top-declarations, I fixed up _mime_node_create instead (personally I prefer C99-style declarations, but *shrug*). If there is any code which already uses C99-style declarations, then we should use them in the new code IMO. Perhaps whether to use C99-style declarations or not should be a coding style requirement. Regards, Dmitry +if (*n = 0) Comment for mime_node_seek_dfs() says that the function returns the node itself for n = 0, but does not say anything about n 0. I would expect the function to return NULL for n 0. In any case, the comment below should probably mention what happens for n 0; Good point. I made it return NULL for n 0. I think this logically falls under Returns NULL if there is no such part. + return node; + +*n = *n - 1; Perhaps *n -= 1? Or even --(*n)? Changed to *n -= 1. +for (i = 0; i node-children !ret; i++) { Consider s/i++/++i/. notmuch uses i++ remarkably consistently, so I left this. Regards, Dmitry ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v5 0/4] First step of 'show' rewrite
On Sat, 24 Dec 2011 13:52:42 -0500, Austin Clements amdra...@mit.edu wrote: Rename sig_attempted to verify_attempted. Pushed. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [RFC][PATCH v4] emacs: Re-implement advance/rewind functions of notmuch-show-mode.
On Sat, 24 Dec 2011 20:06:35 -0500, Austin Clements amdra...@mit.edu wrote: Awesome. This looks significantly cleaner. I think this is worth pushing for the comment you added to notmuch-show-advance alone. +1 Quoth David Edmondson on Dec 23 at 6:41 pm: The advance/rewind functions had become complex, which made it hard to determine how they are expected to behave. Re-implement them simply in order to poll user-experience and expectation. --- Switched back to using `previous-single-char-property-change' now that Aaron explained it. Fix a bug rewinding when the start of the current message is visible. emacs/notmuch-show.el | 132 +++-- 1 files changed, 73 insertions(+), 59 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 46525aa..e914ce1 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1156,38 +1156,56 @@ Some useful entries are: ;; Commands typically bound to keys. (defun notmuch-show-advance () - Advance through thread. + Advance through the current thread. -If the current message in the thread is not yet fully visible, -scroll by a near screenful to read more of the message. +Scroll the current message if the end of it is not visible, +otherwise move to the next message. -Otherwise, (the end of the current message is already within the -current window), advance to the next open message. +Return `t' if we are at the end of the last message, otherwise +`nil'. (interactive) - (let* ((end-of-this-message (notmuch-show-message-bottom)) -(visible-end-of-this-message (1- end-of-this-message)) -(ret nil)) -(while (invisible-p visible-end-of-this-message) - (setq visible-end-of-this-message - (previous-single-char-property-change visible-end-of-this-message - 'invisible))) -(cond - ;; Ideally we would test `end-of-this-message' against the result - ;; of `window-end', but that doesn't account for the fact that - ;; the end of the message might be hidden. - ((and visible-end-of-this-message - ( visible-end-of-this-message (window-end))) - ;; The bottom of this message is not visible - scroll. - (scroll-up nil)) - - ((not (= end-of-this-message (point-max))) - ;; This is not the last message - move to the next visible one. - (notmuch-show-next-open-message)) - - (t - ;; This is the last message - change the return value - (setq ret t))) -ret)) + (cond + ((eobp) +;; We are at the end of the buffer - move to the next thread. +t) + + ;; Ideally we would simply do: + ;; Tailing whitespace. + ;; (( (notmuch-show-message-bottom) (window-end)) + ;; More trailing whitespace. + ;; here, but that fails if the trailing text in the buffer is + ;; invisible (`window-end' returns the last _visible_ character, + ;; which can then be smaller than `notmuch-show-message-bottom'). + ;; + ;; So we need to find the last visible character of the message. We + ;; do this by searching backwards from + ;; `notmuch-show-message-bottom' for changes in the `invisible' + ;; property until we find a non-invisible character. When we find + ;; such a character we test to see whether it is visible in the + ;; window. + ;; + ;; Properties change between characters - the return value of + ;; `previous-single-char-property-change' points to the first + ;; character _inside_ the region with the `invisible' property + ;; set. To allow for this we step backwards one character upon + ;; finding the start of the invisible region. + + (( (let ((visible-bottom (notmuch-show-message-bottom))) +(while (invisible-p visible-bottom) + (setq visible-bottom (max (point-min) +(1- (previous-single-char-property-change + visible-bottom 'invisible) +visible-bottom) (window-end)) Can this (let...) be lifted out of the (cond...)? IMO it is very confusing to be doing non-trivial computation in the test portion of a cond form. +;; The end of this message is not visible - scroll to show more of +;; it. +(scroll-up) +nil) + + (t +;; All of the current message has been seen - show the start of +;; the next open message. +(notmuch-show-next-open-message) +nil))) (defun notmuch-show-advance-and-archive () Advance through thread and archive. @@ -1201,44 +1219,40 @@ from each message), kills the buffer, and displays the next thread from the search from which this thread was originally shown. (interactive) - (if (notmuch-show-advance) - (notmuch-show-archive-thread))) + (when (notmuch-show-advance) +
Re: [PATCH] emacs: Don't signal an error when reaching the end of the search results.
On Tue, 20 Dec 2011 08:45:14 +, David Edmondson d...@dme.org wrote: With the default configuration ('space' moves through the messages matching the search and back to the results index at the end) it's unnecessary to signal an error when the last message has been read, as this is the common case. Moreover, it's very annoying when `debug-on-error' is t. +1 from me on this change. I had added this to `debug-ignored-errors' long ago, and forgotten how annoying it was. -- Aaron Ecay ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails
On Thu, 15 Dec 2011 19:50:36 -0400, David Bremner da...@tethera.net wrote: I think the problem is related to emacsclient. With 'm' I have the following behaviour: emacs -q --daemon M-x notmuch (to load variable definitions) M-x customize-variable notmuch-mua-compose-in (select compose in new window, save for current session) M-x notmuch m ;; new window is opened as it should be C-c C-c ;; frame is closed. I just tried, and I cannot reproduce this behavior. IIUC, here is what happened to you: you set nm-mua-compose-in to 'new-window. You began a new message, this opened a new window as expected. Your emacs frame now has two windows in it. You sent this message, which deleted the window showing it. Your emacs frame was deleted as well, which made the other window, showing notmuch-hello (or some other notmuch buffer, from which you began writing the email message) disappear as well, unexpectedly. Is this a correct description of what happened? Here’s the recipe I used for replicating: emacs -q --daemon emacsclient -c C-x b *scratch* (add-to-list 'load-path /path/to/notmuch/emacs/) C-j (load-library notmuch) C-j C-x C-f /path/to/notmuch/emacs/notmuch-mua.el M-x eval-buffer (in order to pick up changes not in byte-compiled file) M-x customize-variable notmuch-mua-compose-in (set to 'new-window, save for session) M-x notmuch m (new window is created in current frame, below the window showing notmuch-hello) (type mail) C-c C-c (enter smtp settings, since emacs doesn’t know them) (new window disappears, the window with notmuch-hello fills whole frame) I also tried with notmuch-mua-compose-in set to 'new-frame, and got the expected behavior (m - create new frame, C-c C-c - new frame is deleted) What version of emacs did you have this problem with? The window/frame handling code has undergone several intrusive rewrites post-v.23, each of which fixed some bugs and introduced others. The version I used is a trunk build from Dec. 12-ish. It would be nice to pinpoint which emacs versions/configurations show undesired behavior – this is a useful patch and it should be included once we can be sure it will work correctly. Thanks, -- Aaron Ecay ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch