![]() ![]() |
William Casarin |
![]() |
This patch series replaces my original set[1]. I've been using this
extensivly for about 3 weeks now and I'm pretty happy with it. I've added the ability to change sort-order on the fly with the O key binding. Main use cases -------------- * subject sorting: github subscriptions Sorting through your subscribed github repos is now easier than ever! before: https://jb55.com/s/7889d50bc848b089.png after: https://jb55.com/s/c8b5055939d0482f.png * from sorting: rss feeds https://jb55.com/s/68a5aa6ecdebbbfe.png Cheers, William [1] id:[hidden email] William Casarin (6): sorting: add the ability to sort by from and subject sorting: update ruby bindings for from and subject sorting: update man page emacs: replace oldest-first with sort-order emacs: notmuch-search-orders emacs: add notmuch-search-change-order bindings/ruby/init.c | 24 ++++++++++++++++ doc/man1/notmuch-address.rst | 6 +++- emacs/notmuch-hello.el | 18 ++++++------ emacs/notmuch-jump.el | 13 ++++----- emacs/notmuch-lib.el | 15 ++++++++-- emacs/notmuch-tree.el | 2 +- emacs/notmuch.el | 66 +++++++++++++++++++++++++++++--------------- lib/notmuch.h | 16 +++++++++++ lib/query.cc | 12 ++++++++ notmuch-search.c | 4 +++ 10 files changed, 133 insertions(+), 43 deletions(-) -- 2.13.2 https://jb55.com _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
William Casarin |
![]() |
* add {from,subject}-{ascending,descending} sort options
--- lib/notmuch.h | 16 ++++++++++++++++ lib/query.cc | 12 ++++++++++++ notmuch-search.c | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/lib/notmuch.h b/lib/notmuch.h index f26565f3..071bfe4d 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -765,6 +765,22 @@ typedef enum { */ NOTMUCH_SORT_NEWEST_FIRST, /** + * Sort by from: in ascending order + */ + NOTMUCH_SORT_FROM_ASC, + /** + * Sort by from: in descending order + */ + NOTMUCH_SORT_FROM_DESC, + /** + * Sort by subject: in ascending order + */ + NOTMUCH_SORT_SUBJECT_ASC, + /** + * Sort by subject: in descending order + */ + NOTMUCH_SORT_SUBJECT_DESC, + /** * Sort by message-id. */ NOTMUCH_SORT_MESSAGE_ID, diff --git a/lib/query.cc b/lib/query.cc index 9c6ecc8d..106814a8 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -327,6 +327,18 @@ _notmuch_query_search_documents (notmuch_query_t *query, case NOTMUCH_SORT_NEWEST_FIRST: enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, TRUE); break; + case NOTMUCH_SORT_FROM_ASC: + enquire.set_sort_by_value (NOTMUCH_VALUE_FROM, FALSE); + break; + case NOTMUCH_SORT_FROM_DESC: + enquire.set_sort_by_value (NOTMUCH_VALUE_FROM, TRUE); + break; + case NOTMUCH_SORT_SUBJECT_ASC: + enquire.set_sort_by_value (NOTMUCH_VALUE_SUBJECT, FALSE); + break; + case NOTMUCH_SORT_SUBJECT_DESC: + enquire.set_sort_by_value (NOTMUCH_VALUE_SUBJECT, TRUE); + break; case NOTMUCH_SORT_MESSAGE_ID: enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, FALSE); break; diff --git a/notmuch-search.c b/notmuch-search.c index 380e9d8f..b80647e9 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -789,6 +789,10 @@ static const notmuch_opt_desc_t common_options[] = { { NOTMUCH_OPT_KEYWORD, &search_context.sort, "sort", 's', (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST }, { "newest-first", NOTMUCH_SORT_NEWEST_FIRST }, + { "from-ascending", NOTMUCH_SORT_FROM_ASC }, + { "from-descending", NOTMUCH_SORT_FROM_DESC }, + { "subject-ascending", NOTMUCH_SORT_SUBJECT_ASC }, + { "subject-descending", NOTMUCH_SORT_SUBJECT_DESC }, { 0, 0 } } }, { NOTMUCH_OPT_KEYWORD, &search_context.format_sel, "format", 'f', (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON }, -- 2.13.2 _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
William Casarin |
![]() |
In reply to this post by William Casarin
---
bindings/ruby/init.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c index 5556b43e..ace8f666 100644 --- a/bindings/ruby/init.c +++ b/bindings/ruby/init.c @@ -104,6 +104,30 @@ Init_notmuch (void) */ rb_define_const (mod, "SORT_NEWEST_FIRST", INT2FIX (NOTMUCH_SORT_NEWEST_FIRST)); /* + * Document-const: Notmuch::SORT_FROM_ASC + * + * Sort query results by from in ascending order + */ + rb_define_const (mod, "SORT_FROM_ASC", INT2FIX (NOTMUCH_SORT_FROM_ASC)); + /* + * Document-const: Notmuch::SORT_FROM_DESC + * + * Sort query results by from in descending order + */ + rb_define_const (mod, "SORT_FROM_DESC", INT2FIX (NOTMUCH_SORT_FROM_DESC)); + /* + * Document-const: Notmuch::SORT_SUBJECT_ASC + * + * Sort query results by subject in ascending order + */ + rb_define_const (mod, "SORT_SUBJECT_ASC", INT2FIX (NOTMUCH_SORT_SUBJECT_ASC)); + /* + * Document-const: Notmuch::SORT_SUBJECT_DESC + * + * Sort query results by from in descending order + */ + rb_define_const (mod, "SORT_SUBJECT_DESC", INT2FIX (NOTMUCH_SORT_SUBJECT_DESC)); + /* * Document-const: Notmuch::SORT_MESSAGE_ID * * Sort query results by message id -- 2.13.2 _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
William Casarin |
![]() |
In reply to this post by William Casarin
---
doc/man1/notmuch-address.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst index cc31cc5a..38ae9a25 100644 --- a/doc/man1/notmuch-address.rst +++ b/doc/man1/notmuch-address.rst @@ -77,7 +77,11 @@ Supported options for **address** include frequently among the matching messages. If --output=count is specified, include all variants in the count. - ``--sort=``\ (**newest-first**\ \|\ **oldest-first**) + ``--sort=<order>`` + Where <order> can be one of **oldest-first**, **newest-first**, + **subject-ascending**, **subject-descending**, + **from-ascending**, **from-descending** + This option can be used to present results in either chronological order (**oldest-first**) or reverse chronological order (**newest-first**). -- 2.13.2 _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
William Casarin |
![]() |
In reply to this post by William Casarin
This generalizes notmuch-search-oldest-first to
notmuch-search-sort-order. notmuch-search-sort-order can now be one of: * oldest-first * newest-first * subject-ascending * subject-descending * from-ascending * from-descending Order toggling now simply inverts the corresponding option. --- emacs/notmuch-hello.el | 18 +++++++++-------- emacs/notmuch-jump.el | 13 +++++-------- emacs/notmuch-lib.el | 10 ++++++++-- emacs/notmuch-tree.el | 2 +- emacs/notmuch.el | 52 ++++++++++++++++++++++++++++---------------------- 5 files changed, 53 insertions(+), 42 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index c858a20b..dd733f9f 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -95,7 +95,11 @@ searches so they still work in customize." (choice :tag " Sort Order" (const :tag "Default" nil) (const :tag "Oldest-first" oldest-first) - (const :tag "Newest-first" newest-first))) + (const :tag "Newest-first" newest-first) + (const :tag "Subject-ascending" subject-ascending) + (const :tag "Subject-descending" subject-descending) + (const :tag "From-ascending" from-ascending) + (const :tag "From-descending" from-descending))) (group :format "%v" :inline t (const :format "" :search-type) (choice :tag " Search Type" (const :tag "Search mode" nil) @@ -381,7 +385,7 @@ afterwards.") (setq search (notmuch-hello-trim search)) (let ((history-delete-duplicates t)) (add-to-history 'notmuch-search-history search))) - (notmuch-search search notmuch-search-oldest-first)) + (notmuch-search search notmuch-search-sort-order)) (defun notmuch-hello-add-saved-search (widget) (interactive) @@ -443,7 +447,7 @@ diagonal." (notmuch-search (widget-get widget :notmuch-search-terms) (widget-get widget - :notmuch-search-oldest-first)))) + :notmuch-search-sort-order)))) (defun notmuch-saved-search-count (search) (car (process-lines notmuch-command "count" search))) @@ -575,10 +579,8 @@ with `notmuch-hello-query-counts'." (widget-insert (make-string column-indent ? ))) (let* ((name (plist-get elem :name)) (query (plist-get elem :query)) - (oldest-first (case (plist-get elem :sort-order) - (newest-first nil) - (oldest-first t) - (otherwise notmuch-search-oldest-first))) + (order (plist-get elem :sort-order)) + (sort-order (if (not order) notmuch-search-sort-order order)) (search-type (eq (plist-get elem :search-type) 'tree)) (msg-count (plist-get elem :count))) (widget-insert (format "%8s " @@ -586,7 +588,7 @@ with `notmuch-hello-query-counts'." (widget-create 'push-button :notify #'notmuch-hello-widget-search :notmuch-search-terms query - :notmuch-search-oldest-first oldest-first + :notmuch-search-sort-order sort-order :notmuch-search-type search-type name) (setq column-indent diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 3e20b8c7..5fd654fb 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -48,17 +48,14 @@ fast way to jump to a saved search from anywhere in Notmuch." (let* ((saved-search (notmuch-hello-saved-search-to-plist saved-search)) (key (plist-get saved-search :key))) (when key - (let ((name (plist-get saved-search :name)) - (query (plist-get saved-search :query)) - (oldest-first - (case (plist-get saved-search :sort-order) - (newest-first nil) - (oldest-first t) - (otherwise (default-value 'notmuch-search-oldest-first))))) + (let* ((name (plist-get saved-search :name)) + (query (plist-get saved-search :query)) + (order (plist-get saved-search :sort-order)) + (sort-order (if (not order) notmuch-search-sort-order order))) (push (list key name (if (eq (plist-get saved-search :search-type) 'tree) `(lambda () (notmuch-tree ',query)) - `(lambda () (notmuch-search ',query ',oldest-first)))) + `(lambda () (notmuch-search ',query ',sort-order)))) action-map))))) (setq action-map (nreverse action-map)) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 010be454..ee7b67d3 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -92,14 +92,20 @@ $PATH)." :type 'string :group 'notmuch-external) -(defcustom notmuch-search-oldest-first t +(defcustom notmuch-search-sort-order 'oldest-first "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 + :type '(choice :tag " Sort Order" + (const :tag "Oldest-first" oldest-first) + (const :tag "Newest-first" newest-first) + (const :tag "Subject-ascending" subject-ascending) + (const :tag "Subject-descending" subject-descending) + (const :tag "From-ascending" from-ascending) + (const :tag "From-descending" from-descending)) :group 'notmuch-search) (defcustom notmuch-poll-script nil diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index c00315e8..b95ff71f 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -33,7 +33,7 @@ (require 'notmuch-parser) (eval-when-compile (require 'cl)) -(declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line)) +(declare-function notmuch-search "notmuch" (&optional query sort-order target-thread target-line)) (declare-function notmuch-call-notmuch-process "notmuch" (&rest args)) (declare-function notmuch-read-query "notmuch" (prompt)) (declare-function notmuch-search-find-thread-id "notmuch" (&optional bare)) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 44402f8a..334458b7 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -380,7 +380,7 @@ Complete list of currently available key bindings: \\{notmuch-search-mode-map}" (make-local-variable 'notmuch-search-query-string) - (make-local-variable 'notmuch-search-oldest-first) + (make-local-variable 'notmuch-search-sort-order) (make-local-variable 'notmuch-search-target-thread) (make-local-variable 'notmuch-search-target-line) (setq notmuch-buffer-refresh-function #'notmuch-search-refresh-view) @@ -959,7 +959,7 @@ PROMPT is the string to prompt with." (put 'notmuch-search 'notmuch-doc "Search for messages.") ;;;###autoload -(defun notmuch-search (&optional query oldest-first target-thread target-line no-display) +(defun notmuch-search (&optional query sort-order target-thread target-line no-display) "Display threads matching QUERY in a notmuch-search buffer. If QUERY is nil, it is read interactively from the minibuffer. @@ -982,7 +982,7 @@ the configured default sort order." nil ;; Use the default search order (if we're doing a search from a ;; search buffer, ignore any buffer-local overrides) - (default-value 'notmuch-search-oldest-first))) + (default-value 'notmuch-search-sort-order))) (let* ((query (or query (notmuch-read-query "Notmuch search: "))) (buffer (get-buffer-create (notmuch-search-buffer-title query)))) @@ -993,29 +993,26 @@ the configured default sort order." ;; 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) + (set 'notmuch-search-sort-order sort-order) (set 'notmuch-search-target-thread target-thread) (set 'notmuch-search-target-line target-line) (notmuch-tag-clear-cache) (let ((proc (get-buffer-process (current-buffer))) (inhibit-read-only t)) (if proc - (error "notmuch search process already running for query `%s'" query) - ) + (error "notmuch search process already running for query `%s'" query)) (erase-buffer) (goto-char (point-min)) (save-excursion - (let ((proc (notmuch-start-notmuch - "notmuch-search" buffer #'notmuch-search-process-sentinel - "search" "--format=sexp" "--format-version=4" - (if oldest-first - "--sort=oldest-first" - "--sort=newest-first") - 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. - (parse-buf (generate-new-buffer " *notmuch search parse*"))) + (let* ((proc (notmuch-start-notmuch + "notmuch-search" buffer #'notmuch-search-process-sentinel + "search" "--format=sexp" "--format-version=4" + (concat "--sort=" (symbol-name sort-order)) + 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. + (parse-buf (generate-new-buffer " *notmuch search parse*"))) (process-put proc 'parse-buf parse-buf) (set-process-filter proc 'notmuch-search-process-filter) (set-process-query-on-exit-flag proc nil)))) @@ -1031,20 +1028,29 @@ thread. Otherwise, point will be moved to attempt to be in the same relative position within the new buffer." (interactive) (let ((target-line (line-number-at-pos)) - (oldest-first notmuch-search-oldest-first) + (sort-order notmuch-search-sort-order) (target-thread (notmuch-search-find-thread-id 'bare)) (query notmuch-search-query-string)) ;; notmuch-search erases the current buffer. - (notmuch-search query oldest-first target-thread target-line t) + (notmuch-search query sort-order target-thread target-line t) (goto-char (point-min)))) +(defun notmuch-toggle-order (order) + (case order + (newest-first 'oldest-first) + (oldest-first 'newest-first) + (from-ascending 'from-descending) + (from-descending 'from-ascending) + (subject-ascending 'subject-descending) + (subject-descending 'subject-ascending))) + (defun notmuch-search-toggle-order () "Toggle the current search order. This command toggles the sort order for the current search. The -default sort order is defined by `notmuch-search-oldest-first'." +default sort order is defined by `notmuch-search-sort-order'." (interactive) - (set 'notmuch-search-oldest-first (not notmuch-search-oldest-first)) + (set 'notmuch-search-sort-order (notmuch-toggle-order notmuch-search-sort-order)) (notmuch-search-refresh-view)) (defun notmuch-group-disjunctive-query-string (query-string) @@ -1068,7 +1074,7 @@ current search results AND the additional query string provided." (notmuch-search (if (string= grouped-original-query "*") grouped-query (concat grouped-original-query " and " grouped-query)) - notmuch-search-oldest-first))) + notmuch-search-sort-order))) (defun notmuch-search-filter-by-tag (tag) "Filter the current search results based on a single tag. @@ -1077,7 +1083,7 @@ Runs a new search matching only messages that match both the current search results AND that are tagged with the given tag." (interactive (list (notmuch-select-tag-with-completion "Filter by tag: "))) - (notmuch-search (concat notmuch-search-query-string " and tag:" tag) notmuch-search-oldest-first)) + (notmuch-search (concat notmuch-search-query-string " and tag:" tag) notmuch-search-sort-order)) ;;;###autoload (defun notmuch () -- 2.13.2 _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
William Casarin |
![]() |
In reply to this post by William Casarin
Create a notmuch-sort-orders alist to be shared between
notmuch-search-sort-orders and notmuch-change-search-order --- emacs/notmuch-lib.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index ee7b67d3..16725863 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -92,6 +92,14 @@ $PATH)." :type 'string :group 'notmuch-external) +(setq notmuch-sort-orders + '(("Oldest-first" . oldest-first) + ("Newest-first" . newest-first) + ("Subject-ascending" . subject-ascending) + ("Subject-descending" . subject-descending) + ("From-ascending" . from-ascending) + ("From-descending" . from-descending))) + (defcustom notmuch-search-sort-order 'oldest-first "Show the oldest mail first when searching. @@ -99,13 +107,10 @@ 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 '(choice :tag " Sort Order" - (const :tag "Oldest-first" oldest-first) - (const :tag "Newest-first" newest-first) - (const :tag "Subject-ascending" subject-ascending) - (const :tag "Subject-descending" subject-descending) - (const :tag "From-ascending" from-ascending) - (const :tag "From-descending" from-descending)) + :type (append '(choice :tag " Sort Order") + (mapcar (lambda (pair) + `(const :tag ,(car pair) ,(cdr pair))) + notmuch-sort-orders)) :group 'notmuch-search) (defcustom notmuch-poll-script nil -- 2.13.2 _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
William Casarin |
![]() |
In reply to this post by William Casarin
notmuch-search-change-order pops up a completing-read minibuffer
completion window for choosing sort-orders. --- emacs/notmuch.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 334458b7..93b4e582 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -178,6 +178,7 @@ there will be called at other points of notmuch execution." (define-key map "r" 'notmuch-search-reply-to-thread-sender) (define-key map "R" 'notmuch-search-reply-to-thread) (define-key map "o" 'notmuch-search-toggle-order) + (define-key map "O" 'notmuch-search-change-order) (define-key map "c" 'notmuch-search-stash-map) (define-key map "t" 'notmuch-search-filter-by-tag) (define-key map "l" 'notmuch-search-filter) @@ -1044,6 +1045,19 @@ same relative position within the new buffer." (subject-ascending 'subject-descending) (subject-descending 'subject-ascending))) +(defun notmuch-search-change-order (&optional sort-order) + "Change the current search order. + +This command changes the order for current search. The default +sort order is defuned by `notmuch-search-sort-order'." + (interactive) + (let ((so (if sort-order sort-order + (cdr (assoc (completing-read + "Select a sort order:" notmuch-sort-orders) + notmuch-sort-orders))))) + (set 'notmuch-search-sort-order so) + (notmuch-search-refresh-view))) + (defun notmuch-search-toggle-order () "Toggle the current search order. -- 2.13.2 _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
Jani Nikula |
![]() |
In reply to this post by William Casarin
On Mon, 25 Sep 2017, William Casarin <[hidden email]> wrote:
> This patch series replaces my original set[1]. I've been using this > extensivly for about 3 weeks now and I'm pretty happy with it. I've > added the ability to change sort-order on the fly with the O key > binding. I think there are two considerations here: First, is this something we want to have? Is this generally useful? There's still the issue of From: and Subject: needing more heuristic for useful sorting that I mentioned in id:[hidden email]. Second, if we decide we want this, IMHO the interfaces (both human and the lib) need to split the sort key and sort order from the start. Fixing it later on is not going to be fun. BR, Jani. _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
William Casarin |
![]() |
Hey Jani,
Jani Nikula <[hidden email]> writes: > I think there are two considerations here: > > First, is this something we want to have? Is this generally useful? Sorting by from and subject are in most mail clients (mutt, gnus, outlook...) > There's still the issue of From: and Subject: needing more heuristic for > useful sorting that I mentioned in id:[hidden email]. I think I understand what you mean in id:[hidden email] but I don't have enough knowledge of notmuch to implement what you're asking :(. I believe these are rare cases because I haven't ran into the issue you described? > Second, if we decide we want this, IMHO the interfaces (both human and > the lib) need to split the sort key and sort order from the > start. Fixing it later on is not going to be fun. I agree, I figured that would have been a larger refactor so I decided not to mix it in with this one. I'll start working on a branch that addresses this. Thanks! William -- https://jb55.com _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
Jani Nikula |
![]() |
On Sat, 30 Sep 2017, William Casarin <[hidden email]> wrote:
> Jani Nikula <[hidden email]> writes: > >> I think there are two considerations here: >> >> First, is this something we want to have? Is this generally useful? > > Sorting by from and subject are in most mail clients (mutt, gnus, outlook...) Which of those display results as threads, and of those that do, how do they sort the threads? In the notmuch case, the threads would be sorted based on one of the matching messages. Which one should it be? For current date based searches, the message used for sorting is also selected based on date. If we expand the sorting, perhaps we should also think about sorting by relevance provided by Xapian. Not saying you'd have to do this, but I'd like to figure out how all of this should work. The implementation doesn't look particularly difficult, it's the design that's harder to get right. >> There's still the issue of From: and Subject: needing more heuristic for >> useful sorting that I mentioned in id:[hidden email]. > > I think I understand what you mean in id:[hidden email] but I > don't have enough knowledge of notmuch to implement what you're asking > :(. I believe these are rare cases because I haven't ran into the issue > you described? Look at the subject line of this message. Should it be sorted starting at "Re:", "[PATCH", or "Sort"? You could argue for and against any one of them. Contrast that with the thread sorting above: If the matching message in this thread changes from one with vs. without "Re:", the sort placement of the thread could change considerably. It's common for some corporate mail systems to switch "Firstname Lastname" in messages to "Lastname, Firstname". Should we do something about that? Arguably we could do the sorting first, and think of ways to improve it afterwards. >> Second, if we decide we want this, IMHO the interfaces (both human and >> the lib) need to split the sort key and sort order from the >> start. Fixing it later on is not going to be fun. > > I agree, I figured that would have been a larger refactor so I decided > not to mix it in with this one. I'll start working on a branch that > addresses this. Please wait for feedback from others first, to not waste effort based on just my opinions. I don't make the decisions here. :) BR, Jani. _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
![]() ![]() |
Mark Walters |
![]() |
Hi On Sat, 30 Sep 2017, Jani Nikula <[hidden email]> wrote: > On Sat, 30 Sep 2017, William Casarin <[hidden email]> wrote: >> Jani Nikula <[hidden email]> writes: >> >>> I think there are two considerations here: >>> >>> First, is this something we want to have? Is this generally useful? >> >> Sorting by from and subject are in most mail clients (mutt, gnus, outlook...) > > Which of those display results as threads, and of those that do, how do > they sort the threads? In the notmuch case, the threads would be sorted > based on one of the matching messages. Which one should it be? For > current date based searches, the message used for sorting is also > selected based on date. I agree with Jani that for thread based views sorting by from is a little odd -- sorting by subject less so as that is mostly constant in a thread. But allowing sorting by from in message based views could be useful. If we are looking at the notmuch-emacs frontend then that would be in tree view. This calls notmuch-show.c from the CLI, so that is the place I would suggest we do this. If notmuch-show.c returns each message as "if it were in its own thread" in the sense of the sexp output (see devel/schemata) I think notmuch-tree would just work. >>> There's still the issue of From: and Subject: needing more heuristic for >>> useful sorting that I mentioned in id:[hidden email]. >> >> I think I understand what you mean in id:[hidden email] but I >> don't have enough knowledge of notmuch to implement what you're asking >> :(. I believe these are rare cases because I haven't ran into the issue >> you described? > > Look at the subject line of this message. Should it be sorted starting > at "Re:", "[PATCH", or "Sort"? You could argue for and against any one > of them. Contrast that with the thread sorting above: If the matching > message in this thread changes from one with vs. without "Re:", the sort > placement of the thread could change considerably. > > It's common for some corporate mail systems to switch "Firstname > Lastname" in messages to "Lastname, Firstname". Should we do something > about that? > > Arguably we could do the sorting first, and think of ways to improve it > afterwards. These are concerns, but I agree that we try some form of sorting first and then think about improving it. I think the above as an interface to notmuch-tree should work -- I had something similar in the very early days of notmuch-tree (when it was notmuch-pick) but dropped it when trying to keep the patch set small enough to be even vaguely manageable. Best wishes Mark _______________________________________________ notmuch mailing list [hidden email] https://notmuchmail.org/mailman/listinfo/notmuch |
Free forum by Nabble | Edit this page |