mirror of https://github.com/djcb/mu.git
Simplify mu4e-view-mode-map creation and fix `-` binding
`mu4e-view-mode-map` was initialized from a sparse keymap and eventually passed to `suppress-keymap` in order to remove bindings to `self-insert-command` which obviously make no sense in read-only buffers. However, `suppress-keymap` also remaps all digits and the minus sign to make prefix args, i.e., pressing 8 would be equal to `C-u 8` and `-` got bound to `negative-argument` instead of `mu4e-view-mark-for-unflag` as defined. While `suppress-keymap` has a `NODIGITS` arg to suppress the rebinding of digits and minus sign (which would also mean that pressing a digit would try inserting that digit and lead to an error), I chose the more straight-forward solution and start from an empty rather than a sparse keymap and added the `digit-argument` bindings for 0..9 explicitly.
This commit is contained in:
parent
72c623145e
commit
34fe094561
|
@ -862,21 +862,20 @@ This is useful for advising some Gnus-functionality that does not work in mu4e."
|
|||
(apply func args)))
|
||||
|
||||
(defvar mu4e-view-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(let ((map (make-keymap)))
|
||||
(define-key map (kbd "C-S-u") #'mu4e-update-mail-and-index)
|
||||
(define-key map (kbd "C-c C-u") #'mu4e-update-mail-and-index)
|
||||
|
||||
(define-key map (kbd "C-S-u") 'mu4e-update-mail-and-index)
|
||||
(define-key map (kbd "C-c C-u") 'mu4e-update-mail-and-index)
|
||||
|
||||
(define-key map "q" 'mu4e~view-quit-buffer)
|
||||
(define-key map "q" #'mu4e~view-quit-buffer)
|
||||
|
||||
;; note, 'z' is by-default bound to 'bury-buffer'
|
||||
;; but that's not very useful in this case
|
||||
(define-key map "z" 'ignore)
|
||||
(define-key map "z" #'ignore)
|
||||
|
||||
(define-key map "%" #'mu4e-view-mark-pattern)
|
||||
(define-key map "t" #'mu4e-view-mark-subthread)
|
||||
(define-key map "T" #'mu4e-view-mark-thread)
|
||||
(define-key map "j" 'mu4e~headers-jump-to-maildir)
|
||||
(define-key map "j" #'mu4e~headers-jump-to-maildir)
|
||||
|
||||
(define-key map "g" #'mu4e-view-go-to-url)
|
||||
(define-key map "k" #'mu4e-view-save-url)
|
||||
|
@ -1012,12 +1011,18 @@ This is useful for advising some Gnus-functionality that does not work in mu4e."
|
|||
(define-key menumap [next] '("Next" . mu4e-view-headers-next))
|
||||
(define-key menumap [previous] '("Previous" . mu4e-view-headers-prev)))
|
||||
|
||||
;; Make 0..9 shortcuts for digit-argument. Actually, none of the bound
|
||||
;; functions seem to use a prefix arg but those bindings existed because we
|
||||
;; used to use `suppress-keymap'. And possibly users added their own
|
||||
;; prefix arg consuming commands.
|
||||
(dotimes (i 10)
|
||||
(define-key map (kbd (format "%d" i)) #'digit-argument))
|
||||
|
||||
(set-keymap-parent map special-mode-map)
|
||||
map)
|
||||
"Keymap for mu4e-view mode.")
|
||||
|
||||
(set-keymap-parent mu4e-view-mode-map button-buffer-map)
|
||||
(suppress-keymap mu4e-view-mode-map)
|
||||
|
||||
(defcustom mu4e-view-mode-hook nil
|
||||
"Hook run when entering Mu4e-View mode."
|
||||
|
|
Loading…
Reference in New Issue