diff options
| author | Roland Winkler | 2006-05-21 20:57:08 +0000 |
|---|---|---|
| committer | Roland Winkler | 2006-05-21 20:57:08 +0000 |
| commit | 5c9c3eba64ba975a32b3d4e8555e1124a50b6e0a (patch) | |
| tree | 4c7a35e4930349c1fdfb91d49cdf305cc8730c7b | |
| parent | 41d207e1aa125932aeebde221ef034978a721957 (diff) | |
| download | emacs-5c9c3eba64ba975a32b3d4e8555e1124a50b6e0a.tar.gz emacs-5c9c3eba64ba975a32b3d4e8555e1124a50b6e0a.zip | |
(flyspell-generic-check-word-p): Make this the alias for the
following variable.
(flyspell-generic-check-word-predicate): Make this the real name.
| -rw-r--r-- | lisp/textmodes/flyspell.el | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 54b67a258a6..c20ecef31e0 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -271,21 +271,23 @@ If `flyspell-large-region' is nil, all regions are treated as small." | |||
| 271 | ;;* using flyspell with mail-mode add the following expression */ | 271 | ;;* using flyspell with mail-mode add the following expression */ |
| 272 | ;;* in your .emacs file: */ | 272 | ;;* in your .emacs file: */ |
| 273 | ;;* (add-hook 'mail-mode */ | 273 | ;;* (add-hook 'mail-mode */ |
| 274 | ;;* '(lambda () (setq flyspell-generic-check-word-p */ | 274 | ;;* '(lambda () (setq flyspell-generic-check-word-predicate */ |
| 275 | ;;* 'mail-mode-flyspell-verify))) */ | 275 | ;;* 'mail-mode-flyspell-verify))) */ |
| 276 | ;;*---------------------------------------------------------------------*/ | 276 | ;;*---------------------------------------------------------------------*/ |
| 277 | (defvar flyspell-generic-check-word-p nil | 277 | (defvar flyspell-generic-check-word-predicate nil |
| 278 | "Function providing per-mode customization over which words are flyspelled. | 278 | "Function providing per-mode customization over which words are flyspelled. |
| 279 | Returns t to continue checking, nil otherwise. | 279 | Returns t to continue checking, nil otherwise. |
| 280 | Flyspell mode sets this variable to whatever is the `flyspell-mode-predicate' | 280 | Flyspell mode sets this variable to whatever is the `flyspell-mode-predicate' |
| 281 | property of the major mode name.") | 281 | property of the major mode name.") |
| 282 | (make-variable-buffer-local 'flyspell-generic-check-word-p) | 282 | (make-variable-buffer-local 'flyspell-generic-check-word-predicate) |
| 283 | (defvaralias 'flyspell-generic-check-word-p | ||
| 284 | 'flyspell-generic-check-word-predicate) | ||
| 283 | 285 | ||
| 284 | ;;*--- mail mode -------------------------------------------------------*/ | 286 | ;;*--- mail mode -------------------------------------------------------*/ |
| 285 | (put 'mail-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) | 287 | (put 'mail-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) |
| 286 | (put 'message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) | 288 | (put 'message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) |
| 287 | (defun mail-mode-flyspell-verify () | 289 | (defun mail-mode-flyspell-verify () |
| 288 | "This function is used for `flyspell-generic-check-word-p' in Mail mode." | 290 | "Function used for `flyspell-generic-check-word-predicate' in Mail mode." |
| 289 | (let ((header-end (save-excursion | 291 | (let ((header-end (save-excursion |
| 290 | (goto-char (point-min)) | 292 | (goto-char (point-min)) |
| 291 | (re-search-forward | 293 | (re-search-forward |
| @@ -313,7 +315,7 @@ property of the major mode name.") | |||
| 313 | ;;*--- texinfo mode ----------------------------------------------------*/ | 315 | ;;*--- texinfo mode ----------------------------------------------------*/ |
| 314 | (put 'texinfo-mode 'flyspell-mode-predicate 'texinfo-mode-flyspell-verify) | 316 | (put 'texinfo-mode 'flyspell-mode-predicate 'texinfo-mode-flyspell-verify) |
| 315 | (defun texinfo-mode-flyspell-verify () | 317 | (defun texinfo-mode-flyspell-verify () |
| 316 | "This function is used for `flyspell-generic-check-word-p' in Texinfo mode." | 318 | "Function used for `flyspell-generic-check-word-predicate' in Texinfo mode." |
| 317 | (save-excursion | 319 | (save-excursion |
| 318 | (forward-word -1) | 320 | (forward-word -1) |
| 319 | (not (looking-at "@")))) | 321 | (not (looking-at "@")))) |
| @@ -321,7 +323,7 @@ property of the major mode name.") | |||
| 321 | ;;*--- tex mode --------------------------------------------------------*/ | 323 | ;;*--- tex mode --------------------------------------------------------*/ |
| 322 | (put 'tex-mode 'flyspell-mode-predicate 'tex-mode-flyspell-verify) | 324 | (put 'tex-mode 'flyspell-mode-predicate 'tex-mode-flyspell-verify) |
| 323 | (defun tex-mode-flyspell-verify () | 325 | (defun tex-mode-flyspell-verify () |
| 324 | "This function is used for `flyspell-generic-check-word-p' in LaTeX mode." | 326 | "Function used for `flyspell-generic-check-word-predicate' in LaTeX mode." |
| 325 | (and | 327 | (and |
| 326 | (not (save-excursion | 328 | (not (save-excursion |
| 327 | (re-search-backward "^[ \t]*%%%[ \t]+Local" nil t))) | 329 | (re-search-backward "^[ \t]*%%%[ \t]+Local" nil t))) |
| @@ -338,7 +340,7 @@ property of the major mode name.") | |||
| 338 | (put 'html-mode 'flyspell-mode-predicate 'sgml-mode-flyspell-verify) | 340 | (put 'html-mode 'flyspell-mode-predicate 'sgml-mode-flyspell-verify) |
| 339 | 341 | ||
| 340 | (defun sgml-mode-flyspell-verify () | 342 | (defun sgml-mode-flyspell-verify () |
| 341 | "This function is used for `flyspell-generic-check-word-p' in SGML mode." | 343 | "Function used for `flyspell-generic-check-word-predicate' in SGML mode." |
| 342 | (not (save-excursion | 344 | (not (save-excursion |
| 343 | (let ((this (point-marker)) | 345 | (let ((this (point-marker)) |
| 344 | (s (progn (beginning-of-line) (point-marker))) | 346 | (s (progn (beginning-of-line) (point-marker))) |
| @@ -368,7 +370,7 @@ property of the major mode name.") | |||
| 368 | "Faces corresponding to text in programming-mode buffers.") | 370 | "Faces corresponding to text in programming-mode buffers.") |
| 369 | 371 | ||
| 370 | (defun flyspell-generic-progmode-verify () | 372 | (defun flyspell-generic-progmode-verify () |
| 371 | "Used for `flyspell-generic-check-word-p' in programming modes." | 373 | "Used for `flyspell-generic-check-word-predicate' in programming modes." |
| 372 | (let ((f (get-text-property (point) 'face))) | 374 | (let ((f (get-text-property (point) 'face))) |
| 373 | (memq f flyspell-prog-text-faces))) | 375 | (memq f flyspell-prog-text-faces))) |
| 374 | 376 | ||
| @@ -376,7 +378,8 @@ property of the major mode name.") | |||
| 376 | (defun flyspell-prog-mode () | 378 | (defun flyspell-prog-mode () |
| 377 | "Turn on `flyspell-mode' for comments and strings." | 379 | "Turn on `flyspell-mode' for comments and strings." |
| 378 | (interactive) | 380 | (interactive) |
| 379 | (setq flyspell-generic-check-word-p 'flyspell-generic-progmode-verify) | 381 | (setq flyspell-generic-check-word-predicate |
| 382 | 'flyspell-generic-progmode-verify) | ||
| 380 | (flyspell-mode 1) | 383 | (flyspell-mode 1) |
| 381 | (run-hooks 'flyspell-prog-mode-hook)) | 384 | (run-hooks 'flyspell-prog-mode-hook)) |
| 382 | 385 | ||
| @@ -563,10 +566,10 @@ in your .emacs file. | |||
| 563 | (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t) | 566 | (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t) |
| 564 | ;; we bound flyspell action to after-change hook | 567 | ;; we bound flyspell action to after-change hook |
| 565 | (add-hook 'after-change-functions 'flyspell-after-change-function nil t) | 568 | (add-hook 'after-change-functions 'flyspell-after-change-function nil t) |
| 566 | ;; set flyspell-generic-check-word-p based on the major mode | 569 | ;; set flyspell-generic-check-word-predicate based on the major mode |
| 567 | (let ((mode-predicate (get major-mode 'flyspell-mode-predicate))) | 570 | (let ((mode-predicate (get major-mode 'flyspell-mode-predicate))) |
| 568 | (if mode-predicate | 571 | (if mode-predicate |
| 569 | (setq flyspell-generic-check-word-p mode-predicate))) | 572 | (setq flyspell-generic-check-word-predicate mode-predicate))) |
| 570 | ;; the welcome message | 573 | ;; the welcome message |
| 571 | (if (and flyspell-issue-message-flag | 574 | (if (and flyspell-issue-message-flag |
| 572 | flyspell-issue-welcome-flag | 575 | flyspell-issue-welcome-flag |
| @@ -979,8 +982,8 @@ Mostly we check word delimiters." | |||
| 979 | (flyspell-word (flyspell-get-word following)) | 982 | (flyspell-word (flyspell-get-word following)) |
| 980 | start end poss word) | 983 | start end poss word) |
| 981 | (if (or (eq flyspell-word nil) | 984 | (if (or (eq flyspell-word nil) |
| 982 | (and (fboundp flyspell-generic-check-word-p) | 985 | (and (fboundp flyspell-generic-check-word-predicate) |
| 983 | (not (funcall flyspell-generic-check-word-p)))) | 986 | (not (funcall flyspell-generic-check-word-predicate)))) |
| 984 | t | 987 | t |
| 985 | (progn | 988 | (progn |
| 986 | ;; destructure return flyspell-word info list. | 989 | ;; destructure return flyspell-word info list. |