191 |
`(defvar ,symbol ,value ,doc)))) |
`(defvar ,symbol ,value ,doc)))) |
192 |
|
|
193 |
(eval-when-compile |
(eval-when-compile |
194 |
(if (fboundp 'defgroup) |
(if (not (fboundp 'defgroup)) |
195 |
(defgroup ispell nil |
(defmacro defgroup (&rest args) |
196 |
"User variables for emacs ispell interface." |
"Empty replacement for defgroup when not supplied."))) |
197 |
:group 'applications))) |
|
198 |
|
(defgroup ispell nil |
199 |
|
"User variables for emacs ispell interface." |
200 |
|
:group 'applications) |
201 |
|
|
202 |
(if (not (fboundp 'buffer-substring-no-properties)) |
(if (not (fboundp 'buffer-substring-no-properties)) |
203 |
(defun buffer-substring-no-properties (start end) |
(defun buffer-substring-no-properties (start end) |
729 |
(let ((case-fold-search-val case-fold-search) |
(let ((case-fold-search-val case-fold-search) |
730 |
;; avoid bugs when syntax of `.' changes in various default modes |
;; avoid bugs when syntax of `.' changes in various default modes |
731 |
(default-major-mode 'fundamental-mode) |
(default-major-mode 'fundamental-mode) |
732 |
|
(default-directory temporary-file-directory) |
733 |
result status) |
result status) |
734 |
(save-excursion |
(save-excursion |
735 |
|
(let ((buf (get-buffer " *ispell-tmp*"))) |
736 |
|
(if buf (kill-buffer buf))) |
737 |
(set-buffer (get-buffer-create " *ispell-tmp*")) |
(set-buffer (get-buffer-create " *ispell-tmp*")) |
738 |
(erase-buffer) |
(erase-buffer) |
739 |
(setq status (call-process |
(setq status (call-process |
837 |
(if ispell-menu-map-needed |
(if ispell-menu-map-needed |
838 |
(let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist))) |
(let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist))) |
839 |
(dir (if (boundp 'ispell-library-directory) ispell-library-directory)) |
(dir (if (boundp 'ispell-library-directory) ispell-library-directory)) |
840 |
|
(dict-map (make-sparse-keymap "Dictionaries")) |
841 |
name load-dict) |
name load-dict) |
842 |
(setq ispell-menu-map (make-sparse-keymap "Spell")) |
(setq ispell-menu-map (make-sparse-keymap "Spell")) |
843 |
;; add the dictionaries to the bottom of the list. |
;; add the dictionaries to the bottom of the list. |
844 |
(while dicts |
(dolist (dict dicts) |
845 |
(setq name (car (car dicts)) |
(setq name (car dict) |
846 |
load-dict (car (cdr (member "-d" (nth 5 (car dicts))))) |
load-dict (car (cdr (member "-d" (nth 5 dict))))) |
847 |
dicts (cdr dicts)) |
(unless (stringp name) |
848 |
(cond ((not (stringp name)) |
(define-key ispell-menu-map [default] |
849 |
(define-key ispell-menu-map [default] |
'("Select Default Dict" |
850 |
'("Select Default Dict" |
"Dictionary for which Ispell was configured" |
851 |
"Dictionary for which Ispell was configured" |
. (lambda () (interactive) |
852 |
. (lambda () (interactive) |
(ispell-change-dictionary "default")))))) |
853 |
(ispell-change-dictionary "default"))))) |
(fset 'ispell-dict-map dict-map) |
854 |
|
(define-key ispell-menu-map [dictionaries] |
855 |
|
`(menu-item "Select Dict" ispell-dict-map)) |
856 |
|
(dolist (dict dicts) |
857 |
|
(setq name (car dict) |
858 |
|
load-dict (car (cdr (member "-d" (nth 5 dict))))) |
859 |
|
(cond ((not (stringp name))) |
860 |
((or (not dir) ; load all if library dir not defined |
((or (not dir) ; load all if library dir not defined |
861 |
(file-exists-p (concat dir "/" name ".hash")) |
(file-exists-p (concat dir "/" name ".hash")) |
862 |
(file-exists-p (concat dir "/" name ".has")) |
(file-exists-p (concat dir "/" name ".has")) |
863 |
(and load-dict |
(and load-dict |
864 |
(or (file-exists-p (concat dir "/" load-dict ".hash")) |
(or (file-exists-p (concat dir "/" load-dict ".hash")) |
865 |
(file-exists-p (concat dir "/" load-dict ".has"))))) |
(file-exists-p (concat dir "/" load-dict ".has"))))) |
866 |
(define-key ispell-menu-map (vector (intern name)) |
(define-key dict-map (vector (intern name)) |
867 |
(cons (concat "Select " (capitalize name) " Dict") |
(cons (concat "Select " (capitalize name) " Dict") |
868 |
`(lambda () (interactive) |
`(lambda () (interactive) |
869 |
(ispell-change-dictionary ,name))))))))) |
(ispell-change-dictionary ,name))))))))) |
1082 |
|
|
1083 |
;;; *** Buffer Local Definitions *** |
;;; *** Buffer Local Definitions *** |
1084 |
|
|
1085 |
(defconst ispell-words-keyword "LocalWords: " |
(defconst ispell-words-keyword "LocalWords: " |
1086 |
"The keyword for local oddly-spelled words to accept. |
"The keyword for local oddly-spelled words to accept. |
1087 |
The keyword will be followed by any number of local word spellings. |
The keyword will be followed by any number of local word spellings. |
1088 |
There can be multiple of these keywords in the file.") |
There can be multiple of these keywords in the file.") |
1240 |
;; terrible kludge, and it's a bit slow, but it does get the work done.) |
;; terrible kludge, and it's a bit slow, but it does get the work done.) |
1241 |
(let ((cmd (aref string 0)) |
(let ((cmd (aref string 0)) |
1242 |
;; The following commands are not passed to Ispell until |
;; The following commands are not passed to Ispell until |
1243 |
;; we have a *reall* reason to invoke it. |
;; we have a *real* reason to invoke it. |
1244 |
(cmds-to-defer '(?* ?@ ?~ ?+ ?- ?! ?%)) |
(cmds-to-defer '(?* ?@ ?~ ?+ ?- ?! ?%)) |
1245 |
(default-major-mode 'fundamental-mode) |
(default-major-mode 'fundamental-mode) |
1246 |
(session-buf ispell-session-buffer) |
(session-buf ispell-session-buffer) |
1929 |
(while (search-backward "*" nil t) (insert ".")) |
(while (search-backward "*" nil t) (insert ".")) |
1930 |
(setq word (buffer-string)) |
(setq word (buffer-string)) |
1931 |
(erase-buffer)) |
(erase-buffer)) |
1932 |
(setq status (call-process prog nil t nil args word lookup-dict)) |
(setq status (if lookup-dict |
1933 |
|
(call-process prog nil t nil args word lookup-dict) |
1934 |
|
(call-process prog nil t nil args word))) |
1935 |
;; grep returns status 1 and no output when word not found, which |
;; grep returns status 1 and no output when word not found, which |
1936 |
;; is a perfectly normal thing. |
;; is a perfectly normal thing. |
1937 |
(if (stringp status) |
(if (stringp status) |