mirror of https://github.com/djcb/mu.git
mu4e-view-gnus: cleanup keymap
Do not derive the keymap from gnus article mode, so we don't get the unwanted menu entries, and don't need to disable things manually.
This commit is contained in:
parent
9423212fa0
commit
44d801e2b0
|
@ -161,10 +161,14 @@ with no charset."
|
|||
(list handle attendee))
|
||||
handle-attendee))
|
||||
|
||||
(defvar mu4e-view-mode-map nil
|
||||
"Keymap for \"*mu4e-view*\" buffers.")
|
||||
(unless mu4e-view-mode-map
|
||||
(setq mu4e-view-mode-map
|
||||
;; We must neuter gnus-set-mode-line
|
||||
(defun mu4e~view-nop (func &rest args)
|
||||
"Do nothing."
|
||||
;;(message "NOP %S %S %S %S" mu4e~view-mode major-mode func args)
|
||||
(unless (derived-mode-p '(mu4e-view-mode))
|
||||
(apply func args)))
|
||||
|
||||
(defvar mu4e-view-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
|
||||
(define-key map (kbd "C-S-u") 'mu4e-update-mail-and-index)
|
||||
|
@ -200,18 +204,6 @@ with no charset."
|
|||
(define-key map "C" 'mu4e-compose-new)
|
||||
(define-key map "E" 'mu4e-compose-edit)
|
||||
|
||||
;; some gnus things we do not support
|
||||
(define-key map "G" 'ignore)
|
||||
(define-key map "I" 'ignore)
|
||||
(define-key map "J" 'ignore)
|
||||
(define-key map "K" 'ignore)
|
||||
(define-key map "L" 'ignore)
|
||||
(define-key map "N" 'ignore)
|
||||
(define-key map "V" 'ignore)
|
||||
(define-key map "X" 'ignore)
|
||||
(define-key map "Y" 'ignore)
|
||||
(define-key map "Z" 'ignore)
|
||||
|
||||
(define-key map "." 'mu4e-view-raw-message)
|
||||
(define-key map "|" 'mu4e-view-pipe)
|
||||
(define-key map "a" 'mu4e-view-action)
|
||||
|
@ -257,8 +249,6 @@ with no charset."
|
|||
|
||||
;; attachments
|
||||
(define-key map "e" 'mu4e-view-save-attachment)
|
||||
(define-key map "o" 'ignore)
|
||||
(define-key map "A" 'ignore)
|
||||
|
||||
;; marking/unmarking
|
||||
(define-key map "d" 'mu4e-view-mark-for-trash)
|
||||
|
@ -285,8 +275,6 @@ with no charset."
|
|||
|
||||
;; misc
|
||||
(define-key map "w" 'visual-line-mode)
|
||||
(define-key map "#" 'ignore)
|
||||
(define-key map "h" 'ignore)
|
||||
(define-key map (kbd "M-q") 'article-fill-long-lines)
|
||||
|
||||
;; next 3 only warn user when attempt in the message view
|
||||
|
@ -347,9 +335,10 @@ with no charset."
|
|||
(define-key menumap [sepa4] '("--"))
|
||||
(define-key menumap [next] '("Next" . mu4e-view-headers-next))
|
||||
(define-key menumap [previous] '("Previous" . mu4e-view-headers-prev)))
|
||||
map))
|
||||
|
||||
(fset 'mu4e-view-mode-map mu4e-view-mode-map))
|
||||
(set-keymap-parent map special-mode-map)
|
||||
map)
|
||||
"Keymap for mu4e-view mode")
|
||||
|
||||
(defcustom mu4e-view-mode-hook nil
|
||||
"Hook run when entering Mu4e-View mode."
|
||||
|
@ -373,14 +362,12 @@ with no charset."
|
|||
(define-derived-mode mu4e-view-mode gnus-article-mode "mu4e:view"
|
||||
"Major mode for viewing an e-mail message in mu4e, based on
|
||||
Gnus' article-mode."
|
||||
;; remove some gnus stuff that does not apply
|
||||
(define-key mu4e-view-mode-map [menu-bar Treatment] nil)
|
||||
(define-key mu4e-view-mode-map [menu-bar Article] nil)
|
||||
(define-key mu4e-view-mode-map [menu-bar post] nil)
|
||||
(define-key mu4e-view-mode-map [menu-bar commands] nil)
|
||||
;; Restore C-h b default behavior
|
||||
(define-key mu4e-view-mode-map (kbd "C-h b") 'describe-bindings)
|
||||
(setq mu4e~view-buffer-name gnus-article-buffer)
|
||||
;; ;; turn off gnus modeline changes and menu items
|
||||
(when (fboundp 'gnus-set-mode-line)
|
||||
(advice-add 'gnus-set-mode-line :around #'mu4e~view-nop))
|
||||
(mu4e~view-mode-body))
|
||||
|
||||
(defun mu4e-view-message-text (msg)
|
||||
|
@ -444,7 +431,10 @@ attachments is done with `completing-read-multiple', in this case use
|
|||
do (mm-save-part-to-file h (expand-file-name f dir))))
|
||||
(message "No attached files found"))))
|
||||
|
||||
;;; Various commands
|
||||
;;; Actions
|
||||
|
||||
|
||||
|
||||
|
||||
;;;
|
||||
(provide 'mu4e-view-gnus)
|
||||
|
|
Loading…
Reference in New Issue