/[emacs]/emacs/lisp/textmodes/flyspell.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/flyspell.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.31 by pj, Mon Jul 16 12:22:59 2001 UTC revision 1.32 by rms, Sat Nov 10 01:20:22 2001 UTC
# Line 370  property of the major mode name.") Line 370  property of the major mode name.")
370        (define-key map "\M-\t" #'flyspell-auto-correct-word)))        (define-key map "\M-\t" #'flyspell-auto-correct-word)))
371      map))      map))
372    
 ;;;###autoload  
 (defvar flyspell-mode-map (make-sparse-keymap))  
   
 ;; mouse, keyboard bindings and misc definition  
 (when (or (assoc 'flyspell-mode minor-mode-map-alist)  
           (setq minor-mode-map-alist  
                 (cons (cons 'flyspell-mode flyspell-mode-map)  
                       minor-mode-map-alist)))  
   (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word)  
   (define-key flyspell-mode-map [(mouse-2)]  
     (function flyspell-correct-word/local-keymap)))  
   
   
373  ;; the name of the overlay property that defines the keymap  ;; the name of the overlay property that defines the keymap
374  (defvar flyspell-overlay-keymap-property-name  (defvar flyspell-overlay-keymap-property-name 'keymap)
   (if (string-match "19.*XEmacs" emacs-version)  
       'keymap  
     'local-map))  
375    
376  ;; dash character machinery  ;; dash character machinery
377  (defvar flyspell-consider-dash-as-word-delimiter-flag nil  (defvar flyspell-consider-dash-as-word-delimiter-flag nil
# Line 433  Bindings: Line 417  Bindings:
417  \\[flyspell-correct-word] (or mouse-2): popup correct words.  \\[flyspell-correct-word] (or mouse-2): popup correct words.
418    
419  Hooks:  Hooks:
420  flyspell-mode-hook is run after flyspell is entered.  This runs `flyspell-mode-hook' after flyspell is entered.
421    
422  Remark:  Remark:
423  `flyspell-mode' uses `ispell-mode'.  Thus all Ispell options are  `flyspell-mode' uses `ispell-mode'.  Thus all Ispell options are
# Line 445  consider adding: Line 429  consider adding:
429  \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))  \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))
430  in your .emacs file.  in your .emacs file.
431    
432  flyspell-region checks all words inside a region.  \\[flyspell-region] checks all words inside a region.
433    \\[flyspell-buffer] checks the whole buffer."
 flyspell-buffer checks the whole buffer."  
434    (interactive "P")    (interactive "P")
435    (let ((old-flyspell-mode flyspell-mode))    (let ((old-flyspell-mode flyspell-mode))
436      ;; Mark the mode as on or off.      ;; Mark the mode as on or off.
# Line 465  flyspell-buffer checks the whole buffer. Line 448  flyspell-buffer checks the whole buffer.
448  ;*    Autoloading                                                      */  ;*    Autoloading                                                      */
449  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
450  ;;;###autoload  ;;;###autoload
451  (if (fboundp 'add-minor-mode)  (add-minor-mode 'flyspell-mode
452      (add-minor-mode 'flyspell-mode                  'flyspell-mode-line-string
453                      'flyspell-mode-line-string                  nil
454                      flyspell-mode-map                  nil
455                      nil                  'flyspell-mode)
                     'flyspell-mode)  
   (or (assoc 'flyspell-mode minor-mode-alist)  
       (setq minor-mode-alist  
             (cons '(flyspell-mode flyspell-mode-line-string)  
                   minor-mode-alist)))  
   
   (or (assoc 'flyspell-mode minor-mode-map-alist)  
       (setq minor-mode-map-alist  
             (cons (cons 'flyspell-mode flyspell-mode-map)  
                   minor-mode-map-alist))))  
456    
457  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
458  ;*    flyspell-buffers ...                                             */  ;*    flyspell-buffers ...                                             */
# Line 532  flyspell-buffer checks the whole buffer. Line 505  flyspell-buffer checks the whole buffer.
505    ;; we put the `flyspel-deplacement' property on some commands    ;; we put the `flyspel-deplacement' property on some commands
506    (flyspell-deplacement-commands)    (flyspell-deplacement-commands)
507    ;; we bound flyspell action to post-command hook    ;; we bound flyspell action to post-command hook
   (make-local-hook 'post-command-hook)  
508    (add-hook 'post-command-hook (function flyspell-post-command-hook) t t)    (add-hook 'post-command-hook (function flyspell-post-command-hook) t t)
509    ;; we bound flyspell action to pre-command hook    ;; we bound flyspell action to pre-command hook
   (make-local-hook 'pre-command-hook)  
510    (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)    (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)
511    ;; we bound flyspell action to after-change hook    ;; we bound flyspell action to after-change hook
512    (make-local-variable 'after-change-functions)    (make-local-variable 'after-change-functions)
# Line 545  flyspell-buffer checks the whole buffer. Line 516  flyspell-buffer checks the whole buffer.
516    (let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))    (let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))
517      (if mode-predicate      (if mode-predicate
518          (setq flyspell-generic-check-word-p mode-predicate)))          (setq flyspell-generic-check-word-p mode-predicate)))
   ;; work around the fact that the `local-map' text-property replaces the  
   ;; buffer's local map rather than shadowing it.  
   (set (make-local-variable 'flyspell-mouse-map)  
        (let ((map (copy-keymap flyspell-mouse-map)))  
          (set-keymap-parent map (current-local-map))  
          map))  
519    ;; the welcome message    ;; the welcome message
520    (if (and flyspell-issue-welcome-flag (interactive-p))    (if (and flyspell-issue-welcome-flag (interactive-p))
521        (let ((binding (where-is-internal 'flyspell-auto-correct-word        (let ((binding (where-is-internal 'flyspell-auto-correct-word
# Line 560  flyspell-buffer checks the whole buffer. Line 525  flyspell-buffer checks the whole buffer.
525               (format "Welcome to flyspell. Use %s or Mouse-2 to correct words."               (format "Welcome to flyspell. Use %s or Mouse-2 to correct words."
526                       (key-description binding))                       (key-description binding))
527             "Welcome to flyspell. Use Mouse-2 to correct words."))))             "Welcome to flyspell. Use Mouse-2 to correct words."))))
     
   ;; Use this so that we can still get major mode bindings at a  
   ;; misspelled word (unless they're overridden by  
   ;; `flyspell-mouse-map').  
   (set (make-local-variable 'flyspell-local-mouse-map)  
        (let ((map (copy-keymap flyspell-mouse-map)))  
          (if (eq flyspell-emacs 'xemacs)  
              (set-keymap-parents (list (current-local-map)))  
            (set-keymap-parent map (current-local-map)))  
          map))  
528    
529    ;; we end with the flyspell hooks    ;; we end with the flyspell hooks
530    (run-hooks 'flyspell-mode-hook))    (run-hooks 'flyspell-mode-hook))
# Line 1357  Word syntax described by `ispell-diction Line 1312  Word syntax described by `ispell-diction
1312  (defun flyspell-region (beg end)  (defun flyspell-region (beg end)
1313    "Flyspell text between BEG and END."    "Flyspell text between BEG and END."
1314    (interactive "r")    (interactive "r")
   (unless (boundp 'flyspell-local-mouse-map)  
     (set (make-local-variable 'flyspell-local-mouse-map)  
          (let ((map (copy-keymap flyspell-mouse-map)))  
            (if (eq flyspell-emacs 'xemacs)  
                (set-keymap-parents (list (current-local-map)))  
              (set-keymap-parent map (current-local-map)))  
            map)))  
1315    (if (= beg end)    (if (= beg end)
1316        ()        ()
1317      (save-excursion      (save-excursion
# Line 1495  for the overlay." Line 1443  for the overlay."
1443      (if flyspell-use-local-map      (if flyspell-use-local-map
1444          (overlay-put flyspell-overlay          (overlay-put flyspell-overlay
1445                       flyspell-overlay-keymap-property-name                       flyspell-overlay-keymap-property-name
1446                       flyspell-local-mouse-map))                       flyspell-mouse-map))
1447      flyspell-overlay))      flyspell-overlay))
1448            
1449  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26