Improve 'emacs-news-view-mode' menus and bindings
* lisp/textmodes/emacs-news-mode.el (emacs-news-mode-map): Move non-editing commands from here... (emacs-news-common-map): ... to here. (emacs-news-view-mode): Remove hard-coded 'special-mode' bindings. (emacs-news-view-mode-map): Inherit from 'special-mode-map' and 'emacs-news-common-map' here instead. (emacs-news-mode--menu-common-1): New defconst for menu items common to 'news-mode' and 'news-view-mode'. (emacs-news-mode--menu-common-2): Second new defconst for common items. (emacs-news-mode-menu): Use them. (emacs-news-view-mode-menu): New menu, which omits the buffer editing commands. This builds on the fix for Bug#72080.
This commit is contained in:
parent
7588e1f8a9
commit
de9f9add13
1 changed files with 34 additions and 31 deletions
|
@ -47,40 +47,53 @@
|
|||
"C-c C-b" #'outline-backward-same-level
|
||||
"C-c C-n" #'outline-next-visible-heading
|
||||
"C-c C-p" #'outline-previous-visible-heading
|
||||
"C-c C-u" #'outline-up-heading)
|
||||
"C-c C-u" #'outline-up-heading
|
||||
;; `news-mode' motion commands.
|
||||
"C-c C-s" #'emacs-news-next-untagged-entry
|
||||
"C-c C-r" #'emacs-news-previous-untagged-entry
|
||||
"C-c C-g" #'emacs-news-goto-section
|
||||
"C-c C-j" #'emacs-news-find-heading
|
||||
"C-c C-e" #'emacs-news-count-untagged-entries)
|
||||
|
||||
(defvar-keymap emacs-news-mode-map
|
||||
:parent emacs-news-common-map
|
||||
"C-c C-s" #'emacs-news-next-untagged-entry
|
||||
"C-c C-r" #'emacs-news-previous-untagged-entry
|
||||
"C-x C-q" #'emacs-news-view-mode
|
||||
;; `news-mode' editing commands.
|
||||
"C-c C-t" #'emacs-news-cycle-tag
|
||||
"C-c C-d" #'emacs-news-delete-temporary-markers
|
||||
"C-c C-g" #'emacs-news-goto-section
|
||||
"C-c C-j" #'emacs-news-find-heading
|
||||
"C-c C-e" #'emacs-news-count-untagged-entries
|
||||
"C-x C-q" #'emacs-news-view-mode
|
||||
"<remap> <open-line>" #'emacs-news-open-line)
|
||||
|
||||
(defconst emacs-news-mode--menu-common-1
|
||||
'(["Next Untagged" emacs-news-next-untagged-entry :help "Go to next untagged entry"]
|
||||
["Previous Untagged" emacs-news-previous-untagged-entry :help "Go to previous untagged entry"]
|
||||
["Count Untagged" emacs-news-count-untagged-entries :help "Count the number of untagged entries"]
|
||||
"--"))
|
||||
|
||||
(defconst emacs-news-mode--menu-common-2
|
||||
'(["Goto Section" emacs-news-goto-section :help "Prompt for section and go to it"]
|
||||
["Goto Heading" emacs-news-find-heading :help "Prompt for heading and go to it"]
|
||||
"--"))
|
||||
|
||||
(easy-menu-define emacs-news-mode-menu emacs-news-mode-map
|
||||
"Menu for `emacs-news-mode'."
|
||||
'("News"
|
||||
["Next Untagged" emacs-news-next-untagged-entry :help "Go to next untagged entry"]
|
||||
["Previous Untagged" emacs-news-previous-untagged-entry :help "Go to previous untagged entry"]
|
||||
["Count Untagged" emacs-news-count-untagged-entries :help "Count the number of untagged entries"]
|
||||
`("News"
|
||||
,@emacs-news-mode--menu-common-1
|
||||
["Cycle Tag" emacs-news-cycle-tag :help "Cycle documentation tag of current entry"]
|
||||
["Delete Tags" emacs-news-delete-temporary-markers :help "Delete all documentation tags in buffer"]
|
||||
"--"
|
||||
["Goto Section" emacs-news-goto-section :help "Prompt for section and go to it"]
|
||||
["Goto Heading" emacs-news-find-heading :help "Prompt for heading and go to it"]
|
||||
"--"
|
||||
,@emacs-news-mode--menu-common-2
|
||||
["Enter View Mode" emacs-news-view-mode :help "Enter view-only mode"]))
|
||||
|
||||
(defvar emacs-news-view-mode-map
|
||||
;; This is defined this way instead of inheriting because we're
|
||||
;; deriving the mode from `special-mode' and want the keys from there.
|
||||
(let ((map (copy-keymap emacs-news-common-map)))
|
||||
(keymap-set map "C-x C-q" #'emacs-news-mode)
|
||||
map))
|
||||
(defvar-keymap emacs-news-view-mode-map
|
||||
:parent (make-composed-keymap emacs-news-common-map special-mode-map)
|
||||
"C-x C-q" #'emacs-news-mode)
|
||||
|
||||
(easy-menu-define emacs-news-view-mode-menu emacs-news-view-mode-map
|
||||
"Menu for `emacs-news-view-mode'."
|
||||
`("News"
|
||||
,@emacs-news-mode--menu-common-1
|
||||
,@emacs-news-mode--menu-common-2
|
||||
["Enter NEWS Mode" emacs-news-mode :help "Enter NEWS mode"]))
|
||||
|
||||
(defvar emacs-news-mode-font-lock-keywords
|
||||
`(("^---$" 0 'emacs-news-does-not-need-documentation)
|
||||
|
@ -111,17 +124,7 @@
|
|||
"Major mode for viewing the Emacs NEWS file."
|
||||
(setq buffer-read-only t)
|
||||
(emacs-news--buttonize)
|
||||
(button-mode)
|
||||
;; Bind useful browsing keys.
|
||||
(keymap-local-set "q" 'quit-window)
|
||||
(keymap-local-set "SPC" 'scroll-up-command)
|
||||
(keymap-local-set "S-SPC" 'scroll-down-command)
|
||||
(keymap-local-set "DEL" 'scroll-down-command)
|
||||
(keymap-local-set "?" 'describe-mode)
|
||||
(keymap-local-set "h" 'describe-mode)
|
||||
(keymap-local-set ">" 'end-of-buffer)
|
||||
(keymap-local-set "<" 'beginning-of-buffer)
|
||||
(keymap-local-set "g" 'revert-buffer))
|
||||
(button-mode))
|
||||
|
||||
(defun emacs-news--fill-paragraph (&optional justify)
|
||||
(cond
|
||||
|
|
Loading…
Add table
Reference in a new issue