mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 21:54:10 +01:00
notmuch.el: Start implementing the magic space bar.
Currently this will either advance by screenfuls, or to the next message if it's already within a screenful, and will mark each message read as it is left. It doesn't yet complete the magic by archiving the messages nor by advancing to the next thread in the search.
This commit is contained in:
parent
c8382b2f0e
commit
aab9b5cf47
1 changed files with 32 additions and 1 deletions
33
notmuch.el
33
notmuch.el
|
@ -39,6 +39,7 @@
|
||||||
(define-key map "x" 'kill-this-buffer)
|
(define-key map "x" 'kill-this-buffer)
|
||||||
(define-key map "+" 'notmuch-show-add-tag)
|
(define-key map "+" 'notmuch-show-add-tag)
|
||||||
(define-key map "-" 'notmuch-show-remove-tag)
|
(define-key map "-" 'notmuch-show-remove-tag)
|
||||||
|
(define-key map " " 'notmuch-show-advance-marking-read)
|
||||||
map)
|
map)
|
||||||
"Keymap for \"notmuch show\" buffers.")
|
"Keymap for \"notmuch show\" buffers.")
|
||||||
(fset 'notmuch-show-mode-map notmuch-show-mode-map)
|
(fset 'notmuch-show-mode-map notmuch-show-mode-map)
|
||||||
|
@ -144,6 +145,19 @@ last message in the buffer."
|
||||||
(notmuch-show-move-to-current-message-summary-line)
|
(notmuch-show-move-to-current-message-summary-line)
|
||||||
(recenter 0))
|
(recenter 0))
|
||||||
|
|
||||||
|
(defun notmuch-show-find-next-message ()
|
||||||
|
"Returns the position of the next message in the buffer.
|
||||||
|
|
||||||
|
Or the beginning of the current message if already within the last
|
||||||
|
message in the buffer."
|
||||||
|
; 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-next-message)
|
||||||
|
(point))))
|
||||||
|
|
||||||
(defun notmuch-show-previous-message ()
|
(defun notmuch-show-previous-message ()
|
||||||
"Backup to the beginning of the previous message in the buffer.
|
"Backup to the beginning of the previous message in the buffer.
|
||||||
|
|
||||||
|
@ -162,12 +176,29 @@ simply move to the beginning of the current message."
|
||||||
(recenter 0)))
|
(recenter 0)))
|
||||||
|
|
||||||
(defun notmuch-show-mark-read-then-next-message ()
|
(defun notmuch-show-mark-read-then-next-message ()
|
||||||
"Remove uread tag from current message, then advance to next message."
|
"Remove unread tag from current message, then advance to next message."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (member "unread" (notmuch-show-get-tags))
|
(if (member "unread" (notmuch-show-get-tags))
|
||||||
(notmuch-show-remove-tag "unread"))
|
(notmuch-show-remove-tag "unread"))
|
||||||
(notmuch-show-next-message))
|
(notmuch-show-next-message))
|
||||||
|
|
||||||
|
(defun notmuch-show-advance-marking-read ()
|
||||||
|
"Advance through buffer, marking messages as read.
|
||||||
|
|
||||||
|
This command is intended to be one of the simplest ways to
|
||||||
|
process a thread of email. It does the following:
|
||||||
|
|
||||||
|
If the current message in the thread is not yet fully visible,
|
||||||
|
scroll by a near screenful to read more of the message.
|
||||||
|
|
||||||
|
Otherwise, (the end of the current message is already within the
|
||||||
|
current window), remove the \"unread\" tag from the current
|
||||||
|
message and advance to the next message."
|
||||||
|
(interactive)
|
||||||
|
(if (< (notmuch-show-find-next-message) (window-end))
|
||||||
|
(notmuch-show-mark-read-then-next-message)
|
||||||
|
(scroll-up nil)))
|
||||||
|
|
||||||
(defun notmuch-show-markup-citations-region (beg end)
|
(defun notmuch-show-markup-citations-region (beg end)
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
|
|
Loading…
Reference in a new issue