+2000-02-20 Dave Love <fx@gnu.org>
+
+ * textmodes/flyspell.el (flyspell-mouse-map): Change definition
+ and assignments to it.
+ (flyspell-mode-on): Define flyspell-local-mouse-map, inheriting
+ current local map.
+ (make-flyspell-overlay): Use it.
+ (flyspell-correct-word/mouse-keymap): Change XEmacs test.
+
+ * emacs-lisp/lisp-mnt.el: Don't require emacsbug at top level.
+ (lm-get-header-re): Defun, not defsubst.
+ (lm-get-package-name): Defun, not defsubst. Simplify.
+ (lm-version): Doc fix. Simplify.
+ (lm-header, lm-header-multiline, lm-header-multiline, lm-summary)
+ (lm-crack-address, lm-last-modified-date, lm-commentary)
+ (lm-verify, lm-synopsis): Simplify.
+ (lm-report-bug): Require emacsbug. Use compose-mail.
+
2000-02-20 Gerd Moellmann <gerd@gnu.org>
* dired.el (dired-mode): Call propertized-buffer-identification
;;; flyspell.el --- On-the-fly spell checker
-;; Copyright (C) 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000 Free Software Foundation, Inc.
;; Author: Manuel Serrano <Manuel.Serrano@unice.fr>
;; Keywords: convenience
(defvar flyspell-mode nil)
(make-variable-buffer-local 'flyspell-mode)
+(defvar flyspell-mouse-map
+ (let ((map (make-sparse-keymap)))
+ (cond
+ ((eq flyspell-emacs 'xemacs)
+ (define-key map [(button2)]
+ #'flyspell-correct-word/mouse-keymap)
+ (define-key flyspell-mouse-map "\M-\t" #'flyspell-auto-correct-word))
+ (flyspell-use-local-map
+ (define-key map [(mouse-2)] #'flyspell-correct-word/mouse-keymap)
+ (define-key map "\M-\t" #'flyspell-auto-correct-word)))
+ map))
(defvar flyspell-mode-map (make-sparse-keymap))
-(defvar flyspell-mouse-map (make-sparse-keymap))
(or (assoc 'flyspell-mode minor-mode-alist)
(setq minor-mode-alist
(cons '(flyspell-mode " Fly") minor-mode-alist)))
;; mouse or local-map bindings
-(cond
- ((eq flyspell-emacs 'xemacs)
- (define-key flyspell-mouse-map [(button2)]
- (function flyspell-correct-word/mouse-keymap))
- (define-key flyspell-mouse-map "\M-\t" 'flyspell-auto-correct-word))
- (flyspell-use-local-map
- (define-key flyspell-mouse-map [(mouse-2)]
- (function flyspell-correct-word/mouse-keymap))
- (define-key flyspell-mouse-map "\M-\t" 'flyspell-auto-correct-word))
- (t
- (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))))
+(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)))
;; the name of the overlay property that defines the keymap
(defvar flyspell-overlay-keymap-property-name
;*---------------------------------------------------------------------*/
;* flyspell-mode-on ... */
;*---------------------------------------------------------------------*/
+(eval-when-compile (defvar flyspell-local-mouse-map))
+
(defun flyspell-mode-on ()
"Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead."
(setq ispell-highlight-face 'flyspell-incorrect-face)
;; (thanks to Jeff Miller and Roland Rosenfeld who sent me this
;; improvement).
(add-hook 'kill-buffer-hook
- '(lambda ()
- (if (and flyspell-multi-language-p ispell-process)
- (ispell-kill-ispell t))))
+ (lambda ()
+ (if (and flyspell-multi-language-p ispell-process)
+ (ispell-kill-ispell t))))
(make-local-hook 'change-major-mode-hook)
(add-hook 'change-major-mode-hook 'flyspell-mode-off)
+ ;; 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))
;; we end with the flyspell hooks
(run-hooks 'flyspell-mode-hook))
(if flyspell-use-local-map
(overlay-put flyspell-overlay
flyspell-overlay-keymap-property-name
- flyspell-mouse-map))))
+ flyspell-local-mouse-map))))
;*---------------------------------------------------------------------*/
;* flyspell-highlight-incorrect-region ... */
(progn
(delete-region start end)
(insert word))))))
- ((string-match "XEmacs" (emacs-version))
+ ((eq flyspell-emacs 'xemacs)
(flyspell-xemacs-popup
event poss word cursor-location start end)))
(ispell-pdict-save t))