summaryrefslogtreecommitdiff
path: root/lisp/textmodes/flyspell.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2017-04-30 21:55:58 +0300
committerEli Zaretskii <eliz@gnu.org>2017-04-30 21:55:58 +0300
commit3ad9d5c347739bb6c5450ed443ffa1608a94394c (patch)
tree3614d7b7550159f58e1a3bd7c7f4f2062773b9ff /lisp/textmodes/flyspell.el
parent0943cc18b18e2df90c7aa0fbc4dab72d418aa700 (diff)
downloademacs-3ad9d5c347739bb6c5450ed443ffa1608a94394c.tar.gz
Don't lose key bindings on mis-spelled text in flyspell-mode
* lisp/textmodes/flyspell.el (flyspell-mouse-map): Bind mouse-2 explicitly. (make-flyspell-overlay): If the mis-spelled text already has a 'keymap' property, make that keymap the parent of flyspell-mouse-map, so as not to lose the parent's bindings. (Bug#26672)
Diffstat (limited to 'lisp/textmodes/flyspell.el')
-rw-r--r--lisp/textmodes/flyspell.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 0edf9b1a47e..ecf729d15b7 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -447,7 +447,9 @@ like <img alt=\"Some thing.\">."
;;* The minor mode declaration. */
;;*---------------------------------------------------------------------*/
(defvar flyspell-mouse-map
- (make-sparse-keymap)
+ (let ((map (make-sparse-keymap)))
+ (define-key map [mouse-2] 'flyspell-correct-word)
+ map)
"Keymap for Flyspell to put on erroneous words.")
(defvar flyspell-mode-map
@@ -1759,6 +1761,9 @@ for the overlay."
(overlay-put overlay 'flyspell-overlay t)
(overlay-put overlay 'evaporate t)
(overlay-put overlay 'help-echo "mouse-2: correct word at point")
+ ;; If misspelled text has a 'keymap' property, let that remain in
+ ;; effect for the bindings that flyspell-mouse-map doesn't override.
+ (set-keymap-parent flyspell-mouse-map (get-char-property beg 'keymap))
(overlay-put overlay 'keymap flyspell-mouse-map)
(when (eq face 'flyspell-incorrect)
(and (stringp flyspell-before-incorrect-word-string)