* make mu4e[-view]-headers-(next|prev) take a prefix argument N to jump to Nth

next or previous message. Based on a patch by Jacek Generowicz. Also, some renaming.
This commit is contained in:
djcb 2012-05-06 11:00:56 +03:00
parent 602e857dc3
commit aaeb56734d
2 changed files with 37 additions and 20 deletions

View File

@ -829,17 +829,19 @@ docid. Otherwise, return nil."
;; return the docid only if the move succeeded ;; return the docid only if the move succeeded
(when succeeded docid))) (when succeeded docid)))
(defun mu4e-headers-next () (defun mu4e-headers-next (&optional n)
"Move point to the next message header. If this succeeds, return "Move point to the next message header. If this succeeds, return
the new docid. Otherwise, return nil." the new docid. Otherwise, return nil. Optionally, takes an integer
(interactive) N (prefix argument), to the Nth next header."
(mu4e~headers-move 1)) (interactive "P")
(mu4e~headers-move (or n 1)))
(defun mu4e-headers-prev () (defun mu4e-headers-prev (&optional n)
"Move point to the previous message header. If this succeeds, "Move point to the previous message header. If this succeeds, return
return the new docid. Otherwise, return nil." the new docid. Otherwise, return nil. Optionally, takes an integer
(interactive) N (prefix argument), to the Nth previous header."
(mu4e~headers-move -1)) (interactive "P")
(mu4e~headers-move (- (or n 1))))
(defun mu4e~headers-jump-to-maildir (maildir search-all) (defun mu4e~headers-jump-to-maildir (maildir search-all)
"Show the messages in maildir (user is prompted to ask what "Show the messages in maildir (user is prompted to ask what

View File

@ -344,11 +344,11 @@ is nil, and otherwise open it."
#'(lambda () (interactive) (scroll-up -1))) #'(lambda () (interactive) (scroll-up -1)))
;; navigation between messages ;; navigation between messages
(define-key map "p" 'mu4e~view-prev-header) (define-key map "p" 'mu4e-view-headers-prev)
(define-key map "n" 'mu4e~view-next-header) (define-key map "n" 'mu4e-view-headers-next)
;; the same ;; the same
(define-key map (kbd "<M-down>") 'mu4e~view-next-header) (define-key map (kbd "<M-down>") 'mu4e-view-headers-next)
(define-key map (kbd "<M-up>") 'mu4e~view-prev-header) (define-key map (kbd "<M-up>") 'mu4e-view-headers-prev)
;; switching to view mode (if it's visible) ;; switching to view mode (if it's visible)
(define-key map "y" 'mu4e-select-other-view) (define-key map "y" 'mu4e-select-other-view)
@ -428,8 +428,8 @@ is nil, and otherwise open it."
(define-key menumap [jump] '("Jump to maildir" . mu4e~headers-jump-to-maildir)) (define-key menumap [jump] '("Jump to maildir" . mu4e~headers-jump-to-maildir))
(define-key menumap [sepa4] '("--")) (define-key menumap [sepa4] '("--"))
(define-key menumap [next] '("Next" . mu4e~view-next-header)) (define-key menumap [next] '("Next" . mu4e-view-headers-next))
(define-key menumap [previous] '("Previous" . mu4e~view-prev-header))) (define-key menumap [previous] '("Previous" . mu4e-view-headers-prev)))
map))) map)))
(fset 'mu4e-view-mode-map mu4e-view-mode-map) (fset 'mu4e-view-mode-map mu4e-view-mode-map)
@ -580,8 +580,23 @@ docid. Otherwise, return nil."
(with-current-buffer mu4e~view-headers-buffer (with-current-buffer mu4e~view-headers-buffer
(mu4e~headers-move lines)))) (mu4e~headers-move lines))))
(defun mu4e~view-next-header()(interactive)(mu4e~view-headers-move 1)) (defun mu4e-view-headers-next(&optional n)
(defun mu4e~view-prev-header()(interactive)(mu4e~view-headers-move -1)) "Move point to the next message header in the headers buffer
connected with this message view. If this succeeds, return the new
docid. Otherwise, return nil. Optionally, takes an integer
N (prefix argument), to the Nth next header."
(interactive "P")
(mu4e~view-headers-move (or n 1)))
(defun mu4e-view-headers-prev(&optional n)
"Move point to the previous message header in the headers buffer
connected with this message view. If this succeeds, return the new
docid. Otherwise, return nil. Optionally, takes an integer
N (prefix argument), to the Nth previous header."
(interactive "P")
(mu4e~view-headers-move (- (or n 1))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -832,19 +847,19 @@ user that unmarking only works in the header list."
"Mark the current message for moving." "Mark the current message for moving."
(interactive) (interactive)
(mu4e~view-mark-set 'move) (mu4e~view-mark-set 'move)
(mu4e~view-next-header)) (mu4e-view-headers-next))
(defun mu4e-view-mark-for-trash () (defun mu4e-view-mark-for-trash ()
"Mark the current message for moving to the trash folder." "Mark the current message for moving to the trash folder."
(interactive) (interactive)
(mu4e~view-mark-set 'trash) (mu4e~view-mark-set 'trash)
(mu4e~view-next-header)) (mu4e-view-headers-next))
(defun mu4e-view-mark-for-delete () (defun mu4e-view-mark-for-delete ()
"Mark the current message for deletion." "Mark the current message for deletion."
(interactive) (interactive)
(mu4e~view-mark-set 'delete) (mu4e~view-mark-set 'delete)
(mu4e~view-next-header)) (mu4e-view-headers-next))
(defun mu4e-view-marked-execute () (defun mu4e-view-marked-execute ()
"If we're in split-view, execute the marks. Otherwise, warn user "If we're in split-view, execute the marks. Otherwise, warn user