Mercurial > emacs
comparison lisp/textmodes/flyspell.el @ 63120:803cbfc5da39
(flyspell-mode): Use define-minor-mode.
author | Lute Kamstra <lute@gnu.org> |
---|---|
date | Wed, 08 Jun 2005 08:12:14 +0000 |
parents | d3c552b53ce8 |
children | d1d41fd53b5f |
comparison
equal
deleted
inserted
replaced
63119:3c181e0f8852 | 63120:803cbfc5da39 |
---|---|
466 | 466 |
467 ;*---------------------------------------------------------------------*/ | 467 ;*---------------------------------------------------------------------*/ |
468 ;* flyspell-mode ... */ | 468 ;* flyspell-mode ... */ |
469 ;*---------------------------------------------------------------------*/ | 469 ;*---------------------------------------------------------------------*/ |
470 ;;;###autoload | 470 ;;;###autoload |
471 (defun flyspell-mode (&optional arg) | 471 (define-minor-mode flyspell-mode |
472 "Minor mode performing on-the-fly spelling checking. | 472 "Minor mode performing on-the-fly spelling checking. |
473 This spawns a single Ispell process and checks each word. | 473 This spawns a single Ispell process and checks each word. |
474 The default flyspell behavior is to highlight incorrect words. | 474 The default flyspell behavior is to highlight incorrect words. |
475 With no argument, this command toggles Flyspell mode. | 475 With no argument, this command toggles Flyspell mode. |
476 With a prefix argument ARG, turn Flyspell minor mode on iff ARG is positive. | 476 With a prefix argument ARG, turn Flyspell minor mode on iff ARG is positive. |
494 \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex)))) | 494 \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex)))) |
495 in your .emacs file. | 495 in your .emacs file. |
496 | 496 |
497 \\[flyspell-region] checks all words inside a region. | 497 \\[flyspell-region] checks all words inside a region. |
498 \\[flyspell-buffer] checks the whole buffer." | 498 \\[flyspell-buffer] checks the whole buffer." |
499 (interactive "P") | 499 :lighter flyspell-mode-line-string |
500 (let ((old-flyspell-mode flyspell-mode)) | 500 :keymap flyspell-mode-map |
501 ;; Mark the mode as on or off. | 501 :group 'flyspell |
502 (setq flyspell-mode (not (or (and (null arg) flyspell-mode) | 502 (if flyspell-mode |
503 (<= (prefix-numeric-value arg) 0)))) | 503 (flyspell-mode-on) |
504 ;; Do the real work. | 504 (flyspell-mode-off))) |
505 (unless (eq flyspell-mode old-flyspell-mode) | |
506 (if flyspell-mode | |
507 (flyspell-mode-on) | |
508 (flyspell-mode-off)) | |
509 ;; Force modeline redisplay. | |
510 (set-buffer-modified-p (buffer-modified-p))))) | |
511 | |
512 ;*---------------------------------------------------------------------*/ | |
513 ;* Autoloading */ | |
514 ;*---------------------------------------------------------------------*/ | |
515 ;;;###autoload | |
516 (add-minor-mode 'flyspell-mode | |
517 'flyspell-mode-line-string | |
518 flyspell-mode-map | |
519 nil | |
520 'flyspell-mode) | |
521 | 505 |
522 ;*---------------------------------------------------------------------*/ | 506 ;*---------------------------------------------------------------------*/ |
523 ;* flyspell-buffers ... */ | 507 ;* flyspell-buffers ... */ |
524 ;* ------------------------------------------------------------- */ | 508 ;* ------------------------------------------------------------- */ |
525 ;* For remembering buffers running flyspell */ | 509 ;* For remembering buffers running flyspell */ |