1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

Convert some more menus to easy-menu-define

* lisp/tar-mode.el (tar-mode-map):
* lisp/textmodes/sgml-mode.el (sgml-mode-map, html-mode-map):
* lisp/wdired.el (wdired-mode-map): Move menus from here...

* lisp/tar-mode.el (tar-mode-immediate-menu, tar-mode-mark-menu)
* lisp/textmodes/sgml-mode.el (sgml-mode-menu, html-mode-menu):
* lisp/wdired.el (wdired-mode-menu): ...to here, and convert to
easy-menu-define.
This commit is contained in:
Stefan Kangas 2021-02-23 03:51:12 +01:00
parent 9202106a99
commit b03d9d2c13
3 changed files with 78 additions and 102 deletions

View File

@ -635,54 +635,38 @@ For instance, if mode is #o700, then it produces `rwx------'."
;; Let mouse-1 follow the link.
(define-key map [follow-link] 'mouse-face)
;; Make menu bar items.
;; Get rid of the Edit menu bar item to save space.
(define-key map [menu-bar edit] 'undefined)
(define-key map [menu-bar immediate]
(cons "Immediate" (make-sparse-keymap "Immediate")))
(define-key map [menu-bar immediate woman]
'("Read Man Page (WoMan)" . woman-tar-extract-file))
(define-key map [menu-bar immediate view]
'("View This File" . tar-view))
(define-key map [menu-bar immediate display]
'("Display in Other Window" . tar-display-other-window))
(define-key map [menu-bar immediate find-file-other-window]
'("Find in Other Window" . tar-extract-other-window))
(define-key map [menu-bar immediate find-file]
'("Find This File" . tar-extract))
(define-key map [menu-bar mark]
(cons "Mark" (make-sparse-keymap "Mark")))
(define-key map [menu-bar mark unmark-all]
'("Unmark All" . tar-clear-modification-flags))
(define-key map [menu-bar mark deletion]
'("Flag" . tar-flag-deleted))
(define-key map [menu-bar mark unmark]
'("Unflag" . tar-unflag))
(define-key map [menu-bar operate]
(cons "Operate" (make-sparse-keymap "Operate")))
(define-key map [menu-bar operate chown]
'("Change Owner..." . tar-chown-entry))
(define-key map [menu-bar operate chgrp]
'("Change Group..." . tar-chgrp-entry))
(define-key map [menu-bar operate chmod]
'("Change Mode..." . tar-chmod-entry))
(define-key map [menu-bar operate rename]
'("Rename to..." . tar-rename-entry))
(define-key map [menu-bar operate copy]
'("Copy to..." . tar-copy))
(define-key map [menu-bar operate expunge]
'("Expunge Marked Files" . tar-expunge))
map)
"Local keymap for Tar mode listings.")
(easy-menu-define tar-mode-immediate-menu tar-mode-map
"Immediate menu for Tar mode."
'("Immediate"
["Find This File" tar-extract]
["Find in Other Window" tar-extract-other-window]
["Display in Other Window" tar-display-other-window]
["View This File" tar-view]
["Read Man Page (WoMan)" woman-tar-extract-file]))
(easy-menu-define tar-mode-mark-menu tar-mode-map
"Mark menu for Tar mode."
'("Mark"
["Unflag" tar-unflag]
["Flag" tar-flag-deleted]
["Unmark All" tar-clear-modification-flags]))
(easy-menu-define tar-mode-operate-menu tar-mode-map
"Operate menu for Tar mode."
'("Operate"
["Expunge Marked Files" tar-expunge]
["Copy to..." tar-copy]
["Rename to..." tar-rename-entry]
["Change Mode..." tar-chmod-entry]
["Change Group..." tar-chgrp-entry]
["Change Owner..." tar-chown-entry]))
;; tar mode is suitable only for specially formatted data.
(put 'tar-mode 'mode-class 'special)

View File

@ -117,8 +117,7 @@ definitions. So we normally turn it off.")
This takes effect when first loading the `sgml-mode' library.")
(defvar sgml-mode-map
(let ((map (make-keymap)) ;`sparse' doesn't allow binding to charsets.
(menu-map (make-sparse-keymap "SGML")))
(let ((map (make-keymap))) ;`sparse' doesn't allow binding to charsets.
(define-key map "\C-c\C-i" 'sgml-tags-invisible)
(define-key map "/" 'sgml-slash)
(define-key map "\C-c\C-n" 'sgml-name-char)
@ -153,26 +152,24 @@ This takes effect when first loading the `sgml-mode' library.")
(map (nth 1 map)))
(while (< (setq c (1+ c)) 256)
(aset map c 'sgml-maybe-name-self)))
(define-key map [menu-bar sgml] (cons "SGML" menu-map))
(define-key menu-map [sgml-validate] '("Validate" . sgml-validate))
(define-key menu-map [sgml-name-8bit-mode]
'("Toggle 8 Bit Insertion" . sgml-name-8bit-mode))
(define-key menu-map [sgml-tags-invisible]
'("Toggle Tag Visibility" . sgml-tags-invisible))
(define-key menu-map [sgml-tag-help]
'("Describe Tag" . sgml-tag-help))
(define-key menu-map [sgml-delete-tag]
'("Delete Tag" . sgml-delete-tag))
(define-key menu-map [sgml-skip-tag-forward]
'("Forward Tag" . sgml-skip-tag-forward))
(define-key menu-map [sgml-skip-tag-backward]
'("Backward Tag" . sgml-skip-tag-backward))
(define-key menu-map [sgml-attributes]
'("Insert Attributes" . sgml-attributes))
(define-key menu-map [sgml-tag] '("Insert Tag" . sgml-tag))
map)
"Keymap for SGML mode. See also `sgml-specials'.")
(easy-menu-define sgml-mode-menu sgml-mode-map
"Menu for SGML mode."
'("SGML"
["Insert Tag" sgml-tag]
["Insert Attributes" sgml-attributes]
["Backward Tag" sgml-skip-tag-backward]
["Forward Tag" sgml-skip-tag-forward]
["Delete Tag" sgml-delete-tag]
["Describe Tag" sgml-tag-help]
"---"
["Toggle Tag Visibility" sgml-tags-invisible]
["Toggle 8 Bit Insertion" sgml-name-8bit-mode]
"---"
["Validate" sgml-validate]))
(defun sgml-make-syntax-table (specials)
(let ((table (make-syntax-table text-mode-syntax-table)))
(modify-syntax-entry ?< "(>" table)
@ -1788,8 +1785,7 @@ This defaults to `sgml-quick-keys'.
This takes effect when first loading the library.")
(defvar html-mode-map
(let ((map (make-sparse-keymap))
(menu-map (make-sparse-keymap "HTML")))
(let ((map (make-sparse-keymap)))
(set-keymap-parent map sgml-mode-map)
(define-key map "\C-c6" 'html-headline-6)
(define-key map "\C-c5" 'html-headline-5)
@ -1826,34 +1822,35 @@ This takes effect when first loading the library.")
(define-key map "\C-cs" 'html-span))
(define-key map "\C-c\C-s" 'html-autoview-mode)
(define-key map "\C-c\C-v" 'browse-url-of-buffer)
(define-key map [menu-bar html] (cons "HTML" menu-map))
(define-key menu-map [html-autoview-mode]
'("Toggle Autoviewing" . html-autoview-mode))
(define-key menu-map [browse-url-of-buffer]
'("View Buffer Contents" . browse-url-of-buffer))
(define-key menu-map [nil] '("--"))
;;(define-key menu-map "6" '("Heading 6" . html-headline-6))
;;(define-key menu-map "5" '("Heading 5" . html-headline-5))
;;(define-key menu-map "4" '("Heading 4" . html-headline-4))
(define-key menu-map "3" '("Heading 3" . html-headline-3))
(define-key menu-map "2" '("Heading 2" . html-headline-2))
(define-key menu-map "1" '("Heading 1" . html-headline-1))
(define-key menu-map "l" '("Radio Buttons" . html-radio-buttons))
(define-key menu-map "c" '("Checkboxes" . html-checkboxes))
(define-key menu-map "l" '("List Item" . html-list-item))
(define-key menu-map "u" '("Unordered List" . html-unordered-list))
(define-key menu-map "o" '("Ordered List" . html-ordered-list))
(define-key menu-map "-" '("Horizontal Rule" . html-horizontal-rule))
(define-key menu-map "\n" '("Line Break" . html-line))
(define-key menu-map "\r" '("Paragraph" . html-paragraph))
(define-key menu-map "i" '("Image" . html-image))
(define-key menu-map "h" '("Href Anchor URL" . html-href-anchor))
(define-key menu-map "f" '("Href Anchor File" . html-href-anchor-file))
(define-key menu-map "n" '("Name Anchor" . html-name-anchor))
(define-key menu-map "#" '("ID Anchor" . html-id-anchor))
map)
"Keymap for commands for use in HTML mode.")
(easy-menu-define html-mode-menu html-mode-map
"Menu for HTML mode."
'("HTML"
["ID Anchor" html-id-anchor]
["Name Anchor" html-name-anchor]
["Href Anchor File" html-href-anchor-file]
["Href Anchor URL" html-href-anchor]
["Image" html-image]
["Paragraph" html-paragraph]
["Line Break" html-line]
["Horizontal Rule" html-horizontal-rule]
["Ordered List" html-ordered-list]
["Unordered List" html-unordered-list]
["List Item" html-list-item]
["Checkboxes" html-checkboxes]
["Radio Buttons" html-radio-buttons]
["Heading 1" html-headline-1]
["Heading 2" html-headline-2]
["Heading 3" html-headline-3]
;; ["Heading 4" html-headline-4]
;; ["Heading 5" html-headline-5]
;; ["Heading 6" html-headline-6]
"---"
["View Buffer Contents" browse-url-of-buffer]
["Toggle Autoviewing" html-autoview-mode]))
(defvar html-face-tag-alist
'((bold . "strong")
(italic . "em")

View File

@ -176,26 +176,21 @@ nonexistent directory will fail."
(define-key map "\C-p" 'wdired-previous-line)
(define-key map [down] 'wdired-next-line)
(define-key map "\C-n" 'wdired-next-line)
(define-key map [menu-bar wdired]
(cons "WDired" (make-sparse-keymap "WDired")))
(define-key map [menu-bar wdired wdired-customize]
'("Options" . wdired-customize))
(define-key map [menu-bar wdired dashes]
'("--"))
(define-key map [menu-bar wdired wdired-abort-changes]
'(menu-item "Abort Changes" wdired-abort-changes
:help "Abort changes and return to dired mode"))
(define-key map [menu-bar wdired wdired-finish-edit]
'("Commit Changes" . wdired-finish-edit))
(define-key map [remap upcase-word] 'wdired-upcase-word)
(define-key map [remap capitalize-word] 'wdired-capitalize-word)
(define-key map [remap downcase-word] 'wdired-downcase-word)
map)
"Keymap used in `wdired-mode'.")
(easy-menu-define wdired-mode-menu wdired-mode-map
"Menu for `wdired-mode'."
'("WDired"
["Commit Changes" wdired-finish-edit]
["Abort Changes" wdired-abort-changes
:help "Abort changes and return to Dired mode"]
"---"
["Options" wdired-customize]))
(defvar wdired-mode-hook nil
"Hooks run when changing to WDired mode.")