mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
notmuch.el: Override next-line and previous-line to make them reliable.
I noticed that these functions would sometimes leave point on an invisible character[*]. The problem would be that point would appear to be on a particular message, but adding or removing a tag would actually add/remove a tag from the *previous* message. Fix the C-n and C-p keybindings at least to call the underlying command and then advance to a visible character. We set this-command in our overrides so that the temporary-goal-column feature still works. [*] The documentation says that command loop is supposed to move point outside of any invisible region when a command exits. But apparently not.
This commit is contained in:
parent
1d68e75c21
commit
eacd1ac41e
1 changed files with 26 additions and 0 deletions
26
notmuch.el
26
notmuch.el
|
@ -34,6 +34,8 @@
|
|||
(define-key map "h" 'notmuch-show-toggle-headers-visible)
|
||||
(define-key map "n" 'notmuch-show-next-message)
|
||||
(define-key map "p" 'notmuch-show-previous-message)
|
||||
(define-key map (kbd "C-n") 'notmuch-show-next-line)
|
||||
(define-key map (kbd "C-p") 'notmuch-show-previous-line)
|
||||
(define-key map "q" 'kill-this-buffer)
|
||||
(define-key map "s" 'notmuch-show-toggle-signatures-visible)
|
||||
(define-key map "x" 'kill-this-buffer)
|
||||
|
@ -73,6 +75,30 @@ within the current window."
|
|||
(or (memq prop buffer-invisibility-spec)
|
||||
(assq prop buffer-invisibility-spec)))))
|
||||
|
||||
(defun notmuch-show-next-line ()
|
||||
"Like builtin `next-line' but ensuring we end on a visible character.
|
||||
|
||||
By advancing forward until reaching a visible character.
|
||||
|
||||
Unlike builtin `next-line' this version accepts no arguments."
|
||||
(interactive)
|
||||
(set 'this-command 'next-line)
|
||||
(call-interactively 'next-line)
|
||||
(while (point-invisible-p)
|
||||
(forward-char)))
|
||||
|
||||
(defun notmuch-show-previous-line ()
|
||||
"Like builtin `previous-line' but ensuring we end on a visible character.
|
||||
|
||||
By advancing forward until reaching a visible character.
|
||||
|
||||
Unlike builtin `next-line' this version accepts no arguments."
|
||||
(interactive)
|
||||
(set 'this-command 'previous-line)
|
||||
(call-interactively 'previous-line)
|
||||
(while (point-invisible-p)
|
||||
(forward-char)))
|
||||
|
||||
(defun notmuch-show-get-message-id ()
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
|
|
Loading…
Reference in a new issue