diff options
| author | Richard M. Stallman | 2002-05-30 17:09:58 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-05-30 17:09:58 +0000 |
| commit | a60f1fcdb5876831ae376821e31a3eb14e33d7b8 (patch) | |
| tree | 28f305218e8179f89076a77f89ef4c8bead1d87d | |
| parent | 243a5ce664a064bfe86652d2fe31f04bcf52c781 (diff) | |
| download | emacs-a60f1fcdb5876831ae376821e31a3eb14e33d7b8.tar.gz emacs-a60f1fcdb5876831ae376821e31a3eb14e33d7b8.zip | |
(ispell-library-directory): Renamed from ispell-library-path.
If Ispell is not installed, init to nil.
(ispell-menu-map): Get rid of byte-compiling-files-p hackery;
initialize this unconditionally when ispell-menu-map-needed is t.
Local `path' renamed to `dir'.
(check-ispell-version): Doc fix.
| -rw-r--r-- | lisp/textmodes/ispell.el | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 041a4935111..9ad083d6e53 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -714,7 +714,7 @@ LANGUAGE.aff file \(e.g., english.aff\)." | |||
| 714 | (defun check-ispell-version (&optional interactivep) | 714 | (defun check-ispell-version (&optional interactivep) |
| 715 | "Ensure that `ispell-program-name' is valid and the correct version. | 715 | "Ensure that `ispell-program-name' is valid and the correct version. |
| 716 | Returns version number if called interactively. | 716 | Returns version number if called interactively. |
| 717 | Otherwise returns the library path if defined." | 717 | Otherwise returns the library directory name, if that is defined." |
| 718 | ;; This is a little wasteful as we actually launch ispell twice: once | 718 | ;; This is a little wasteful as we actually launch ispell twice: once |
| 719 | ;; to make sure it's the right version, and once for real. But people | 719 | ;; to make sure it's the right version, and once for real. But people |
| 720 | ;; get confused by version mismatches *all* the time (and I've got the | 720 | ;; get confused by version mismatches *all* the time (and I've got the |
| @@ -748,7 +748,7 @@ Otherwise returns the library path if defined." | |||
| 748 | ", " | 748 | ", " |
| 749 | ispell-version)) | 749 | ispell-version)) |
| 750 | (message result)) | 750 | (message result)) |
| 751 | ;; return library path. | 751 | ;; return library directory. |
| 752 | (if (re-search-forward "LIBDIR = \\\"\\([^ \t\n]*\\)\\\"" nil t) | 752 | (if (re-search-forward "LIBDIR = \\\"\\([^ \t\n]*\\)\\\"" nil t) |
| 753 | (setq result (buffer-substring (match-beginning 1) (match-end 1))))) | 753 | (setq result (buffer-substring (match-beginning 1) (match-end 1))))) |
| 754 | (goto-char (point-min)) | 754 | (goto-char (point-min)) |
| @@ -810,10 +810,10 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 810 | (not xemacsp) | 810 | (not xemacsp) |
| 811 | 'reload)) | 811 | 'reload)) |
| 812 | 812 | ||
| 813 | (defvar ispell-library-path (if (or (not (fboundp 'byte-compiling-files-p)) | 813 | (defvar ispell-library-directory (condition-case () |
| 814 | (not (byte-compiling-files-p))) | 814 | (check-ispell-version) |
| 815 | (check-ispell-version)) | 815 | (error nil)) |
| 816 | "The directory where ispell dictionaries reside.") | 816 | "Directory where ispell dictionaries reside.") |
| 817 | 817 | ||
| 818 | (defvar ispell-process nil | 818 | (defvar ispell-process nil |
| 819 | "The process object for Ispell.") | 819 | "The process object for Ispell.") |
| @@ -828,12 +828,9 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 828 | "Non-nil means that the OS supports asynchronous processes.") | 828 | "Non-nil means that the OS supports asynchronous processes.") |
| 829 | 829 | ||
| 830 | ;;;###autoload | 830 | ;;;###autoload |
| 831 | (if (and ispell-menu-map-needed | 831 | (if ispell-menu-map-needed |
| 832 | (or (not (fboundp 'byte-compiling-files-p)) | ||
| 833 | (not (byte-compiling-files-p)))) | ||
| 834 | (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist))) | 832 | (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist))) |
| 835 | ;; `ispell-library-path' intentionally not defined in autoload | 833 | (dir ispell-library-directory) |
| 836 | (path (and (boundp 'ispell-library-path) ispell-library-path)) | ||
| 837 | name load-dict) | 834 | name load-dict) |
| 838 | (setq ispell-menu-map (make-sparse-keymap "Spell")) | 835 | (setq ispell-menu-map (make-sparse-keymap "Spell")) |
| 839 | ;; add the dictionaries to the bottom of the list. | 836 | ;; add the dictionaries to the bottom of the list. |
| @@ -848,12 +845,12 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 848 | (list 'lambda () '(interactive) | 845 | (list 'lambda () '(interactive) |
| 849 | (list | 846 | (list |
| 850 | 'ispell-change-dictionary "default")))))) | 847 | 'ispell-change-dictionary "default")))))) |
| 851 | ((or (not path) ; load all if library dir not defined | 848 | ((or (not dir) ; load all if library dir not defined |
| 852 | (file-exists-p (concat path "/" name ".hash")) | 849 | (file-exists-p (concat dir "/" name ".hash")) |
| 853 | (file-exists-p (concat path "/" name ".has")) | 850 | (file-exists-p (concat dir "/" name ".has")) |
| 854 | (and load-dict | 851 | (and load-dict |
| 855 | (or (file-exists-p(concat path "/" load-dict ".hash")) | 852 | (or (file-exists-p (concat dir "/" load-dict ".hash")) |
| 856 | (file-exists-p(concat path "/" load-dict ".has"))))) | 853 | (file-exists-p (concat dir "/" load-dict ".has"))))) |
| 857 | (define-key ispell-menu-map (vector (intern name)) | 854 | (define-key ispell-menu-map (vector (intern name)) |
| 858 | (cons (concat "Select " (capitalize name) " Dict") | 855 | (cons (concat "Select " (capitalize name) " Dict") |
| 859 | (list 'lambda () '(interactive) | 856 | (list 'lambda () '(interactive) |
| @@ -862,13 +859,11 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 862 | 859 | ||
| 863 | ;;; define commands in menu in opposite order you want them to appear. | 860 | ;;; define commands in menu in opposite order you want them to appear. |
| 864 | ;;;###autoload | 861 | ;;;###autoload |
| 865 | (if (and ispell-menu-map-needed | 862 | (if ispell-menu-map-needed |
| 866 | (or (not (fboundp 'byte-compiling-files-p)) | ||
| 867 | (not (byte-compiling-files-p)))) | ||
| 868 | (progn | 863 | (progn |
| 869 | (define-key ispell-menu-map [ispell-change-dictionary] | 864 | (define-key ispell-menu-map [ispell-change-dictionary] |
| 870 | '(menu-item "Change Dictionary..." ispell-change-dictionary | 865 | '(menu-item "Change Dictionary..." ispell-change-dictionary |
| 871 | :help "Supply explicit path to dictionary")) | 866 | :help "Supply explicit dictionary file name")) |
| 872 | (define-key ispell-menu-map [ispell-kill-ispell] | 867 | (define-key ispell-menu-map [ispell-kill-ispell] |
| 873 | '(menu-item "Kill Process" ispell-kill-ispell | 868 | '(menu-item "Kill Process" ispell-kill-ispell |
| 874 | :enable (and (boundp 'ispell-process) ispell-process | 869 | :enable (and (boundp 'ispell-process) ispell-process |
| @@ -900,9 +895,7 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 900 | :help "Complete word fragment at cursor")))) | 895 | :help "Complete word fragment at cursor")))) |
| 901 | 896 | ||
| 902 | ;;;###autoload | 897 | ;;;###autoload |
| 903 | (if (and ispell-menu-map-needed | 898 | (if ispell-menu-map-needed |
| 904 | (or (not (fboundp 'byte-compiling-files-p)) | ||
| 905 | (not (byte-compiling-files-p)))) | ||
| 906 | (progn | 899 | (progn |
| 907 | (define-key ispell-menu-map [ispell-continue] | 900 | (define-key ispell-menu-map [ispell-continue] |
| 908 | '(menu-item "Continue Spell-Checking" ispell-continue | 901 | '(menu-item "Continue Spell-Checking" ispell-continue |
| @@ -919,9 +912,7 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 919 | :help "Spell-check only comments and strings")))) | 912 | :help "Spell-check only comments and strings")))) |
| 920 | 913 | ||
| 921 | ;;;###autoload | 914 | ;;;###autoload |
| 922 | (if (and ispell-menu-map-needed | 915 | (if ispell-menu-map-needed |
| 923 | (or (not (fboundp 'byte-compiling-files-p)) | ||
| 924 | (not (byte-compiling-files-p)))) | ||
| 925 | (progn | 916 | (progn |
| 926 | (define-key ispell-menu-map [ispell-region] | 917 | (define-key ispell-menu-map [ispell-region] |
| 927 | '(menu-item "Spell-Check Region" ispell-region | 918 | '(menu-item "Spell-Check Region" ispell-region |
| @@ -964,17 +955,17 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 964 | (setq name (car (car dicts)) | 955 | (setq name (car (car dicts)) |
| 965 | load-dict (car (cdr (member "-d" (nth 5 (car dicts))))) | 956 | load-dict (car (cdr (member "-d" (nth 5 (car dicts))))) |
| 966 | dicts (cdr dicts)) | 957 | dicts (cdr dicts)) |
| 967 | ;; Include if the dictionary is in the library, or path not defined. | 958 | ;; Include if the dictionary is in the library, or dir not defined. |
| 968 | (if (and (stringp name) | 959 | (if (and (stringp name) |
| 969 | (or (not ispell-library-path) | 960 | (or (not ispell-library-directory) |
| 970 | (file-exists-p (concat ispell-library-path "/" | 961 | (file-exists-p (concat ispell-library-directory "/" |
| 971 | name ".hash")) | 962 | name ".hash")) |
| 972 | (file-exists-p (concat ispell-library-path "/" | 963 | (file-exists-p (concat ispell-library-directory "/" |
| 973 | name ".has")) | 964 | name ".has")) |
| 974 | (and load-dict | 965 | (and load-dict |
| 975 | (or (file-exists-p (concat ispell-library-path "/" | 966 | (or (file-exists-p (concat ispell-library-directory "/" |
| 976 | load-dict ".hash")) | 967 | load-dict ".hash")) |
| 977 | (file-exists-p (concat ispell-library-path "/" | 968 | (file-exists-p (concat ispell-library-directory "/" |
| 978 | load-dict ".has")))))) | 969 | load-dict ".has")))))) |
| 979 | (setq menu (append menu | 970 | (setq menu (append menu |
| 980 | (list | 971 | (list |