diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2018-06-12 17:06:32 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2018-06-12 17:06:32 -0400 |
commit | 97b78542f60d1079a8407da5e1974d064951fb3d (patch) | |
tree | 72415feec8d4b7b2b1b5c84708adf1533329c9de /lisp/textmodes/ispell.el | |
parent | d93ba8ddeb30bca74b306b6e768f6d20416e1802 (diff) | |
download | emacs-97b78542f60d1079a8407da5e1974d064951fb3d.tar.gz |
* lisp/textmodes/ispell.el (ispell-menu-map): Init in declaration
(ispell-menu-map-needed): Remove, now that the menu doesn't include
the list of dictionaries any more, so it's basically constant.
Diffstat (limited to 'lisp/textmodes/ispell.el')
-rw-r--r-- | lisp/textmodes/ispell.el | 152 |
1 files changed, 70 insertions, 82 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index cda76407f80..d1d47718f9d 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -817,16 +817,6 @@ See `ispell-buffer-with-debug' for an example of use." ;; because otherwise this file gets autoloaded every time Emacs starts ;; so that it can set up the menus and determine keyboard equivalents. -;;;###autoload -(defvar ispell-menu-map nil "Key map for ispell menu.") -;; Redo menu when loading ispell to get dictionary modifications -(setq ispell-menu-map nil) - -;;; Set up dictionary -;;;###autoload -(defvar ispell-menu-map-needed - (unless ispell-menu-map 'reload)) - (defvar ispell-library-directory (condition-case () (ispell-check-version) (error nil)) @@ -1417,80 +1407,78 @@ The variable `ispell-library-directory' defines their location." (push name dict-list))) dict-list)) -;; Define commands in menu in opposite order you want them to appear. -;;;###autoload -(if ispell-menu-map-needed - (progn - (setq ispell-menu-map (make-sparse-keymap "Spell")) - (define-key ispell-menu-map [ispell-change-dictionary] - `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary - :help ,(purecopy "Supply explicit dictionary file name"))) - (define-key ispell-menu-map [ispell-kill-ispell] - `(menu-item ,(purecopy "Kill Process") - (lambda () (interactive) (ispell-kill-ispell nil 'clear)) - :enable (and (boundp 'ispell-process) ispell-process - (eq (ispell-process-status) 'run)) - :help ,(purecopy "Terminate Ispell subprocess"))) - (define-key ispell-menu-map [ispell-pdict-save] - `(menu-item ,(purecopy "Save Dictionary") - (lambda () (interactive) (ispell-pdict-save t t)) - :help ,(purecopy "Save personal dictionary"))) - (define-key ispell-menu-map [ispell-customize] - `(menu-item ,(purecopy "Customize...") - (lambda () (interactive) (customize-group 'ispell)) - :help ,(purecopy "Customize spell checking options"))) - (define-key ispell-menu-map [ispell-help] - ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ? - `(menu-item ,(purecopy "Help") - (lambda () (interactive) (describe-function 'ispell-help)) - :help ,(purecopy "Show standard Ispell keybindings and commands"))) - (define-key ispell-menu-map [flyspell-mode] - `(menu-item ,(purecopy "Automatic spell checking (Flyspell)") - flyspell-mode - :help ,(purecopy "Check spelling while you edit the text") - :button (:toggle . (bound-and-true-p flyspell-mode)))) - (define-key ispell-menu-map [ispell-complete-word] - `(menu-item ,(purecopy "Complete Word") ispell-complete-word - :help ,(purecopy "Complete word at cursor using dictionary"))) - (define-key ispell-menu-map [ispell-complete-word-interior-frag] - `(menu-item ,(purecopy "Complete Word Fragment") - ispell-complete-word-interior-frag - :help ,(purecopy "Complete word fragment at cursor"))))) - ;;;###autoload -(if ispell-menu-map-needed - (progn - (define-key ispell-menu-map [ispell-continue] - `(menu-item ,(purecopy "Continue Spell-Checking") ispell-continue - :enable (and (boundp 'ispell-region-end) - (marker-position ispell-region-end) - (equal (marker-buffer ispell-region-end) - (current-buffer))) - :help ,(purecopy "Continue spell checking last region"))) - (define-key ispell-menu-map [ispell-word] - `(menu-item ,(purecopy "Spell-Check Word") ispell-word - :help ,(purecopy "Spell-check word at cursor"))) - (define-key ispell-menu-map [ispell-comments-and-strings] - `(menu-item ,(purecopy "Spell-Check Comments") - ispell-comments-and-strings - :help ,(purecopy "Spell-check only comments and strings"))))) - +(defconst ispell-menu-map + ;; Use `defconst' so as to redo the menu when loading ispell, like the + ;; previous code did. + + ;; Define commands in menu in opposite order you want them to appear. + (let ((map (make-sparse-keymap "Spell"))) + (define-key map [ispell-change-dictionary] + `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary + :help ,(purecopy "Supply explicit dictionary file name"))) + (define-key map [ispell-kill-ispell] + `(menu-item ,(purecopy "Kill Process") + (lambda () (interactive) (ispell-kill-ispell nil 'clear)) + :enable (and (boundp 'ispell-process) ispell-process + (eq (ispell-process-status) 'run)) + :help ,(purecopy "Terminate Ispell subprocess"))) + (define-key map [ispell-pdict-save] + `(menu-item ,(purecopy "Save Dictionary") + (lambda () (interactive) (ispell-pdict-save t t)) + :help ,(purecopy "Save personal dictionary"))) + (define-key map [ispell-customize] + `(menu-item ,(purecopy "Customize...") + (lambda () (interactive) (customize-group 'ispell)) + :help ,(purecopy "Customize spell checking options"))) + (define-key map [ispell-help] + ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ? + `(menu-item ,(purecopy "Help") + (lambda () (interactive) (describe-function 'ispell-help)) + :help ,(purecopy "Show standard Ispell keybindings and commands"))) + (define-key map [flyspell-mode] + `(menu-item ,(purecopy "Automatic spell checking (Flyspell)") + flyspell-mode + :help ,(purecopy "Check spelling while you edit the text") + :button (:toggle . (bound-and-true-p flyspell-mode)))) + (define-key map [ispell-complete-word] + `(menu-item ,(purecopy "Complete Word") ispell-complete-word + :help ,(purecopy "Complete word at cursor using dictionary"))) + (define-key map [ispell-complete-word-interior-frag] + `(menu-item ,(purecopy "Complete Word Fragment") + ispell-complete-word-interior-frag + :help ,(purecopy "Complete word fragment at cursor"))) + + (define-key map [ispell-continue] + `(menu-item ,(purecopy "Continue Spell-Checking") ispell-continue + :enable (and (boundp 'ispell-region-end) + (marker-position ispell-region-end) + (equal (marker-buffer ispell-region-end) + (current-buffer))) + :help ,(purecopy "Continue spell checking last region"))) + (define-key map [ispell-word] + `(menu-item ,(purecopy "Spell-Check Word") ispell-word + :help ,(purecopy "Spell-check word at cursor"))) + (define-key map [ispell-comments-and-strings] + `(menu-item ,(purecopy "Spell-Check Comments") + ispell-comments-and-strings + :help ,(purecopy "Spell-check only comments and strings"))) + + (define-key map [ispell-region] + `(menu-item ,(purecopy "Spell-Check Region") ispell-region + :enable mark-active + :help ,(purecopy "Spell-check text in marked region"))) + (define-key map [ispell-message] + `(menu-item ,(purecopy "Spell-Check Message") ispell-message + :visible (eq major-mode 'mail-mode) + :help ,(purecopy "Skip headers and included message text"))) + (define-key map [ispell-buffer] + `(menu-item ,(purecopy "Spell-Check Buffer") ispell-buffer + :help ,(purecopy "Check spelling of selected buffer"))) + map) + "Key map for ispell menu.") ;;;###autoload -(if ispell-menu-map-needed - (progn - (define-key ispell-menu-map [ispell-region] - `(menu-item ,(purecopy "Spell-Check Region") ispell-region - :enable mark-active - :help ,(purecopy "Spell-check text in marked region"))) - (define-key ispell-menu-map [ispell-message] - `(menu-item ,(purecopy "Spell-Check Message") ispell-message - :visible (eq major-mode 'mail-mode) - :help ,(purecopy "Skip headers and included message text"))) - (define-key ispell-menu-map [ispell-buffer] - `(menu-item ,(purecopy "Spell-Check Buffer") ispell-buffer - :help ,(purecopy "Check spelling of selected buffer"))) - (fset 'ispell-menu-map (symbol-value 'ispell-menu-map)))) - +(fset 'ispell-menu-map (symbol-value 'ispell-menu-map)) ;;; ********************************************************************** |