Convert some textmodes menus to easy-menu-define
* lisp/textmodes/artist.el (artist-menu-map): Convert menu definition to easy-menu-define. * lisp/textmodes/conf-mode.el (conf-mode-map): * lisp/textmodes/nroff-mode.el (nroff-mode-map): Move menu definition from here... * lisp/textmodes/conf-mode.el (conf-mode-menu): * lisp/textmodes/nroff-mode.el (nroff-mode-menu): ...to here, and convert to use easy-menu-define.
This commit is contained in:
parent
d0c47652e5
commit
02f846ce9e
3 changed files with 96 additions and 109 deletions
|
@ -481,50 +481,6 @@ This variable is initialized by the `artist-make-prev-next-op-alist' function.")
|
|||
(defvar artist-arrow-point-1 nil)
|
||||
(defvar artist-arrow-point-2 nil)
|
||||
|
||||
(defvar artist-menu-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map [spray-chars]
|
||||
'(menu-item "Characters for Spray" artist-select-spray-chars
|
||||
:help "Choose characters for sprayed by the spray-can"))
|
||||
(define-key map [borders]
|
||||
'(menu-item "Draw Shape Borders" artist-toggle-borderless-shapes
|
||||
:help "Toggle whether shapes are drawn with borders"
|
||||
:button (:toggle . (not artist-borderless-shapes))))
|
||||
(define-key map [trimming]
|
||||
'(menu-item "Trim Line Endings" artist-toggle-trim-line-endings
|
||||
:help "Toggle trimming of line-endings"
|
||||
:button (:toggle . artist-trim-line-endings)))
|
||||
(define-key map [rubber-band]
|
||||
'(menu-item "Rubber-banding" artist-toggle-rubber-banding
|
||||
:help "Toggle rubber-banding"
|
||||
:button (:toggle . artist-rubber-banding)))
|
||||
(define-key map [set-erase]
|
||||
'(menu-item "Character to Erase..." artist-select-erase-char
|
||||
:help "Choose a specific character to erase"))
|
||||
(define-key map [set-line]
|
||||
'(menu-item "Character for Line..." artist-select-line-char
|
||||
:help "Choose the character to insert when drawing lines"))
|
||||
(define-key map [set-fill]
|
||||
'(menu-item "Character for Fill..." artist-select-fill-char
|
||||
:help "Choose the character to insert when filling in shapes"))
|
||||
(define-key map [artist-separator] '(menu-item "--"))
|
||||
(dolist (op '(("Vaporize" artist-select-op-vaporize-lines vaporize-lines)
|
||||
("Erase" artist-select-op-erase-rectangle erase-rect)
|
||||
("Spray-can" artist-select-op-spray-set-size spray-get-size)
|
||||
("Text" artist-select-op-text-overwrite text-ovwrt)
|
||||
("Ellipse" artist-select-op-circle circle)
|
||||
("Poly-line" artist-select-op-straight-poly-line spolyline)
|
||||
("Square" artist-select-op-square square)
|
||||
("Rectangle" artist-select-op-rectangle rectangle)
|
||||
("Line" artist-select-op-straight-line s-line)
|
||||
("Pen" artist-select-op-pen-line pen-line)))
|
||||
(define-key map (vector (nth 2 op))
|
||||
`(menu-item ,(nth 0 op)
|
||||
,(nth 1 op)
|
||||
:help ,(format "Draw using the %s style" (nth 0 op))
|
||||
:button (:radio . (eq artist-curr-go ',(nth 2 op))))))
|
||||
map))
|
||||
|
||||
(defvar artist-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(setq artist-mode-map (make-sparse-keymap))
|
||||
|
@ -577,10 +533,50 @@ This variable is initialized by the `artist-make-prev-next-op-alist' function.")
|
|||
(define-key map "\C-c\C-a\C-y" 'artist-select-op-paste)
|
||||
(define-key map "\C-c\C-af" 'artist-select-op-flood-fill)
|
||||
(define-key map "\C-c\C-a\C-b" 'artist-submit-bug-report)
|
||||
(define-key map [menu-bar artist] (cons "Artist" artist-menu-map))
|
||||
map)
|
||||
"Keymap for `artist-mode'.")
|
||||
|
||||
(easy-menu-define artist-menu-map artist-mode-map
|
||||
"Menu for `artist-mode'."
|
||||
`("Artist"
|
||||
,@(mapcar
|
||||
(lambda (op)
|
||||
`[,(nth 0 op) ,(nth 1 op)
|
||||
:help ,(format "Draw using the %s style" (nth 0 op))
|
||||
:style radio
|
||||
:selected (eq artist-curr-go ',(nth 2 op))])
|
||||
'(("Vaporize" artist-select-op-vaporize-lines vaporize-lines)
|
||||
("Erase" artist-select-op-erase-rectangle erase-rect)
|
||||
("Spray-can" artist-select-op-spray-set-size spray-get-size)
|
||||
("Text" artist-select-op-text-overwrite text-ovwrt)
|
||||
("Ellipse" artist-select-op-circle circle)
|
||||
("Poly-line" artist-select-op-straight-poly-line spolyline)
|
||||
("Square" artist-select-op-square square)
|
||||
("Rectangle" artist-select-op-rectangle rectangle)
|
||||
("Line" artist-select-op-straight-line s-line)
|
||||
("Pen" artist-select-op-pen-line pen-line)))
|
||||
"---"
|
||||
["Character for Fill..." artist-select-fill-char
|
||||
:help "Choose the character to insert when filling in shapes"]
|
||||
["Character for Line..." artist-select-line-char
|
||||
:help "Choose the character to insert when drawing lines"]
|
||||
["Character to Erase..." artist-select-erase-char
|
||||
:help "Choose a specific character to erase"]
|
||||
["Rubber-banding" artist-toggle-rubber-banding
|
||||
:help "Toggle rubber-banding"
|
||||
:style toggle
|
||||
:selected artist-rubber-banding]
|
||||
["Trim Line Endings" artist-toggle-trim-line-endings
|
||||
:help "Toggle trimming of line-endings"
|
||||
:style toggle
|
||||
:selected artist-trim-line-endings]
|
||||
["Draw Shape Borders" artist-toggle-borderless-shapes
|
||||
:help "Toggle whether shapes are drawn with borders"
|
||||
:style toggle
|
||||
:selected (not artist-borderless-shapes)]
|
||||
["Characters for Spray" artist-select-spray-chars
|
||||
:help "Choose characters for sprayed by the spray-can"]))
|
||||
|
||||
(defvar artist-replacement-table (make-vector 256 0)
|
||||
"Replacement table for `artist-replace-char'.")
|
||||
|
||||
|
|
|
@ -78,52 +78,46 @@ not align (only setting space according to `conf-assignment-space')."
|
|||
(define-key map "\C-c\"" 'conf-quote-normal)
|
||||
(define-key map "\C-c'" 'conf-quote-normal)
|
||||
(define-key map "\C-c\C-a" 'conf-align-assignments)
|
||||
(define-key map [menu-bar sh-script] (cons "Conf" menu-map))
|
||||
(define-key menu-map [conf-windows-mode]
|
||||
'(menu-item "Windows mode"
|
||||
conf-windows-mode
|
||||
:help "Conf Mode starter for Windows style Conf files"
|
||||
:button (:radio . (eq major-mode 'conf-windows-mode))))
|
||||
(define-key menu-map [conf-javaprop-mode]
|
||||
'(menu-item "Java properties mode"
|
||||
conf-javaprop-mode
|
||||
:help "Conf Mode starter for Java properties files"
|
||||
:button (:radio . (eq major-mode 'conf-javaprop-mode))))
|
||||
(define-key menu-map [conf-space-keywords]
|
||||
'(menu-item "Space keywords mode..."
|
||||
conf-space-keywords
|
||||
:help "Enter Conf Space mode using regexp KEYWORDS to match the keywords"
|
||||
:button (:radio . (eq major-mode 'conf-space-keywords))))
|
||||
(define-key menu-map [conf-ppd-mode]
|
||||
'(menu-item "PPD mode"
|
||||
conf-ppd-mode
|
||||
:help "Conf Mode starter for Adobe/CUPS PPD files"
|
||||
:button (:radio . (eq major-mode 'conf-ppd-mode))))
|
||||
(define-key menu-map [conf-colon-mode]
|
||||
'(menu-item "Colon mode"
|
||||
conf-colon-mode
|
||||
:help "Conf Mode starter for Colon files"
|
||||
:button (:radio . (eq major-mode 'conf-colon-mode))))
|
||||
(define-key menu-map [conf-unix-mode]
|
||||
'(menu-item "Unix mode"
|
||||
conf-unix-mode
|
||||
:help "Conf Mode starter for Unix style Conf files"
|
||||
:button (:radio . (eq major-mode 'conf-unix-mode))))
|
||||
(define-key menu-map [conf-xdefaults-mode]
|
||||
'(menu-item "Xdefaults mode"
|
||||
conf-xdefaults-mode
|
||||
:help "Conf Mode starter for Xdefaults files"
|
||||
:button (:radio . (eq major-mode 'conf-xdefaults-mode))))
|
||||
(define-key menu-map [c-s0] '("--"))
|
||||
(define-key menu-map [conf-quote-normal]
|
||||
'(menu-item "Set quote syntax normal" conf-quote-normal
|
||||
:help "Set the syntax of \\=' and \" to punctuation"))
|
||||
(define-key menu-map [conf-align-assignments]
|
||||
'(menu-item "Align assignments" conf-align-assignments
|
||||
:help "Align assignments"))
|
||||
map)
|
||||
"Local keymap for `conf-mode' buffers.")
|
||||
|
||||
(easy-menu-define conf-mode-menu conf-mode-map
|
||||
"Menu for `conf-mode'."
|
||||
'("Conf"
|
||||
["Align assignments" conf-align-assignments
|
||||
:help "Align assignments"]
|
||||
["Set quote syntax normal" conf-quote-normal
|
||||
:help "Set the syntax of \\=' and \" to punctuation"]
|
||||
"---"
|
||||
["Xdefaults mode" conf-xdefaults-mode
|
||||
:help "Conf Mode starter for Xdefaults files"
|
||||
:style radio
|
||||
:selected (eq major-mode 'conf-xdefaults-mode)]
|
||||
["Unix mode" conf-unix-mode
|
||||
:help "Conf Mode starter for Unix style Conf files"
|
||||
:style radio
|
||||
:selected (eq major-mode 'conf-unix-mode)]
|
||||
["Colon mode" conf-colon-mode
|
||||
:help "Conf Mode starter for Colon files"
|
||||
:style radio
|
||||
:selected (eq major-mode 'conf-colon-mode)]
|
||||
["PPD mode" conf-ppd-mode
|
||||
:help "Conf Mode starter for Adobe/CUPS PPD files"
|
||||
:style radio
|
||||
:selected (eq major-mode 'conf-ppd-mode)]
|
||||
["Space keywords mode..." conf-space-keywords
|
||||
:help "Enter Conf Space mode using regexp KEYWORDS to match the keywords"
|
||||
:style radio
|
||||
:selected (eq major-mode 'conf-space-keywords)]
|
||||
["Java properties mode" conf-javaprop-mode
|
||||
:help "Conf Mode starter for Java properties files"
|
||||
:style radio
|
||||
:selected (eq major-mode 'conf-javaprop-mode)]
|
||||
["Windows mode" conf-windows-mode
|
||||
:help "Conf Mode starter for Windows style Conf files"
|
||||
:style radio
|
||||
:selected (eq major-mode 'conf-windows-mode)]))
|
||||
|
||||
(defvar conf-mode-syntax-table
|
||||
(let ((table (make-syntax-table)))
|
||||
(modify-syntax-entry ?= "." table)
|
||||
|
|
|
@ -54,30 +54,27 @@
|
|||
(define-key map "\en" 'nroff-forward-text-line)
|
||||
(define-key map "\ep" 'nroff-backward-text-line)
|
||||
(define-key map "\C-c\C-c" 'nroff-view)
|
||||
(define-key map [menu-bar nroff-mode] (cons "Nroff" menu-map))
|
||||
(define-key menu-map [nn]
|
||||
'(menu-item "Newline" nroff-electric-newline
|
||||
:help "Insert newline for nroff mode; special if nroff-electric mode"))
|
||||
(define-key menu-map [nc]
|
||||
'(menu-item "Count text lines" nroff-count-text-lines
|
||||
:help "Count lines in region, except for nroff request lines."))
|
||||
(define-key menu-map [nf]
|
||||
'(menu-item "Forward text line" nroff-forward-text-line
|
||||
:help "Go forward one nroff text line, skipping lines of nroff requests"))
|
||||
(define-key menu-map [nb]
|
||||
'(menu-item "Backward text line" nroff-backward-text-line
|
||||
:help "Go backward one nroff text line, skipping lines of nroff requests"))
|
||||
(define-key menu-map [ne]
|
||||
'(menu-item "Electric newline mode"
|
||||
nroff-electric-mode
|
||||
:help "Auto insert closing requests if necessary"
|
||||
:button (:toggle . nroff-electric-mode)))
|
||||
(define-key menu-map [npm]
|
||||
'(menu-item "Preview as man page" nroff-view
|
||||
:help "Run man on this file."))
|
||||
map)
|
||||
"Major mode keymap for `nroff-mode'.")
|
||||
|
||||
(easy-menu-define nroff-mode-menu nroff-mode-map
|
||||
"Menu for `nroff-mode'."
|
||||
'("Nroff"
|
||||
["Preview as man page" nroff-view
|
||||
:help "Run man on this file."]
|
||||
["Electric newline mode" nroff-electric-mode
|
||||
:help "Auto insert closing requests if necessary"
|
||||
:style toggle
|
||||
:selected nroff-electric-mode]
|
||||
["Backward text line" nroff-backward-text-line
|
||||
:help "Go backward one nroff text line, skipping lines of nroff requests"]
|
||||
["Forward text line" nroff-forward-text-line
|
||||
:help "Go forward one nroff text line, skipping lines of nroff requests"]
|
||||
["Count text lines" nroff-count-text-lines
|
||||
:help "Count lines in region, except for nroff request lines."]
|
||||
["Newline" nroff-electric-newline
|
||||
:help "Insert newline for nroff mode; special if nroff-electric mode"]))
|
||||
|
||||
(defvar nroff-mode-syntax-table
|
||||
(let ((st (copy-syntax-table text-mode-syntax-table)))
|
||||
;; " isn't given string quote syntax in text-mode but it
|
||||
|
|
Loading…
Add table
Reference in a new issue