mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
notmuch.el: Allow for scrolling backwards through thread with DEL
Otherwise known as "Backspace" on keyboards in the real, (rather than emacs), world. This will go by screenfuls for long messages, and message by message for short messages. So it does the reverse of the magic space bar, (but without reversing any tag-changing magic that the magic space bar might have done).
This commit is contained in:
parent
988320ad74
commit
b7366f8052
1 changed files with 37 additions and 0 deletions
37
notmuch.el
37
notmuch.el
|
@ -42,6 +42,7 @@
|
|||
(define-key map "x" 'kill-this-buffer)
|
||||
(define-key map "+" 'notmuch-show-add-tag)
|
||||
(define-key map "-" 'notmuch-show-remove-tag)
|
||||
(define-key map (kbd "DEL") 'notmuch-show-rewind)
|
||||
(define-key map " " 'notmuch-show-advance-marking-read-and-archiving)
|
||||
map)
|
||||
"Keymap for \"notmuch show\" buffers.")
|
||||
|
@ -272,12 +273,48 @@ simply move to the beginning of the current message."
|
|||
))
|
||||
(recenter 0)))
|
||||
|
||||
(defun notmuch-show-find-previous-message ()
|
||||
"Returns the position of the previous message in the buffer.
|
||||
|
||||
Or the position of the beginning of the current message if point
|
||||
is originally within the message rather than at the beginning of
|
||||
it."
|
||||
; save-excursion doesn't save our window position
|
||||
; save-window-excursion doesn't save point
|
||||
; Looks like we have to use both.
|
||||
(save-excursion
|
||||
(save-window-excursion
|
||||
(notmuch-show-previous-message)
|
||||
(point))))
|
||||
|
||||
(defun notmuch-show-mark-read-then-next-unread-message ()
|
||||
"Remove unread tag from current message, then advance to next unread message."
|
||||
(interactive)
|
||||
(notmuch-show-remove-tag "unread")
|
||||
(notmuch-show-next-unread-message))
|
||||
|
||||
(defun notmuch-show-rewind ()
|
||||
"Do reverse scrolling compared to `notmuch-show-advance-marking-read-and-archiving'
|
||||
|
||||
Specifically, if the beginning of the previous email is fewer
|
||||
than `window-height' lines from the current point, move to it
|
||||
just like `notmuch-show-previous-message'.
|
||||
|
||||
Otherwise, just scroll down a screenful of the current message.
|
||||
|
||||
This command does not modify any message tags, (it does not undo
|
||||
any effects from previous calls to
|
||||
`notmuch-show-advance-marking-read-and-archiving'."
|
||||
(interactive)
|
||||
(let ((previous (notmuch-show-find-previous-message)))
|
||||
(if (> (count-lines previous (point)) (- (window-height) next-screen-context-lines))
|
||||
(progn
|
||||
(condition-case nil
|
||||
(scroll-down nil)
|
||||
((beginning-of-buffer) nil))
|
||||
(goto-char (window-start)))
|
||||
(notmuch-show-previous-message))))
|
||||
|
||||
(defun notmuch-show-advance-marking-read-and-archiving ()
|
||||
"Advance through buffer, marking read and archiving.
|
||||
|
||||
|
|
Loading…
Reference in a new issue