X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch.el;h=ff9b519b2d6052cf52d68b825b48ed7946653f1a;hb=75f703e7c2fe33920342c1bc534d19935c1e3513;hp=fe1041f013f864f56d0b49276e5b64eb079dddd6;hpb=17b09af22809d32cd6bf8050bb30f80d9810944f;p=notmuch diff --git a/emacs/notmuch.el b/emacs/notmuch.el index fe1041f0..ff9b519b 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -47,7 +47,7 @@ ; kudos: Notmuch list (subscription is not ; required, but is available from http://notmuchmail.org). -(require 'cl) +(eval-when-compile (require 'cl)) (require 'mm-view) (require 'message) @@ -575,9 +575,10 @@ This function advances the next thread when finished." (if (and atbob (not (string= notmuch-search-target-thread "found"))) (set 'never-found-target-thread t)))))) - (if (and never-found-target-thread + (when (and never-found-target-thread notmuch-search-target-line) - (goto-line notmuch-search-target-line))))))) + (goto-char (point-min)) + (forward-line (1- notmuch-search-target-line)))))))) (defcustom notmuch-search-line-faces nil "Tag/face mapping for line highlighting in notmuch-search. @@ -691,7 +692,7 @@ matching will be applied." (more t) (inhibit-read-only t)) (while more - (if (string-match "^\\(thread:[0-9A-Fa-f]*\\) \\(.*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\))$" string line) + (if (string-match "^\\(thread:[0-9A-Fa-f]*\\) \\([^][]*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\))$" string line) (let* ((thread-id (match-string 1 string)) (date (match-string 2 string)) (count (match-string 3 string)) @@ -741,10 +742,16 @@ characters as well as `_.+-'. (defun notmuch-search-buffer-title (query) "Returns the title for a buffer with notmuch search results." - (let* ((saved-search (rassoc-if (lambda (key) - (string-match (concat "^" (regexp-quote key)) - query)) - (reverse (notmuch-saved-searches)))) + (let* ((saved-search + (let (longest + (longest-length 0)) + (loop for tuple in notmuch-saved-searches + if (let ((quoted-query (regexp-quote (cdr tuple)))) + (and (string-match (concat "^" quoted-query) query) + (> (length (match-string 0 query)) + longest-length))) + do (setq longest tuple)) + longest)) (saved-search-name (car saved-search)) (saved-search-query (cdr saved-search))) (cond ((and saved-search (equal saved-search-query query))