diff options
| author | Richard M. Stallman | 1998-07-29 03:21:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-07-29 03:21:32 +0000 |
| commit | 0a67052fd03235b837ff00c7bfb248342f7827cd (patch) | |
| tree | 5b08037a4fe4929a0858ea1c31c962ee70db53a0 /lisp/textmodes | |
| parent | 39d6d9bdb7511493e419b3931e80083fca21b603 (diff) | |
| download | emacs-0a67052fd03235b837ff00c7bfb248342f7827cd.tar.gz emacs-0a67052fd03235b837ff00c7bfb248342f7827cd.zip | |
(flyspell-emacs-popup): Renamed from flyspell-gnuemacs-popup. Callers changed.
(push): Macro deleted. Callers changed to do it explicitly.
(flyspell-incorrect-face, flyspell-duplicate-face): Use defface.
(flyspell-incorrect-color): Variable deleted.
(flyspell-duplicate-color): Variable deleted.
(flyspell-underline-p): Variable deleted.
(flyspell-font-lock-make-face): Function deleted.
(flyspell-mark-duplications-flag): Renamed from flyspell-doublon-as-error-flag.
(flyspell-mode-on): Delete the debugging message.
(flyspell-mode-off): Delete the debugging message.
(flyspell-mode-on): Set flyspell-generic-check-word-p
from the flyspell-mode-predicate property.
(texinfo-mode, mail-mode, message-mode):
Set flyspell-mode-predicate property.
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/flyspell.el | 227 |
1 files changed, 87 insertions, 140 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index f63cf012b3a..0550e585ee0 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -29,8 +29,8 @@ | |||
| 29 | ;; | 29 | ;; |
| 30 | ;; To enter the flyspell minor mode, Meta-x flyspell-mode. | 30 | ;; To enter the flyspell minor mode, Meta-x flyspell-mode. |
| 31 | ;; | 31 | ;; |
| 32 | ;; Note: consider setting the variable ispell-parser to 'tex to | 32 | ;; Note: consider setting the variable ispell-parser to `tex' to |
| 33 | ;; avoid TeX command checking (use `(setq ispell-parser 'tex)') | 33 | ;; avoid TeX command checking; use `(setq ispell-parser 'tex)' |
| 34 | ;; _before_ entering flyspell. | 34 | ;; _before_ entering flyspell. |
| 35 | ;; | 35 | ;; |
| 36 | ;; Some user variables control the behavior of flyspell. They are | 36 | ;; Some user variables control the behavior of flyspell. They are |
| @@ -55,12 +55,13 @@ | |||
| 55 | ;* User variables ... */ | 55 | ;* User variables ... */ |
| 56 | ;*---------------------------------------------------------------------*/ | 56 | ;*---------------------------------------------------------------------*/ |
| 57 | (defcustom flyspell-highlight-flag t | 57 | (defcustom flyspell-highlight-flag t |
| 58 | "*Non-nil means use highlight, nil means use mini-buffer messages." | 58 | "*How Flyspell should indicate misspelled words. |
| 59 | Non-nil means use highlight, nil means use minibuffer messages." | ||
| 59 | :group 'flyspell | 60 | :group 'flyspell |
| 60 | :type 'boolean) | 61 | :type 'boolean) |
| 61 | 62 | ||
| 62 | (defcustom flyspell-doublon-as-error-flag t | 63 | (defcustom flyspell-mark-duplications-flag t |
| 63 | "*Non-nil means consider doublon as misspelling." | 64 | "*Non-nil means Flyspell reports duplications as well as misspellings." |
| 64 | :group 'flyspell | 65 | :group 'flyspell |
| 65 | :type 'boolean) | 66 | :type 'boolean) |
| 66 | 67 | ||
| @@ -69,31 +70,14 @@ | |||
| 69 | :group 'flyspell | 70 | :group 'flyspell |
| 70 | :type 'boolean) | 71 | :type 'boolean) |
| 71 | 72 | ||
| 72 | (defcustom flyspell-incorrect-color "OrangeRed" | 73 | (defcustom flyspell-auto-correct-binding "\M-\t" |
| 73 | "*The color used for highlighting incorrect words." | ||
| 74 | :group 'flyspell | ||
| 75 | :type 'string) | ||
| 76 | |||
| 77 | (defcustom flyspell-duplicate-color "Gold3" | ||
| 78 | "*The color used for highlighting incorrect words but appearing at least twice." | ||
| 79 | :group 'flyspell | ||
| 80 | :type 'string) | ||
| 81 | |||
| 82 | (defcustom flyspell-underline-p t | ||
| 83 | "*Non-nil means, incorrect words are underlined." | ||
| 84 | :group 'flyspell | ||
| 85 | :type 'boolean) | ||
| 86 | |||
| 87 | (defcustom flyspell-auto-correct-binding | ||
| 88 | "\M-\t" | ||
| 89 | "*Non-nil means that its value (a binding) will bound to the flyspell | 74 | "*Non-nil means that its value (a binding) will bound to the flyspell |
| 90 | auto-correct." | 75 | auto-correct." |
| 91 | :group 'flyspell | 76 | :group 'flyspell |
| 92 | :type '(choice (const nil) string)) | 77 | :type '(choice (const nil) string)) |
| 93 | 78 | ||
| 94 | (defcustom flyspell-command-hook t | 79 | (defcustom flyspell-command-hook t |
| 95 | "*Non-nil means that `post-command-hook' is used to check | 80 | "*Non-nil means that `post-command-hook' is used to check already-typed words." |
| 96 | already typed words." | ||
| 97 | :group 'flyspell | 81 | :group 'flyspell |
| 98 | :type 'boolean) | 82 | :type 'boolean) |
| 99 | 83 | ||
| @@ -105,18 +89,17 @@ already typed words." | |||
| 105 | :type 'number) | 89 | :type 'number) |
| 106 | 90 | ||
| 107 | (defcustom flyspell-delay 3 | 91 | (defcustom flyspell-delay 3 |
| 108 | "*The number of second before checking words on post-command-hook if | 92 | "*The number of seconds to wait before checking words, for a \"delayed\" command." |
| 109 | the current command is a delay command." | ||
| 110 | :group 'flyspell | 93 | :group 'flyspell |
| 111 | :type 'number) | 94 | :type 'number) |
| 112 | 95 | ||
| 113 | (defcustom flyspell-persistent-highlight t | 96 | (defcustom flyspell-persistent-highlight t |
| 114 | "*T means that hilighted words are not removed until the word are corrected." | 97 | "*Non-nil means that hilighted words are not removed until the word are corrected." |
| 115 | :group 'flyspell | 98 | :group 'flyspell |
| 116 | :type 'boolean) | 99 | :type 'boolean) |
| 117 | 100 | ||
| 118 | (defcustom flyspell-highlight-properties t | 101 | (defcustom flyspell-highlight-properties t |
| 119 | "*T means highlight incorrect words even if a property exists for this word." | 102 | "*Non-nil means highlight incorrect words even if a property exists for this word." |
| 120 | :group 'flyspell | 103 | :group 'flyspell |
| 121 | :type 'boolean) | 104 | :type 'boolean) |
| 122 | 105 | ||
| @@ -124,21 +107,19 @@ the current command is a delay command." | |||
| 124 | '(self-insert-command | 107 | '(self-insert-command |
| 125 | delete-backward-char | 108 | delete-backward-char |
| 126 | delete-char) | 109 | delete-char) |
| 127 | "The list of always delayed command (that is flyspell is not activated | 110 | "The standard list of delayed commands for Flyspell. |
| 128 | after any of these commands." | 111 | See `flyspell-delayed-commands'." |
| 129 | :group 'flyspell | 112 | :group 'flyspell |
| 130 | :type '(repeat (symbol))) | 113 | :type '(repeat (symbol))) |
| 131 | 114 | ||
| 132 | (defcustom flyspell-delayed-commands | 115 | (defcustom flyspell-delayed-commands nil |
| 133 | nil | 116 | "List of commands that are \"delayed\" for Flyspell mode. |
| 134 | "*If non nil, this variable must hold a list a symbol. Each symbol is | 117 | These commands do not activate flyspell checking." |
| 135 | the name of an delayed command (that is a command that does not activate | ||
| 136 | flyspell checking." | ||
| 137 | :group 'flyspell | 118 | :group 'flyspell |
| 138 | :type '(repeat (symbol))) | 119 | :type '(repeat (symbol))) |
| 139 | 120 | ||
| 140 | (defcustom flyspell-issue-welcome-flag t | 121 | (defcustom flyspell-issue-welcome-flag t |
| 141 | "*Non-nil means that flyspell issues a welcome message when started." | 122 | "*Non-nil means that Flyspell issues a welcome message when started." |
| 142 | :group 'flyspell | 123 | :group 'flyspell |
| 143 | :type 'boolean) | 124 | :type 'boolean) |
| 144 | 125 | ||
| @@ -148,15 +129,15 @@ flyspell checking." | |||
| 148 | :type 'boolean) | 129 | :type 'boolean) |
| 149 | 130 | ||
| 150 | (defcustom flyspell-incorrect-hook nil | 131 | (defcustom flyspell-incorrect-hook nil |
| 151 | "*Non-nil means a list of hooks to be executed when incorrect | 132 | "*List of functions to be called when incorrect words are encountered. |
| 152 | words are encountered. Each hook is a function of two arguments that are | 133 | Each function is given two arguments: the beginning and the end |
| 153 | location of the beginning and the end of the incorrect region." | 134 | of the incorrect region." |
| 154 | :group 'flyspell) | 135 | :group 'flyspell) |
| 155 | 136 | ||
| 156 | (defcustom flyspell-multi-language-p t | 137 | (defcustom flyspell-multi-language-p t |
| 157 | "*Non-nil means that flyspell could be use with several buffers checking | 138 | "*Non-nil means that Flyspell can be used with multiple languages. |
| 158 | several languages. Non-nil means that a new ispell process will be spawned | 139 | This mode works by starting a separate Ispell process for each buffer, |
| 159 | per buffer. If nil, only one unique ispell process will be running." | 140 | so that each buffer can use its own language." |
| 160 | :group 'flyspell | 141 | :group 'flyspell |
| 161 | :type 'boolean) | 142 | :type 'boolean) |
| 162 | 143 | ||
| @@ -173,11 +154,15 @@ per buffer. If nil, only one unique ispell process will be running." | |||
| 173 | ;*---------------------------------------------------------------------*/ | 154 | ;*---------------------------------------------------------------------*/ |
| 174 | (defvar flyspell-generic-check-word-p nil | 155 | (defvar flyspell-generic-check-word-p nil |
| 175 | "Function providing per-mode customization over which words are flyspelled. | 156 | "Function providing per-mode customization over which words are flyspelled. |
| 176 | Returns t to continue checking, nil otherwise.") | 157 | Returns t to continue checking, nil otherwise. |
| 158 | Flyspell mode sets this variable to whatever is the `flyspell-mode-predicate' | ||
| 159 | property of the major mode name.") | ||
| 177 | (make-variable-buffer-local 'flyspell-generic-check-word-p) | 160 | (make-variable-buffer-local 'flyspell-generic-check-word-p) |
| 178 | 161 | ||
| 162 | (put 'mail-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) | ||
| 163 | (put 'message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) | ||
| 179 | (defun mail-mode-flyspell-verify () | 164 | (defun mail-mode-flyspell-verify () |
| 180 | "Return t if we want flyspell to check the word under point." | 165 | "This function is used for `flyspell-generic-check-word-p' in Mail mode." |
| 181 | (save-excursion | 166 | (save-excursion |
| 182 | (or (progn | 167 | (or (progn |
| 183 | (beginning-of-line) | 168 | (beginning-of-line) |
| @@ -188,8 +173,9 @@ Returns t to continue checking, nil otherwise.") | |||
| 188 | (beginning-of-line) | 173 | (beginning-of-line) |
| 189 | (looking-at "[>}|]"))))))) | 174 | (looking-at "[>}|]"))))))) |
| 190 | 175 | ||
| 176 | (put 'texinfo-mode 'flyspell-mode-predicate 'texinfo-mode-flyspell-verify) | ||
| 191 | (defun texinfo-mode-flyspell-verify () | 177 | (defun texinfo-mode-flyspell-verify () |
| 192 | "Return t if we want flyspell to check the word under point." | 178 | "This function is used for `flyspell-generic-check-word-p' in Texinfo mode." |
| 193 | (save-excursion | 179 | (save-excursion |
| 194 | (forward-word -1) | 180 | (forward-word -1) |
| 195 | (not (looking-at "@")))) | 181 | (not (looking-at "@")))) |
| @@ -207,41 +193,6 @@ Returns t to continue checking, nil otherwise.") | |||
| 207 | (autoload 'overlay-put "overlay" "" t) | 193 | (autoload 'overlay-put "overlay" "" t) |
| 208 | (autoload 'overlay-get "overlay" "" t) | 194 | (autoload 'overlay-get "overlay" "" t) |
| 209 | 195 | ||
| 210 | (defun flyspell-font-lock-make-face (l) | ||
| 211 | "Because emacs and xemacs does not behave the same I uses my owe | ||
| 212 | font-lock-make-face function. This function is similar to the gnu-emacs | ||
| 213 | font-lock-make-face function." | ||
| 214 | (let ((fname (car l)) | ||
| 215 | (color (car (cdr l))) | ||
| 216 | (italic (car (cdr (cdr l)))) | ||
| 217 | (bold (car (cdr (cdr (cdr l))))) | ||
| 218 | (underline (car (cdr (cdr (cdr (cdr l))))))) | ||
| 219 | (let ((face (copy-face 'default fname))) | ||
| 220 | (if color | ||
| 221 | (set-face-foreground face color)) | ||
| 222 | (if (and italic bold) | ||
| 223 | (condition-case nil | ||
| 224 | (make-face-bold-italic face) | ||
| 225 | (error nil)) | ||
| 226 | (progn | ||
| 227 | (if italic | ||
| 228 | (condition-case nil | ||
| 229 | (make-face-italic face) | ||
| 230 | (error nil))) | ||
| 231 | (if bold | ||
| 232 | (condition-case nil | ||
| 233 | (make-face-bold face) | ||
| 234 | (error nil))))) | ||
| 235 | (if underline | ||
| 236 | (condition-case nil | ||
| 237 | (set-face-underline-p face t) | ||
| 238 | (error nil))) | ||
| 239 | (if (not (x-display-color-p)) | ||
| 240 | (condition-case nil | ||
| 241 | (make-face-bold face) | ||
| 242 | (error nil))) | ||
| 243 | face))) | ||
| 244 | |||
| 245 | ;*---------------------------------------------------------------------*/ | 196 | ;*---------------------------------------------------------------------*/ |
| 246 | ;* Which emacs are we currently running */ | 197 | ;* Which emacs are we currently running */ |
| 247 | ;*---------------------------------------------------------------------*/ | 198 | ;*---------------------------------------------------------------------*/ |
| @@ -254,16 +205,6 @@ font-lock-make-face function." | |||
| 254 | "The Emacs we are currently running.") | 205 | "The Emacs we are currently running.") |
| 255 | 206 | ||
| 256 | ;*---------------------------------------------------------------------*/ | 207 | ;*---------------------------------------------------------------------*/ |
| 257 | ;* cl compatibility */ | ||
| 258 | ;*---------------------------------------------------------------------*/ | ||
| 259 | (defmacro push (x place) | ||
| 260 | "(push X PLACE): insert X at the head of the list stored in PLACE. | ||
| 261 | Analogous to (setf PLACE (cons X PLACE)), though more careful about | ||
| 262 | evaluating each argument only once and in the right order. PLACE has | ||
| 263 | to be a symbol." | ||
| 264 | (list 'setq place (list 'cons x place))) | ||
| 265 | |||
| 266 | ;*---------------------------------------------------------------------*/ | ||
| 267 | ;* The minor mode declaration. */ | 208 | ;* The minor mode declaration. */ |
| 268 | ;*---------------------------------------------------------------------*/ | 209 | ;*---------------------------------------------------------------------*/ |
| 269 | (defvar flyspell-mode nil) | 210 | (defvar flyspell-mode nil) |
| @@ -273,10 +214,13 @@ to be a symbol." | |||
| 273 | (defvar flyspell-mouse-map (make-sparse-keymap)) | 214 | (defvar flyspell-mouse-map (make-sparse-keymap)) |
| 274 | 215 | ||
| 275 | (or (assoc 'flyspell-mode minor-mode-alist) | 216 | (or (assoc 'flyspell-mode minor-mode-alist) |
| 276 | (push '(flyspell-mode " Fly") minor-mode-alist)) | 217 | (setq minor-mode-alist |
| 218 | (cons '(flyspell-mode " Fly") minor-mode-alist))) | ||
| 277 | 219 | ||
| 278 | (or (assoc 'flyspell-mode minor-mode-map-alist) | 220 | (or (assoc 'flyspell-mode minor-mode-map-alist) |
| 279 | (push (cons 'flyspell-mode flyspell-mode-map) minor-mode-map-alist)) | 221 | (setq minor-mode-map-alist |
| 222 | (cons (cons 'flyspell-mode flyspell-mode-map) | ||
| 223 | minor-mode-map-alist))) | ||
| 280 | 224 | ||
| 281 | (if flyspell-auto-correct-binding | 225 | (if flyspell-auto-correct-binding |
| 282 | (define-key flyspell-mode-map flyspell-auto-correct-binding | 226 | (define-key flyspell-mode-map flyspell-auto-correct-binding |
| @@ -299,16 +243,18 @@ to be a symbol." | |||
| 299 | ;*---------------------------------------------------------------------*/ | 243 | ;*---------------------------------------------------------------------*/ |
| 300 | ;* Highlighting */ | 244 | ;* Highlighting */ |
| 301 | ;*---------------------------------------------------------------------*/ | 245 | ;*---------------------------------------------------------------------*/ |
| 302 | (flyspell-font-lock-make-face (list 'flyspell-incorrect-face | 246 | (defface flyspell-incorrect-face |
| 303 | flyspell-incorrect-color | 247 | '((((class color)) (:foreround "OrangeRed")) |
| 304 | nil | 248 | (t (:bold t))) |
| 305 | t | 249 | "Face used for showing misspelled words in Flyspell." |
| 306 | flyspell-underline-p)) | 250 | :group 'flyspell) |
| 307 | (flyspell-font-lock-make-face (list 'flyspell-duplicate-face | 251 | |
| 308 | flyspell-duplicate-color | 252 | (defface flyspell-duplicate-face |
| 309 | nil | 253 | '((((class color)) (:foreround "Gold3")) |
| 310 | t | 254 | (t (:bold t))) |
| 311 | flyspell-underline-p)) | 255 | "Face used for showing misspelled words in Flyspell." |
| 256 | :group 'flyspell) | ||
| 257 | |||
| 312 | 258 | ||
| 313 | (defvar flyspell-overlay nil) | 259 | (defvar flyspell-overlay nil) |
| 314 | 260 | ||
| @@ -319,8 +265,9 @@ to be a symbol." | |||
| 319 | (defun flyspell-mode (&optional arg) | 265 | (defun flyspell-mode (&optional arg) |
| 320 | "Minor mode performing on-the-fly spelling checking. | 266 | "Minor mode performing on-the-fly spelling checking. |
| 321 | Ispell is automatically spawned on background for each entered words. | 267 | Ispell is automatically spawned on background for each entered words. |
| 322 | The default flyspells behavior is to highlight incorrect words. | 268 | The default flyspell behavior is to highlight incorrect words. |
| 323 | With prefix ARG, turn Flyspell minor mode on iff ARG is positive. | 269 | With no argument, this command toggles Flyspell mode. |
| 270 | With a prefix argument ARG, turn Flyspell minor mode on iff ARG is positive. | ||
| 324 | 271 | ||
| 325 | Bindings: | 272 | Bindings: |
| 326 | \\[ispell-word]: correct words (using Ispell). | 273 | \\[ispell-word]: correct words (using Ispell). |
| @@ -337,7 +284,7 @@ invoking `ispell-change-dictionary'. | |||
| 337 | 284 | ||
| 338 | Consider using the `ispell-parser' to check your text. For instance | 285 | Consider using the `ispell-parser' to check your text. For instance |
| 339 | consider adding: | 286 | consider adding: |
| 340 | (add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex)))) | 287 | \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex)))) |
| 341 | in your .emacs file. | 288 | in your .emacs file. |
| 342 | 289 | ||
| 343 | flyspell-region checks all words inside a region. | 290 | flyspell-region checks all words inside a region. |
| @@ -357,8 +304,7 @@ flyspell-buffer checks the whole buffer." | |||
| 357 | ;* flyspell-mode-on ... */ | 304 | ;* flyspell-mode-on ... */ |
| 358 | ;*---------------------------------------------------------------------*/ | 305 | ;*---------------------------------------------------------------------*/ |
| 359 | (defun flyspell-mode-on () | 306 | (defun flyspell-mode-on () |
| 360 | "Turn flyspell mode on. Do not use, use `flyspell-mode' instead." | 307 | "Turn flyspell mode on. Do not use this; use `flyspell-mode' instead." |
| 361 | (message "flyspell on: %S" (current-buffer)) | ||
| 362 | (setq ispell-highlight-face 'flyspell-incorrect-face) | 308 | (setq ispell-highlight-face 'flyspell-incorrect-face) |
| 363 | ;; ispell initialization | 309 | ;; ispell initialization |
| 364 | (if flyspell-multi-language-p | 310 | (if flyspell-multi-language-p |
| @@ -387,6 +333,10 @@ flyspell-buffer checks the whole buffer." | |||
| 387 | (function flyspell-pre-command-hook) | 333 | (function flyspell-pre-command-hook) |
| 388 | t | 334 | t |
| 389 | t))) | 335 | t))) |
| 336 | (let ((mode-predicate (get major-mode 'flyspell-mode-predicate))) | ||
| 337 | (if mode-predicate | ||
| 338 | (setq flyspell-generic-check-word-p mode-predicate))) | ||
| 339 | |||
| 390 | ;; the welcome message | 340 | ;; the welcome message |
| 391 | (if flyspell-issue-welcome-flag | 341 | (if flyspell-issue-welcome-flag |
| 392 | (message | 342 | (message |
| @@ -408,7 +358,7 @@ flyspell-buffer checks the whole buffer." | |||
| 408 | ;* flyspell-delay-commands ... */ | 358 | ;* flyspell-delay-commands ... */ |
| 409 | ;*---------------------------------------------------------------------*/ | 359 | ;*---------------------------------------------------------------------*/ |
| 410 | (defun flyspell-delay-commands () | 360 | (defun flyspell-delay-commands () |
| 411 | "Install the delayed command." | 361 | "Install the standard set of delayed commands." |
| 412 | (mapcar 'flyspell-delay-command flyspell-default-delayed-commands) | 362 | (mapcar 'flyspell-delay-command flyspell-default-delayed-commands) |
| 413 | (mapcar 'flyspell-delay-command flyspell-delayed-commands)) | 363 | (mapcar 'flyspell-delay-command flyspell-delayed-commands)) |
| 414 | 364 | ||
| @@ -419,22 +369,22 @@ flyspell-buffer checks the whole buffer." | |||
| 419 | "Set COMMAND to be delayed. | 369 | "Set COMMAND to be delayed. |
| 420 | When flyspell `post-command-hook' is invoked because a delayed command | 370 | When flyspell `post-command-hook' is invoked because a delayed command |
| 421 | as been used the current word is not immediatly checked. | 371 | as been used the current word is not immediatly checked. |
| 422 | It will be checked only after flyspell-delay second." | 372 | It will be checked only after `flyspell-delay' seconds." |
| 423 | (interactive "Scommand: ") | 373 | (interactive "SDelay Flyspell after Command: ") |
| 424 | (put command 'flyspell-delayed t)) | 374 | (put command 'flyspell-delayed t)) |
| 425 | 375 | ||
| 426 | ;*---------------------------------------------------------------------*/ | 376 | ;*---------------------------------------------------------------------*/ |
| 427 | ;* flyspell-ignore-commands ... */ | 377 | ;* flyspell-ignore-commands ... */ |
| 428 | ;*---------------------------------------------------------------------*/ | 378 | ;*---------------------------------------------------------------------*/ |
| 429 | (defun flyspell-ignore-commands () | 379 | (defun flyspell-ignore-commands () |
| 430 | "This is an obsolete function, use flyspell-delays command instead." | 380 | "This is an obsolete function, use `flyspell-delay-commands' instead." |
| 431 | (flyspell-delay-commands)) | 381 | (flyspell-delay-commands)) |
| 432 | 382 | ||
| 433 | ;*---------------------------------------------------------------------*/ | 383 | ;*---------------------------------------------------------------------*/ |
| 434 | ;* flyspell-ignore-command ... */ | 384 | ;* flyspell-ignore-command ... */ |
| 435 | ;*---------------------------------------------------------------------*/ | 385 | ;*---------------------------------------------------------------------*/ |
| 436 | (defun flyspell-ignore-command (command) | 386 | (defun flyspell-ignore-command (command) |
| 437 | "This is an obsolete function, use flyspell-delay command instead. | 387 | "This is an obsolete function, use `flyspell-delay-command' instead. |
| 438 | COMMAND is the name of the command to be delayed." | 388 | COMMAND is the name of the command to be delayed." |
| 439 | (flyspell-delay-command command)) | 389 | (flyspell-delay-command command)) |
| 440 | 390 | ||
| @@ -463,8 +413,7 @@ COMMAND is the name of the command to be delayed." | |||
| 463 | ;* flyspell-pre-command-hook ... */ | 413 | ;* flyspell-pre-command-hook ... */ |
| 464 | ;*---------------------------------------------------------------------*/ | 414 | ;*---------------------------------------------------------------------*/ |
| 465 | (defun flyspell-pre-command-hook () | 415 | (defun flyspell-pre-command-hook () |
| 466 | "This function is internally used by Flyspell to get a cursor location | 416 | "Save the current buffer and point for Flyspell's post-command hook." |
| 467 | before a user command." | ||
| 468 | (interactive) | 417 | (interactive) |
| 469 | (setq flyspell-pre-buffer (current-buffer)) | 418 | (setq flyspell-pre-buffer (current-buffer)) |
| 470 | (setq flyspell-pre-point (point))) | 419 | (setq flyspell-pre-point (point))) |
| @@ -473,9 +422,7 @@ before a user command." | |||
| 473 | ;* flyspell-mode-off ... */ | 422 | ;* flyspell-mode-off ... */ |
| 474 | ;*---------------------------------------------------------------------*/ | 423 | ;*---------------------------------------------------------------------*/ |
| 475 | (defun flyspell-mode-off () | 424 | (defun flyspell-mode-off () |
| 476 | "Turn flyspell mode off. Do not use. Use `flyspell-mode' instead." | 425 | "Turn flyspell mode off. Do not use this--use `flyspell-mode' instead." |
| 477 | ;; the bye-bye message | ||
| 478 | (message "Quiting Flyspell...%S" (current-buffer)) | ||
| 479 | ;; we stop the running ispell | 426 | ;; we stop the running ispell |
| 480 | (ispell-kill-ispell t) | 427 | (ispell-kill-ispell t) |
| 481 | ;; we remove the hooks | 428 | ;; we remove the hooks |
| @@ -499,9 +446,9 @@ before a user command." | |||
| 499 | ;* flyspell-check-word-p ... */ | 446 | ;* flyspell-check-word-p ... */ |
| 500 | ;*---------------------------------------------------------------------*/ | 447 | ;*---------------------------------------------------------------------*/ |
| 501 | (defun flyspell-check-word-p () | 448 | (defun flyspell-check-word-p () |
| 502 | "This function returns t when the word at `point' has to be | 449 | "Return t when the word at `point' has to be checked. |
| 503 | checked. The answer depends of several criteria. Mostly we | 450 | The answer depends of several criteria. |
| 504 | check word delimiters." | 451 | Mostly we check word delimiters." |
| 505 | (cond | 452 | (cond |
| 506 | ((<= (- (point-max) 1) (point-min)) | 453 | ((<= (- (point-max) 1) (point-min)) |
| 507 | ;; the buffer is not filled enough | 454 | ;; the buffer is not filled enough |
| @@ -530,8 +477,9 @@ check word delimiters." | |||
| 530 | ;* flyspell-check-pre-word-p ... */ | 477 | ;* flyspell-check-pre-word-p ... */ |
| 531 | ;*---------------------------------------------------------------------*/ | 478 | ;*---------------------------------------------------------------------*/ |
| 532 | (defun flyspell-check-pre-word-p () | 479 | (defun flyspell-check-pre-word-p () |
| 533 | "When to we have to check the word that was at point before | 480 | "Return non-nil if we should to check the word before point. |
| 534 | the current command?" | 481 | More precisely, it applies to the word that was before point |
| 482 | before the current command." | ||
| 535 | (cond | 483 | (cond |
| 536 | ((or (not (numberp flyspell-pre-point)) | 484 | ((or (not (numberp flyspell-pre-point)) |
| 537 | (not (bufferp flyspell-pre-buffer)) | 485 | (not (bufferp flyspell-pre-buffer)) |
| @@ -589,7 +537,7 @@ the current command?" | |||
| 589 | word (car word)) | 537 | word (car word)) |
| 590 | ;; before checking in the directory, we check for doublons. | 538 | ;; before checking in the directory, we check for doublons. |
| 591 | (cond | 539 | (cond |
| 592 | ((and flyspell-doublon-as-error-flag | 540 | ((and flyspell-mark-duplications-flag |
| 593 | (save-excursion | 541 | (save-excursion |
| 594 | (goto-char start) | 542 | (goto-char start) |
| 595 | (word-search-backward word | 543 | (word-search-backward word |
| @@ -688,7 +636,7 @@ the current command?" | |||
| 688 | ;* flyspell-tex-command-p ... */ | 636 | ;* flyspell-tex-command-p ... */ |
| 689 | ;*---------------------------------------------------------------------*/ | 637 | ;*---------------------------------------------------------------------*/ |
| 690 | (defun flyspell-tex-command-p (word) | 638 | (defun flyspell-tex-command-p (word) |
| 691 | "Is a word a TeX command?" | 639 | "Return t if WORD is a TeX command." |
| 692 | (eq (aref word 0) ?\\)) | 640 | (eq (aref word 0) ?\\)) |
| 693 | 641 | ||
| 694 | ;*---------------------------------------------------------------------*/ | 642 | ;*---------------------------------------------------------------------*/ |
| @@ -704,9 +652,8 @@ the current command?" | |||
| 704 | ;*---------------------------------------------------------------------*/ | 652 | ;*---------------------------------------------------------------------*/ |
| 705 | (defun flyspell-get-casechars () | 653 | (defun flyspell-get-casechars () |
| 706 | "This function builds a string that is the regexp of word chars. | 654 | "This function builds a string that is the regexp of word chars. |
| 707 | In order | 655 | In order to avoid one useless string construction, |
| 708 | to avoid one useless string construction, this function changes the last | 656 | this function changes the last char of the `ispell-casechars' string." |
| 709 | char of the ispell-casechars string." | ||
| 710 | (let ((ispell-casechars (ispell-get-casechars))) | 657 | (let ((ispell-casechars (ispell-get-casechars))) |
| 711 | (cond | 658 | (cond |
| 712 | ((eq ispell-casechars flyspell-ispell-casechars-cache) | 659 | ((eq ispell-casechars flyspell-ispell-casechars-cache) |
| @@ -901,8 +848,10 @@ Word syntax described by `ispell-dictionary-alist' (which see)." | |||
| 901 | ;* make-flyspell-overlay ... */ | 848 | ;* make-flyspell-overlay ... */ |
| 902 | ;*---------------------------------------------------------------------*/ | 849 | ;*---------------------------------------------------------------------*/ |
| 903 | (defun make-flyspell-overlay (beg end face mouse-face) | 850 | (defun make-flyspell-overlay (beg end face mouse-face) |
| 904 | "Allocate a new flyspell overlay that will be used to hilight | 851 | "Allocate an overlay to highlight an incorrect word. |
| 905 | an incorrect word." | 852 | BEG and END specify the range in the buffer of that word. |
| 853 | FACE and MOUSE-FACE specify the `face' and `mouse-face' properties | ||
| 854 | for the overlay." | ||
| 906 | (let ((flyspell-overlay (make-overlay beg end))) | 855 | (let ((flyspell-overlay (make-overlay beg end))) |
| 907 | (overlay-put flyspell-overlay 'face face) | 856 | (overlay-put flyspell-overlay 'face face) |
| 908 | (overlay-put flyspell-overlay 'mouse-face mouse-face) | 857 | (overlay-put flyspell-overlay 'mouse-face mouse-face) |
| @@ -916,8 +865,7 @@ an incorrect word." | |||
| 916 | ;* flyspell-highlight-incorrect-region ... */ | 865 | ;* flyspell-highlight-incorrect-region ... */ |
| 917 | ;*---------------------------------------------------------------------*/ | 866 | ;*---------------------------------------------------------------------*/ |
| 918 | (defun flyspell-highlight-incorrect-region (beg end) | 867 | (defun flyspell-highlight-incorrect-region (beg end) |
| 919 | "The setup of an overlay on a region (starting at BEG and ending at END) | 868 | "Set up an overlay on a misspelled word, in the buffer from BEG to END." |
| 920 | that corresponds to an incorrect word." | ||
| 921 | (run-hook-with-args 'flyspell-incorrect-hook beg end) | 869 | (run-hook-with-args 'flyspell-incorrect-hook beg end) |
| 922 | (if (or (not (flyspell-properties-at-p beg)) flyspell-highlight-properties) | 870 | (if (or (not (flyspell-properties-at-p beg)) flyspell-highlight-properties) |
| 923 | (progn | 871 | (progn |
| @@ -939,8 +887,7 @@ that corresponds to an incorrect word." | |||
| 939 | ;* flyspell-highlight-duplicate-region ... */ | 887 | ;* flyspell-highlight-duplicate-region ... */ |
| 940 | ;*---------------------------------------------------------------------*/ | 888 | ;*---------------------------------------------------------------------*/ |
| 941 | (defun flyspell-highlight-duplicate-region (beg end) | 889 | (defun flyspell-highlight-duplicate-region (beg end) |
| 942 | "The setup of an overlay on a region (starting at BEG and ending at END) | 890 | "Set up an overlay on a duplicated word, in the buffer from BEG to END." |
| 943 | that corresponds to an duplicated word." | ||
| 944 | (if (or (not (flyspell-properties-at-p beg)) flyspell-highlight-properties) | 891 | (if (or (not (flyspell-properties-at-p beg)) flyspell-highlight-properties) |
| 945 | (progn | 892 | (progn |
| 946 | ;; we cleanup current overlay at the same position | 893 | ;; we cleanup current overlay at the same position |
| @@ -968,7 +915,7 @@ that corresponds to an duplicated word." | |||
| 968 | ;* flyspell-auto-correct-word ... */ | 915 | ;* flyspell-auto-correct-word ... */ |
| 969 | ;*---------------------------------------------------------------------*/ | 916 | ;*---------------------------------------------------------------------*/ |
| 970 | (defun flyspell-auto-correct-word (pos) | 917 | (defun flyspell-auto-correct-word (pos) |
| 971 | "Auto correct the word at position POS." | 918 | "Auto-correct the word at position POS." |
| 972 | (interactive "d") | 919 | (interactive "d") |
| 973 | ;; use the correct dictionary | 920 | ;; use the correct dictionary |
| 974 | (ispell-accept-buffer-local-defs) | 921 | (ispell-accept-buffer-local-defs) |
| @@ -1094,8 +1041,8 @@ consequence is that we can not use overlay map with flyspell." | |||
| 1094 | ;* flyspell-correct-word ... */ | 1041 | ;* flyspell-correct-word ... */ |
| 1095 | ;*---------------------------------------------------------------------*/ | 1042 | ;*---------------------------------------------------------------------*/ |
| 1096 | (defun flyspell-correct-word/mouse-keymap (event) | 1043 | (defun flyspell-correct-word/mouse-keymap (event) |
| 1097 | "Popup a menu to present possible correction. The word checked is the | 1044 | "Pop up a menu of possible corrections for a misspelled word. |
| 1098 | word at the mouse position." | 1045 | The word checked is the word at the mouse position." |
| 1099 | (interactive "e") | 1046 | (interactive "e") |
| 1100 | ;; use the correct dictionary | 1047 | ;; use the correct dictionary |
| 1101 | (ispell-accept-buffer-local-defs) | 1048 | (ispell-accept-buffer-local-defs) |
| @@ -1127,7 +1074,7 @@ word at the mouse position." | |||
| 1127 | (error "Ispell: error in Ispell process")) | 1074 | (error "Ispell: error in Ispell process")) |
| 1128 | ((string-match "GNU" (emacs-version)) | 1075 | ((string-match "GNU" (emacs-version)) |
| 1129 | ;; the word is incorrect, we have to propose a replacement | 1076 | ;; the word is incorrect, we have to propose a replacement |
| 1130 | (setq replace (flyspell-gnuemacs-popup event poss word)) | 1077 | (setq replace (flyspell-emacs-popup event poss word)) |
| 1131 | (cond ((eq replace 'ignore) | 1078 | (cond ((eq replace 'ignore) |
| 1132 | nil) | 1079 | nil) |
| 1133 | ((eq replace 'save) | 1080 | ((eq replace 'save) |
| @@ -1188,10 +1135,10 @@ word at the mouse position." | |||
| 1188 | (insert word)))))) | 1135 | (insert word)))))) |
| 1189 | 1136 | ||
| 1190 | ;*---------------------------------------------------------------------*/ | 1137 | ;*---------------------------------------------------------------------*/ |
| 1191 | ;* flyspell-gnuemacs-popup */ | 1138 | ;* flyspell-emacs-popup */ |
| 1192 | ;*---------------------------------------------------------------------*/ | 1139 | ;*---------------------------------------------------------------------*/ |
| 1193 | (defun flyspell-gnuemacs-popup (event poss word) | 1140 | (defun flyspell-emacs-popup (event poss word) |
| 1194 | "The gnu-emacs popup menu." | 1141 | "The Emacs popup menu." |
| 1195 | (if (not event) | 1142 | (if (not event) |
| 1196 | (let* ((mouse-pos (mouse-position)) | 1143 | (let* ((mouse-pos (mouse-position)) |
| 1197 | (mouse-pos (if (nth 1 mouse-pos) | 1144 | (mouse-pos (if (nth 1 mouse-pos) |