mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-12 15:10:50 +00:00
Allow to invoke original M-TAB binding in 'flyspell-prog-mode'
* lisp/textmodes/flyspell.el (flyspell-prog-mode): Record the original M-TAB binding in a buffer-local variable. (flyspell-auto-correct-word): Invoke the original binding of M-TAB if that is recorded, when point is in a place where flyspell should not be active (e.g., because the user turned on 'flyspell-prog-mode'). (Bug#18533)
This commit is contained in:
parent
bb83bb11f9
commit
6d11f6ed9a
1 changed files with 111 additions and 99 deletions
|
@ -399,6 +399,9 @@ like <img alt=\"Some thing.\">."
|
|||
(interactive)
|
||||
(setq flyspell-generic-check-word-predicate
|
||||
#'flyspell-generic-progmode-verify)
|
||||
(setq-local flyspell--prev-meta-tab-binding
|
||||
(or (local-key-binding "\M-\t" t)
|
||||
(global-key-binding "\M-\t" t)))
|
||||
(flyspell-mode 1)
|
||||
(run-hooks 'flyspell-prog-mode-hook))
|
||||
|
||||
|
@ -1904,6 +1907,15 @@ before point that's highlighted as misspelled."
|
|||
"Correct the current word.
|
||||
This command proposes various successive corrections for the current word."
|
||||
(interactive)
|
||||
;; If we are not in the construct where flyspell should be active,
|
||||
;; invoke the original binding of M-TAB, if that was recorded.
|
||||
(if (and (local-variable-p 'flyspell--prev-meta-tab-binding)
|
||||
(commandp flyspell--prev-meta-tab-binding t)
|
||||
(fboundp flyspell-generic-check-word-predicate)
|
||||
(not (funcall flyspell-generic-check-word-predicate))
|
||||
(equal (where-is-internal 'flyspell-auto-correct-word nil t)
|
||||
[?\M-\t]))
|
||||
(call-interactively flyspell--prev-meta-tab-binding)
|
||||
(let ((pos (point))
|
||||
(old-max (point-max)))
|
||||
;; Use the correct dictionary.
|
||||
|
@ -2002,7 +2014,7 @@ This command proposes various successive corrections for the current word."
|
|||
(point)
|
||||
old-max))))))))))
|
||||
(setq flyspell-auto-correct-pos (point))
|
||||
(ispell-pdict-save t)))))))
|
||||
(ispell-pdict-save t))))))))
|
||||
|
||||
;;*---------------------------------------------------------------------*/
|
||||
;;* flyspell-auto-correct-previous-pos ... */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue