In the thread at id:87fsfuuxwn.fsf@thinkbox, a bug is discussed where
the point and hl-line overlay get out of sync, leading the user to
open the wrong message. As far as I can tell this is caused by
notmuch-hl-mode being invoked too early.
This change bypasses the logic preventing notmuch-search-hook being
called only once, so that the overlay is updated later after after the
buffer is full(er).
This change may lead to the overlay being updated multiple times; if
this is annoying we can add a similar buffer local variable to ensure
it is only called once.
The extra logic to check notmuch-search-target-line reduces the
flicker somewhat by not highlighting the first line every time.
---
emacs/notmuch.el | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f55e9b42..108bccec 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -126,13 +126,17 @@ there will be called at other points of notmuch execution."
:type 'file
:group 'notmuch)
-(defcustom notmuch-search-hook '(notmuch-hl-line-mode)
+(defcustom notmuch-search-hook nil
"List of functions to call when notmuch displays the search results."
:type 'hook
- :options '(notmuch-hl-line-mode)
:group 'notmuch-search
:group 'notmuch-hooks)
+(defcustom notmuch-hl-line t
+ "Use hl-line-mode to highlight current thread / message"
+ :type 'boolean
+ :group 'notmuch)
+
;;; Mime Utilities
(defun notmuch-foreach-mime-part (function mm-handle)
@@ -925,6 +929,11 @@ sets the :orig-tag property."
(notmuch-sexp-parse-partial-list 'notmuch-search-append-result
results-buf))
(with-current-buffer results-buf
+ (when (and notmuch-hl-line
+ (>=
+ (line-number-at-pos (point-max) t)
+ (or notmuch-search-target-line -1)))
+ (notmuch-hl-line-mode))
(notmuch--search-hook-wrapper)))))
;;; Commands (and some helper functions used by them)
--
2.43.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org