[PATCH 2/2] emacs: Fix notmuch-mua-user-agent defcustom
The :options keyword is not meaningful for function type. Also, it was not possible to enter nil value, contrary to the notmuch-mua-user-agent defcustom documentation. Specify the alternatives using choice type, taking nil into account. Signed-off-by: Jani Nikula --- emacs/notmuch-mua.el | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 8824b08..8b95bd4 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -35,10 +35,12 @@ "Function used to generate a `User-Agent:' string. If this is `nil' then no `User-Agent:' will be generated." :group 'notmuch - :type 'function - :options '(notmuch-mua-user-agent-full -notmuch-mua-user-agent-notmuch -notmuch-mua-user-agent-emacs)) + :type '(choice (const :tag "No user agent string" nil) +(const :tag "Full" notmuch-mua-user-agent-full) +(const :tag "Notmuch" notmuch-mua-user-agent-notmuch) +(const :tag "Emacs" notmuch-mua-user-agent-emacs) +(function :tag "Custom user agent function" + :value notmuch-mua-user-agent-full))) (defcustom notmuch-mua-hidden-headers '("^User-Agent:") "Headers that are added to the `message-mode' hidden headers -- 1.7.4.1
[PATCH RESEND 2/2] emacs: Make saving new saved searches append, not prepend
Append new saved searches at the end of saved searches rather than insert in front. Signed-off-by: Jani Nikula --- emacs/notmuch-hello.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 6c8e265..dc34ebe 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -188,8 +188,8 @@ Typically \",\" in the US and UK and \".\" in Europe." collect elem)) ;; Add the new one. (customize-save-variable 'notmuch-saved-searches -(push (cons name search) - notmuch-saved-searches)) +(add-to-list 'notmuch-saved-searches + (cons name search) t)) (message "Saved '%s' as '%s'." search name) (notmuch-hello-update))) -- 1.7.4.1
[PATCH RESEND 1/2] emacs: Add new customization option to sort saved searches
Add new customization option notmuch-saved-search-sort-function to sort saved searches in user-defined order. Provide a sort function to sort the saved searches in alphabetical order. Setting the search function to nil causes the saved searches not to be sorted, as before. This also remains the default. The function only affects display of the saved searches, not the order in which they are stored by custom. Signed-off-by: Jani Nikula --- emacs/notmuch-hello.el | 24 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 65fde75..6c8e265 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -42,6 +42,26 @@ :type 'boolean :group 'notmuch) +(defun notmuch-sort-saved-searches (alist) + "Generate an alphabetically sorted saved searches alist." + (sort alist (lambda (a b) (string< (car a) (car b) + +(defcustom notmuch-saved-search-sort-function nil + "Function used to sort the saved searches for the notmuch-hello view. + +This variable controls how saved searches should be sorted. No +sorting (nil) displays the saved searches in the order they are +stored in `notmuch-saved-searches'. Sort alphabetically sorts the +saved searches in alphabetical order. Custom sort function should +be a function or a lambda expression that takes the saved +searches alist as a parameter, and returns a new saved searches +alist to be used." + :type '(choice (const :tag "No sorting" nil) +(const :tag "Sort alphabetically" notmuch-sort-saved-searches) +(function :tag "Custom sort function" + :value notmuch-sort-saved-searches)) + :group 'notmuch) + (defvar notmuch-hello-indent 4 "How much to indent non-headers.") @@ -440,6 +460,10 @@ Complete list of currently available key bindings: (widest (max saved-widest alltags-widest))) (when saved-alist + ;; Sort saved searches if required. + (when notmuch-saved-search-sort-function + (setq saved-alist + (funcall notmuch-saved-search-sort-function saved-alist))) (widget-insert "\nSaved searches: ") (widget-create 'push-button :notify (lambda ( ignore) -- 1.7.4.1
[PATCH RESEND 0/2] emacs: sort saved searches
Hi, resending as this seems forgotten. Last time [1] there was no objections to this improved approach. BR, Jani. [1] id:"cover.1315341018.git.jani at nikula.org" Jani Nikula (2): emacs: Add new customization option to sort saved searches emacs: Make saving new saved searches append, not prepend emacs/notmuch-hello.el | 28 ++-- 1 files changed, 26 insertions(+), 2 deletions(-) -- 1.7.4.1
[PATCH RESEND 0/2] emacs: sort saved searches
Hi, resending as this seems forgotten. Last time [1] there was no objections to this improved approach. BR, Jani. [1] id:cover.1315341018.git.j...@nikula.org Jani Nikula (2): emacs: Add new customization option to sort saved searches emacs: Make saving new saved searches append, not prepend emacs/notmuch-hello.el | 28 ++-- 1 files changed, 26 insertions(+), 2 deletions(-) -- 1.7.4.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH RESEND 1/2] emacs: Add new customization option to sort saved searches
Add new customization option notmuch-saved-search-sort-function to sort saved searches in user-defined order. Provide a sort function to sort the saved searches in alphabetical order. Setting the search function to nil causes the saved searches not to be sorted, as before. This also remains the default. The function only affects display of the saved searches, not the order in which they are stored by custom. Signed-off-by: Jani Nikula j...@nikula.org --- emacs/notmuch-hello.el | 24 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 65fde75..6c8e265 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -42,6 +42,26 @@ :type 'boolean :group 'notmuch) +(defun notmuch-sort-saved-searches (alist) + Generate an alphabetically sorted saved searches alist. + (sort alist (lambda (a b) (string (car a) (car b) + +(defcustom notmuch-saved-search-sort-function nil + Function used to sort the saved searches for the notmuch-hello view. + +This variable controls how saved searches should be sorted. No +sorting (nil) displays the saved searches in the order they are +stored in `notmuch-saved-searches'. Sort alphabetically sorts the +saved searches in alphabetical order. Custom sort function should +be a function or a lambda expression that takes the saved +searches alist as a parameter, and returns a new saved searches +alist to be used. + :type '(choice (const :tag No sorting nil) +(const :tag Sort alphabetically notmuch-sort-saved-searches) +(function :tag Custom sort function + :value notmuch-sort-saved-searches)) + :group 'notmuch) + (defvar notmuch-hello-indent 4 How much to indent non-headers.) @@ -440,6 +460,10 @@ Complete list of currently available key bindings: (widest (max saved-widest alltags-widest))) (when saved-alist + ;; Sort saved searches if required. + (when notmuch-saved-search-sort-function + (setq saved-alist + (funcall notmuch-saved-search-sort-function saved-alist))) (widget-insert \nSaved searches: ) (widget-create 'push-button :notify (lambda (rest ignore) -- 1.7.4.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH RESEND 2/2] emacs: Make saving new saved searches append, not prepend
Append new saved searches at the end of saved searches rather than insert in front. Signed-off-by: Jani Nikula j...@nikula.org --- emacs/notmuch-hello.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 6c8e265..dc34ebe 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -188,8 +188,8 @@ Typically \,\ in the US and UK and \.\ in Europe. collect elem)) ;; Add the new one. (customize-save-variable 'notmuch-saved-searches -(push (cons name search) - notmuch-saved-searches)) +(add-to-list 'notmuch-saved-searches + (cons name search) t)) (message Saved '%s' as '%s'. search name) (notmuch-hello-update))) -- 1.7.4.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 2/2] emacs: Fix notmuch-mua-user-agent defcustom
The :options keyword is not meaningful for function type. Also, it was not possible to enter nil value, contrary to the notmuch-mua-user-agent defcustom documentation. Specify the alternatives using choice type, taking nil into account. Signed-off-by: Jani Nikula j...@nikula.org --- emacs/notmuch-mua.el | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 8824b08..8b95bd4 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -35,10 +35,12 @@ Function used to generate a `User-Agent:' string. If this is `nil' then no `User-Agent:' will be generated. :group 'notmuch - :type 'function - :options '(notmuch-mua-user-agent-full -notmuch-mua-user-agent-notmuch -notmuch-mua-user-agent-emacs)) + :type '(choice (const :tag No user agent string nil) +(const :tag Full notmuch-mua-user-agent-full) +(const :tag Notmuch notmuch-mua-user-agent-notmuch) +(const :tag Emacs notmuch-mua-user-agent-emacs) +(function :tag Custom user agent function + :value notmuch-mua-user-agent-full))) (defcustom notmuch-mua-hidden-headers '(^User-Agent:) Headers that are added to the `message-mode' hidden headers -- 1.7.4.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] vim plugin: allow customizing of current read+archive+advance behavior
Currently if you navigate through an entire thread using space it will automatically have it's 'unread' and 'inbox' tags removed. For many userss archiving is limited to threads that are old and unlikely to be referenced again rather than threads that you've simply read or glanced through recently, particularly users like me with poor long-term memory. This patch adds g:notmuch_advance_add_tags and g:notmuch_advance_remove_tags settings to customize this behavior while also adding the option to have tags added to threads that have been read in their entirety. Signed-off-by: Michael Roth mdr...@linux.vnet.ibm.com --- vim/plugin/notmuch.vim | 47 --- 1 files changed, 36 insertions(+), 11 deletions(-) diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 21985c7..5bcd262 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -103,6 +103,14 @@ let s:notmuch_compose_headers_defaults = [ \ 'Subject' \ ] + defaults for g:notmuch_advance_remove_tags + override with: let g:notmuch_advance_remove_tags = [ ... ] +let s:notmuch_advance_remove_tags = [ 'unread', 'inbox' ] + + defaults for g:notmuch_advance_add_tags + override with: let g:notmuch_advance_add_tags = [ ... ] +let s:notmuch_advance_add_tags = [ ] + --- keyboard mapping definitions {{{1 --- --- bindings for folders mode {{{2 @@ -160,7 +168,7 @@ let g:notmuch_show_maps = { \ 'v': ':call SIDNM_show_view_all_mime_parts()CR', \ '+': ':call SIDNM_show_add_tag()CR', \ '-': ':call SIDNM_show_remove_tag()CR', -\ 'Space':':call SIDNM_show_advance_marking_read_and_archiving()CR', +\ 'Space':':call SIDNM_show_advance_and_tag()CR', \ '\|': ':call SIDNM_show_pipe_message()CR', \ \ 'S-Tab':':call SIDNM_show_previous_fold()CR', @@ -573,10 +581,11 @@ endfunction if entire message is not visible scroll down 1/2 page or less to get to the bottom of message otherwise go to next message - any message that is viewed entirely has inbox and unread tags removed -function! s:NM_show_advance_marking_read_and_archiving() -let advance_tags = ['unread', 'inbox'] - + any message that is viewed entirely has g:notmuch_advance_add_tags added and + g:notmuch_advance_remove_tags removed +function! s:NM_show_advance_and_tag() +let remove_tags = copy(g:notmuch_advance_remove_tags) +let add_tags = copy(g:notmuch_advance_add_tags) let vis_top = line('w0') let vis_bot = line('w$') @@ -585,6 +594,11 @@ function! s:NM_show_advance_marking_read_and_archiving() throw No top visible message. endif +let remove_tags_formatted = copy(remove_tags) +call map(remove_tags_formatted, '- . v:val') +let add_tags_formatted = copy(add_tags) +call map(add_tags_formatted, '+ . v:val') + if the top message is the last message, just expunge the entire thread and move on if msg_top['end'] == line('$') let ids = [] @@ -593,11 +607,14 @@ function! s:NM_show_advance_marking_read_and_archiving() call add(ids, msg['id']) endif endfor -let filter = SIDNM_combine_tags('tag:', advance_tags, 'OR', '()') +let filter = SIDNM_combine_tags('tag:', remove_tags, 'OR', '()') \ + ['AND'] \ + SIDNM_combine_tags('', ids, 'OR', '()') -call map(advance_tags, '- . v:val') -call SIDNM_tag(filter, advance_tags) +call SIDNM_tag(filter, remove_tags_formatted) +let filter = SIDNM_combine_tags('not tag:', add_tags, 'OR', '()') + \ + ['AND'] + \ + SIDNM_combine_tags('', ids, 'OR', '()') +call SIDNM_tag(filter, add_tags_formatted) call SIDNM_show_next(1, 1) return endif @@ -614,10 +631,12 @@ function! s:NM_show_advance_marking_read_and_archiving() if has_key(msg_top,'match') msg_top['match'] != '0' redraw do this last to hide the latency -let filter = SIDNM_combine_tags('tag:', advance_tags, 'OR', '()') +let filter = SIDNM_combine_tags('tag:', remove_tags, 'OR', '()') + \ + ['AND', msg_top['id']] +call SIDNM_tag(filter, remove_tags_formatted) +let filter = SIDNM_combine_tags('not tag:', add_tags, 'OR', '()') \ + ['AND', msg_top['id']] -call map(advance_tags, '- . v:val') -call SIDNM_tag(filter, advance_tags) +call SIDNM_tag(filter, add_tags_formatted)
Re: [PATCH v6 00/17] Fix 'notmuch new' atomicity issues
On Tue, 13 Sep 2011 09:39:15 -0300, David Bremner da...@tethera.net wrote: On Fri, 8 Jul 2011 14:09:16 -0400, Austin Clements amdra...@mit.edu wrote: I have rebased these yet again, and pushed the first 4 commits to master. So far this is mainly testing stuff, along with one oneline bugfix. I also added a couple testing related commits: 73ed66a test: use test_expect_equal_file in atomicity 05a522c test: Convert atomicity test to use test_subtest_known_broken I have pushed 5 more commits in the sequence, without changes. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v6 00/17] Fix 'notmuch new' atomicity issues
Quoth David Bremner on Sep 23 at 11:14 pm: On Tue, 13 Sep 2011 09:39:15 -0300, David Bremner da...@tethera.net wrote: On Fri, 8 Jul 2011 14:09:16 -0400, Austin Clements amdra...@mit.edu wrote: I have rebased these yet again, and pushed the first 4 commits to master. So far this is mainly testing stuff, along with one oneline bugfix. I also added a couple testing related commits: 73ed66a test: use test_expect_equal_file in atomicity 05a522c test: Convert atomicity test to use test_subtest_known_broken I have pushed 5 more commits in the sequence, without changes. Awesome. Only seven more to go! ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch