comparison lisp/textmodes/flyspell.el @ 22962:f4509374e88e

(flyspell-command-hook): Option deleted. (flyspell-mode-on): Delete code to handle flyspell-command-hook. (flyspell-mode-off): Likewise. (flyspell-mark-duplications-flag): Doc fix. (flyspell-duplicate-distance): Doc fix. (flyspell-duplicate-face): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Sat, 08 Aug 1998 23:44:03 +0000 (1998-08-08)
parents cfde96067373
children 424ac751577a
comparison
equal deleted inserted replaced
22961:8159553e2468 22962:f4509374e88e
63 Non-nil means use highlight, nil means use minibuffer messages." 63 Non-nil means use highlight, nil means use minibuffer messages."
64 :group 'flyspell 64 :group 'flyspell
65 :type 'boolean) 65 :type 'boolean)
66 66
67 (defcustom flyspell-mark-duplications-flag t 67 (defcustom flyspell-mark-duplications-flag t
68 "*Non-nil means Flyspell reports duplications as well as misspellings." 68 "*Non-nil means Flyspell reports a repeated word as an error."
69 :group 'flyspell 69 :group 'flyspell
70 :type 'boolean) 70 :type 'boolean)
71 71
72 (defcustom flyspell-sort-corrections t 72 (defcustom flyspell-sort-corrections t
73 "*Non-nil means, sort the corrections alphabetically before popping them." 73 "*Non-nil means, sort the corrections alphabetically before popping them."
74 :group 'flyspell 74 :group 'flyspell
75 :type 'boolean) 75 :type 'boolean)
76 76
77 (defcustom flyspell-command-hook t
78 "*Non-nil means that `post-command-hook' is used to check already-typed words."
79 :group 'flyspell
80 :type 'boolean)
81
82 (defcustom flyspell-duplicate-distance 10000 77 (defcustom flyspell-duplicate-distance 10000
83 "*The maximum distance between duplicate mispelled words, for flagging them. 78 "*The maximum distance for finding duplicates of unrecognized words.
79 This applies to the feature that when a word is not found in the dictionary,
80 if the same spelling occurs elsewhere in the buffer,
81 Flyspell uses a different face (`flyspell-duplicate-face') to highlight it.
82 This variable specifies how far to search to find such a duplicate.
84 -1 means no limit (search the whole buffer). 83 -1 means no limit (search the whole buffer).
85 0 means do not search for duplicate misspelled words." 84 0 means do not search for duplicate unrecognized spellings."
86 :group 'flyspell 85 :group 'flyspell
87 :type 'number) 86 :type 'number)
88 87
89 (defcustom flyspell-delay 3 88 (defcustom flyspell-delay 3
90 "*The number of seconds to wait before checking, after a \"delayed\" command." 89 "*The number of seconds to wait before checking, after a \"delayed\" command."
244 ;* Highlighting */ 243 ;* Highlighting */
245 ;*---------------------------------------------------------------------*/ 244 ;*---------------------------------------------------------------------*/
246 (defface flyspell-incorrect-face 245 (defface flyspell-incorrect-face
247 '((((class color)) (:foreground "OrangeRed" :bold t :underline t)) 246 '((((class color)) (:foreground "OrangeRed" :bold t :underline t))
248 (t (:bold t))) 247 (t (:bold t)))
249 "Face used for showing misspelled words in Flyspell." 248 "Face used for marking a misspelled word in Flyspell."
250 :group 'flyspell) 249 :group 'flyspell)
251 250
252 (defface flyspell-duplicate-face 251 (defface flyspell-duplicate-face
253 '((((class color)) (:foreground "Gold3" :bold t :underline t)) 252 '((((class color)) (:foreground "Gold3" :bold t :underline t))
254 (t (:bold t))) 253 (t (:bold t)))
255 "Face used for showing misspelled words in Flyspell." 254 "Face used for marking a misspelled word that appears twice in the buffer.
255 See also `flyspell-duplicate-distance'."
256 :group 'flyspell) 256 :group 'flyspell)
257 257
258 (defvar flyspell-overlay nil) 258 (defvar flyspell-overlay nil)
259 259
260 ;*---------------------------------------------------------------------*/ 260 ;*---------------------------------------------------------------------*/
315 (make-variable-buffer-local 'ispell-process-directory) 315 (make-variable-buffer-local 'ispell-process-directory)
316 (make-variable-buffer-local 'ispell-parser))) 316 (make-variable-buffer-local 'ispell-parser)))
317 ;; We put the `flyspel-delayed' property on some commands. 317 ;; We put the `flyspel-delayed' property on some commands.
318 (flyspell-delay-commands) 318 (flyspell-delay-commands)
319 ;; we bound flyspell action to post-command hook 319 ;; we bound flyspell action to post-command hook
320 (if flyspell-command-hook 320 (make-local-hook 'post-command-hook)
321 (progn 321 (add-hook 'post-command-hook (function flyspell-post-command-hook) t t)
322 (make-local-hook 'post-command-hook)
323 (add-hook 'post-command-hook
324 (function flyspell-post-command-hook)
325 t
326 t)))
327 ;; we bound flyspell action to pre-command hook 322 ;; we bound flyspell action to pre-command hook
328 (if flyspell-command-hook 323 (make-local-hook 'pre-command-hook)
329 (progn 324 (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)
330 (make-local-hook 'pre-command-hook)
331 (add-hook 'pre-command-hook
332 (function flyspell-pre-command-hook)
333 t
334 t)))
335 325
336 ;; Set flyspell-generic-check-word-p based on the major mode. 326 ;; Set flyspell-generic-check-word-p based on the major mode.
337 (let ((mode-predicate (get major-mode 'flyspell-mode-predicate))) 327 (let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))
338 (if mode-predicate 328 (if mode-predicate
339 (setq flyspell-generic-check-word-p mode-predicate))) 329 (setq flyspell-generic-check-word-p mode-predicate)))
429 ;; If we have an Ispell process for each buffer, 419 ;; If we have an Ispell process for each buffer,
430 ;; kill the one for this buffer. 420 ;; kill the one for this buffer.
431 (if flyspell-multi-language-p 421 (if flyspell-multi-language-p
432 (ispell-kill-ispell t)) 422 (ispell-kill-ispell t))
433 ;; we remove the hooks 423 ;; we remove the hooks
434 (if flyspell-command-hook 424 (remove-hook 'post-command-hook (function flyspell-post-command-hook) t)
435 (progn 425 (remove-hook 'pre-command-hook (function flyspell-pre-command-hook) t)
436 (remove-hook 'post-command-hook
437 (function flyspell-post-command-hook)
438 t)
439 (remove-hook 'pre-command-hook
440 (function flyspell-pre-command-hook)
441 t)))
442 ;; we remove all the flyspell hilightings 426 ;; we remove all the flyspell hilightings
443 (flyspell-delete-all-overlays) 427 (flyspell-delete-all-overlays)
444 ;; we have to erase pre cache variables 428 ;; we have to erase pre cache variables
445 (setq flyspell-pre-buffer nil) 429 (setq flyspell-pre-buffer nil)
446 (setq flyspell-pre-point nil) 430 (setq flyspell-pre-point nil)
466 (save-excursion 450 (save-excursion
467 (backward-char 1) 451 (backward-char 1)
468 (and (looking-at (flyspell-get-not-casechars)) 452 (and (looking-at (flyspell-get-not-casechars))
469 (or flyspell-consider-dash-as-word-delimiter-flag 453 (or flyspell-consider-dash-as-word-delimiter-flag
470 (not (looking-at "\\-")))))) 454 (not (looking-at "\\-"))))))
471 ;; yes because we have reached or typed a word delimiter 455 ;; yes because we have reached or typed a word delimiter.
472 t) 456 t)
473 ((not (integerp flyspell-delay)) 457 ((not (integerp flyspell-delay))
474 ;; yes because the user had settup a non delay configuration 458 ;; yes because the user had set up a no-delay configuration.
475 t) 459 t)
476 (t 460 (t
477 (if (fboundp 'about-xemacs) 461 (if (fboundp 'about-xemacs)
478 (sit-for flyspell-delay nil) 462 (sit-for flyspell-delay nil)
479 (sit-for flyspell-delay 0 nil))))) 463 (sit-for flyspell-delay 0 nil)))))