diff options
| author | Stefan Monnier | 2018-06-12 17:06:32 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2018-06-12 17:06:32 -0400 |
| commit | 97b78542f60d1079a8407da5e1974d064951fb3d (patch) | |
| tree | 72415feec8d4b7b2b1b5c84708adf1533329c9de | |
| parent | d93ba8ddeb30bca74b306b6e768f6d20416e1802 (diff) | |
| download | emacs-97b78542f60d1079a8407da5e1974d064951fb3d.tar.gz emacs-97b78542f60d1079a8407da5e1974d064951fb3d.zip | |
* 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.
| -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." | |||
| 817 | ;; because otherwise this file gets autoloaded every time Emacs starts | 817 | ;; because otherwise this file gets autoloaded every time Emacs starts |
| 818 | ;; so that it can set up the menus and determine keyboard equivalents. | 818 | ;; so that it can set up the menus and determine keyboard equivalents. |
| 819 | 819 | ||
| 820 | ;;;###autoload | ||
| 821 | (defvar ispell-menu-map nil "Key map for ispell menu.") | ||
| 822 | ;; Redo menu when loading ispell to get dictionary modifications | ||
| 823 | (setq ispell-menu-map nil) | ||
| 824 | |||
| 825 | ;;; Set up dictionary | ||
| 826 | ;;;###autoload | ||
| 827 | (defvar ispell-menu-map-needed | ||
| 828 | (unless ispell-menu-map 'reload)) | ||
| 829 | |||
| 830 | (defvar ispell-library-directory (condition-case () | 820 | (defvar ispell-library-directory (condition-case () |
| 831 | (ispell-check-version) | 821 | (ispell-check-version) |
| 832 | (error nil)) | 822 | (error nil)) |
| @@ -1417,80 +1407,78 @@ The variable `ispell-library-directory' defines their location." | |||
| 1417 | (push name dict-list))) | 1407 | (push name dict-list))) |
| 1418 | dict-list)) | 1408 | dict-list)) |
| 1419 | 1409 | ||
| 1420 | ;; Define commands in menu in opposite order you want them to appear. | ||
| 1421 | ;;;###autoload | ||
| 1422 | (if ispell-menu-map-needed | ||
| 1423 | (progn | ||
| 1424 | (setq ispell-menu-map (make-sparse-keymap "Spell")) | ||
| 1425 | (define-key ispell-menu-map [ispell-change-dictionary] | ||
| 1426 | `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary | ||
| 1427 | :help ,(purecopy "Supply explicit dictionary file name"))) | ||
| 1428 | (define-key ispell-menu-map [ispell-kill-ispell] | ||
| 1429 | `(menu-item ,(purecopy "Kill Process") | ||
| 1430 | (lambda () (interactive) (ispell-kill-ispell nil 'clear)) | ||
| 1431 | :enable (and (boundp 'ispell-process) ispell-process | ||
| 1432 | (eq (ispell-process-status) 'run)) | ||
| 1433 | :help ,(purecopy "Terminate Ispell subprocess"))) | ||
| 1434 | (define-key ispell-menu-map [ispell-pdict-save] | ||
| 1435 | `(menu-item ,(purecopy "Save Dictionary") | ||
| 1436 | (lambda () (interactive) (ispell-pdict-save t t)) | ||
| 1437 | :help ,(purecopy "Save personal dictionary"))) | ||
| 1438 | (define-key ispell-menu-map [ispell-customize] | ||
| 1439 | `(menu-item ,(purecopy "Customize...") | ||
| 1440 | (lambda () (interactive) (customize-group 'ispell)) | ||
| 1441 | :help ,(purecopy "Customize spell checking options"))) | ||
| 1442 | (define-key ispell-menu-map [ispell-help] | ||
| 1443 | ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ? | ||
| 1444 | `(menu-item ,(purecopy "Help") | ||
| 1445 | (lambda () (interactive) (describe-function 'ispell-help)) | ||
| 1446 | :help ,(purecopy "Show standard Ispell keybindings and commands"))) | ||
| 1447 | (define-key ispell-menu-map [flyspell-mode] | ||
| 1448 | `(menu-item ,(purecopy "Automatic spell checking (Flyspell)") | ||
| 1449 | flyspell-mode | ||
| 1450 | :help ,(purecopy "Check spelling while you edit the text") | ||
| 1451 | :button (:toggle . (bound-and-true-p flyspell-mode)))) | ||
| 1452 | (define-key ispell-menu-map [ispell-complete-word] | ||
| 1453 | `(menu-item ,(purecopy "Complete Word") ispell-complete-word | ||
| 1454 | :help ,(purecopy "Complete word at cursor using dictionary"))) | ||
| 1455 | (define-key ispell-menu-map [ispell-complete-word-interior-frag] | ||
| 1456 | `(menu-item ,(purecopy "Complete Word Fragment") | ||
| 1457 | ispell-complete-word-interior-frag | ||
| 1458 | :help ,(purecopy "Complete word fragment at cursor"))))) | ||
| 1459 | |||
| 1460 | ;;;###autoload | 1410 | ;;;###autoload |
| 1461 | (if ispell-menu-map-needed | 1411 | (defconst ispell-menu-map |
| 1462 | (progn | 1412 | ;; Use `defconst' so as to redo the menu when loading ispell, like the |
| 1463 | (define-key ispell-menu-map [ispell-continue] | 1413 | ;; previous code did. |
| 1464 | `(menu-item ,(purecopy "Continue Spell-Checking") ispell-continue | 1414 | |
| 1465 | :enable (and (boundp 'ispell-region-end) | 1415 | ;; Define commands in menu in opposite order you want them to appear. |
| 1466 | (marker-position ispell-region-end) | 1416 | (let ((map (make-sparse-keymap "Spell"))) |
| 1467 | (equal (marker-buffer ispell-region-end) | 1417 | (define-key map [ispell-change-dictionary] |
| 1468 | (current-buffer))) | 1418 | `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary |
| 1469 | :help ,(purecopy "Continue spell checking last region"))) | 1419 | :help ,(purecopy "Supply explicit dictionary file name"))) |
| 1470 | (define-key ispell-menu-map [ispell-word] | 1420 | (define-key map [ispell-kill-ispell] |
| 1471 | `(menu-item ,(purecopy "Spell-Check Word") ispell-word | 1421 | `(menu-item ,(purecopy "Kill Process") |
| 1472 | :help ,(purecopy "Spell-check word at cursor"))) | 1422 | (lambda () (interactive) (ispell-kill-ispell nil 'clear)) |
| 1473 | (define-key ispell-menu-map [ispell-comments-and-strings] | 1423 | :enable (and (boundp 'ispell-process) ispell-process |
| 1474 | `(menu-item ,(purecopy "Spell-Check Comments") | 1424 | (eq (ispell-process-status) 'run)) |
| 1475 | ispell-comments-and-strings | 1425 | :help ,(purecopy "Terminate Ispell subprocess"))) |
| 1476 | :help ,(purecopy "Spell-check only comments and strings"))))) | 1426 | (define-key map [ispell-pdict-save] |
| 1477 | 1427 | `(menu-item ,(purecopy "Save Dictionary") | |
| 1428 | (lambda () (interactive) (ispell-pdict-save t t)) | ||
| 1429 | :help ,(purecopy "Save personal dictionary"))) | ||
| 1430 | (define-key map [ispell-customize] | ||
| 1431 | `(menu-item ,(purecopy "Customize...") | ||
| 1432 | (lambda () (interactive) (customize-group 'ispell)) | ||
| 1433 | :help ,(purecopy "Customize spell checking options"))) | ||
| 1434 | (define-key map [ispell-help] | ||
| 1435 | ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ? | ||
| 1436 | `(menu-item ,(purecopy "Help") | ||
| 1437 | (lambda () (interactive) (describe-function 'ispell-help)) | ||
| 1438 | :help ,(purecopy "Show standard Ispell keybindings and commands"))) | ||
| 1439 | (define-key map [flyspell-mode] | ||
| 1440 | `(menu-item ,(purecopy "Automatic spell checking (Flyspell)") | ||
| 1441 | flyspell-mode | ||
| 1442 | :help ,(purecopy "Check spelling while you edit the text") | ||
| 1443 | :button (:toggle . (bound-and-true-p flyspell-mode)))) | ||
| 1444 | (define-key map [ispell-complete-word] | ||
| 1445 | `(menu-item ,(purecopy "Complete Word") ispell-complete-word | ||
| 1446 | :help ,(purecopy "Complete word at cursor using dictionary"))) | ||
| 1447 | (define-key map [ispell-complete-word-interior-frag] | ||
| 1448 | `(menu-item ,(purecopy "Complete Word Fragment") | ||
| 1449 | ispell-complete-word-interior-frag | ||
| 1450 | :help ,(purecopy "Complete word fragment at cursor"))) | ||
| 1451 | |||
| 1452 | (define-key map [ispell-continue] | ||
| 1453 | `(menu-item ,(purecopy "Continue Spell-Checking") ispell-continue | ||
| 1454 | :enable (and (boundp 'ispell-region-end) | ||
| 1455 | (marker-position ispell-region-end) | ||
| 1456 | (equal (marker-buffer ispell-region-end) | ||
| 1457 | (current-buffer))) | ||
| 1458 | :help ,(purecopy "Continue spell checking last region"))) | ||
| 1459 | (define-key map [ispell-word] | ||
| 1460 | `(menu-item ,(purecopy "Spell-Check Word") ispell-word | ||
| 1461 | :help ,(purecopy "Spell-check word at cursor"))) | ||
| 1462 | (define-key map [ispell-comments-and-strings] | ||
| 1463 | `(menu-item ,(purecopy "Spell-Check Comments") | ||
| 1464 | ispell-comments-and-strings | ||
| 1465 | :help ,(purecopy "Spell-check only comments and strings"))) | ||
| 1466 | |||
| 1467 | (define-key map [ispell-region] | ||
| 1468 | `(menu-item ,(purecopy "Spell-Check Region") ispell-region | ||
| 1469 | :enable mark-active | ||
| 1470 | :help ,(purecopy "Spell-check text in marked region"))) | ||
| 1471 | (define-key map [ispell-message] | ||
| 1472 | `(menu-item ,(purecopy "Spell-Check Message") ispell-message | ||
| 1473 | :visible (eq major-mode 'mail-mode) | ||
| 1474 | :help ,(purecopy "Skip headers and included message text"))) | ||
| 1475 | (define-key map [ispell-buffer] | ||
| 1476 | `(menu-item ,(purecopy "Spell-Check Buffer") ispell-buffer | ||
| 1477 | :help ,(purecopy "Check spelling of selected buffer"))) | ||
| 1478 | map) | ||
| 1479 | "Key map for ispell menu.") | ||
| 1478 | ;;;###autoload | 1480 | ;;;###autoload |
| 1479 | (if ispell-menu-map-needed | 1481 | (fset 'ispell-menu-map (symbol-value 'ispell-menu-map)) |
| 1480 | (progn | ||
| 1481 | (define-key ispell-menu-map [ispell-region] | ||
| 1482 | `(menu-item ,(purecopy "Spell-Check Region") ispell-region | ||
| 1483 | :enable mark-active | ||
| 1484 | :help ,(purecopy "Spell-check text in marked region"))) | ||
| 1485 | (define-key ispell-menu-map [ispell-message] | ||
| 1486 | `(menu-item ,(purecopy "Spell-Check Message") ispell-message | ||
| 1487 | :visible (eq major-mode 'mail-mode) | ||
| 1488 | :help ,(purecopy "Skip headers and included message text"))) | ||
| 1489 | (define-key ispell-menu-map [ispell-buffer] | ||
| 1490 | `(menu-item ,(purecopy "Spell-Check Buffer") ispell-buffer | ||
| 1491 | :help ,(purecopy "Check spelling of selected buffer"))) | ||
| 1492 | (fset 'ispell-menu-map (symbol-value 'ispell-menu-map)))) | ||
| 1493 | |||
| 1494 | 1482 | ||
| 1495 | ;;; ********************************************************************** | 1483 | ;;; ********************************************************************** |
| 1496 | 1484 | ||