diff options
| author | Eshel Yaron | 2024-01-20 12:24:32 +0100 |
|---|---|---|
| committer | Eli Zaretskii | 2024-01-27 11:53:17 +0200 |
| commit | f0c573d8069f7ee654a550ae3d148325c49900a3 (patch) | |
| tree | 5b885414336a5f9169abbd199e47ed9d2bbd1aa9 | |
| parent | fa7543eeb72342544d324a54010b6cb96c246733 (diff) | |
| download | emacs-f0c573d8069f7ee654a550ae3d148325c49900a3.tar.gz emacs-f0c573d8069f7ee654a550ae3d148325c49900a3.zip | |
Optionally avoid extending 'completion-at-point-functions'
It is now possible to avoid extending
'completion-at-point-functions' in Text mode and its descendants.
* lisp/textmodes/text-mode.el
(text-mode-meta-tab-ispell-complete-word): Rename to...
(text-mode-ispell-word-completion): ...this. Extend with another
option 'completion-at-point'.
(text-mode): Only extend 'completion-at-point-functions' when
'text-mode-ispell-word-completion' is 'completion-at-point'.
(Bug#67527)
* etc/NEWS: Update the entry about 'M-TAB' in Text mode.
| -rw-r--r-- | etc/NEWS | 13 | ||||
| -rw-r--r-- | lisp/textmodes/text-mode.el | 19 |
2 files changed, 21 insertions, 11 deletions
| @@ -1346,12 +1346,13 @@ files and save the changes. | |||
| 1346 | 1346 | ||
| 1347 | +++ | 1347 | +++ |
| 1348 | ** 'M-TAB' now invokes 'completion-at-point' also in Text mode. | 1348 | ** 'M-TAB' now invokes 'completion-at-point' also in Text mode. |
| 1349 | Text mode no longer binds 'M-TAB' to 'ispell-complete-word', and | 1349 | By default, Text mode no longer binds 'M-TAB' to |
| 1350 | instead this mode arranges for 'completion-at-point', globally bound | 1350 | 'ispell-complete-word'. Instead this mode arranges for |
| 1351 | to 'M-TAB', to perform word completion as well. If you want 'M-TAB' | 1351 | 'completion-at-point', globally bound to 'M-TAB', to perform word |
| 1352 | to invoke 'ispell-complete-word', as it did in previous Emacs | 1352 | completion as well. You can have Text mode bind 'M-TAB' to |
| 1353 | versions, customize the new user option | 1353 | 'ispell-complete-word' as it did in previous Emacs versions, or |
| 1354 | 'text-mode-meta-tab-ispell-complete-word' to non-nil. | 1354 | disable Ispell word completion in Text mode altogether, by customizing |
| 1355 | the new user option 'text-mode-ispell-word-completion'. | ||
| 1355 | 1356 | ||
| 1356 | ** 'pp' and 'pp-to-string' now always include a terminating newline. | 1357 | ** 'pp' and 'pp-to-string' now always include a terminating newline. |
| 1357 | In the past they included a terminating newline in most cases but not all. | 1358 | In the past they included a terminating newline in most cases but not all. |
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 7d3b47a9c03..87f6668cecb 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el | |||
| @@ -75,8 +75,15 @@ | |||
| 75 | Many other modes, such as `mail-mode' and `outline-mode', inherit | 75 | Many other modes, such as `mail-mode' and `outline-mode', inherit |
| 76 | all the commands defined in this map.") | 76 | all the commands defined in this map.") |
| 77 | 77 | ||
| 78 | (defcustom text-mode-meta-tab-ispell-complete-word nil | 78 | (defcustom text-mode-ispell-word-completion 'completion-at-point |
| 79 | "Whether M-TAB invokes `ispell-complete-word' in Text mode. | 79 | "How Text mode provides Ispell word completion. |
| 80 | |||
| 81 | By default, this option is set to `completion-at-point', which | ||
| 82 | means that Text mode adds an Ispell word completion function to | ||
| 83 | `completion-at-point-functions'. Any other non-nil value says to | ||
| 84 | bind M-TAB directly to `ispell-complete-word' instead. If this | ||
| 85 | is nil, Text mode neither binds M-TAB to `ispell-complete-word' | ||
| 86 | nor does it extend `completion-at-point-functions'. | ||
| 80 | 87 | ||
| 81 | This user option only takes effect when you customize it in | 88 | This user option only takes effect when you customize it in |
| 82 | Custom or with `setopt', not with `setq'." | 89 | Custom or with `setopt', not with `setq'." |
| @@ -84,8 +91,9 @@ Custom or with `setopt', not with `setq'." | |||
| 84 | :type 'boolean | 91 | :type 'boolean |
| 85 | :version "30.1" | 92 | :version "30.1" |
| 86 | :set (lambda (sym val) | 93 | :set (lambda (sym val) |
| 87 | (if (set sym val) | 94 | (if (and (set sym val) |
| 88 | (keymap-set text-mode-map "C-M-i" #'ispell-complete-word) | 95 | (not (eq val 'completion-at-point))) |
| 96 | (keymap-set text-mode-map "C-M-i" #'ispell-complete-word) | ||
| 89 | (keymap-unset text-mode-map "C-M-i" t)))) | 97 | (keymap-unset text-mode-map "C-M-i" t)))) |
| 90 | 98 | ||
| 91 | (easy-menu-define text-mode-menu text-mode-map | 99 | (easy-menu-define text-mode-menu text-mode-map |
| @@ -144,7 +152,8 @@ Turning on Text mode runs the normal hook `text-mode-hook'." | |||
| 144 | ;; Enable text conversion in this buffer. | 152 | ;; Enable text conversion in this buffer. |
| 145 | (setq-local text-conversion-style t) | 153 | (setq-local text-conversion-style t) |
| 146 | (add-hook 'context-menu-functions 'text-mode-context-menu 10 t) | 154 | (add-hook 'context-menu-functions 'text-mode-context-menu 10 t) |
| 147 | (add-hook 'completion-at-point-functions #'ispell-completion-at-point 10 t)) | 155 | (when (eq text-mode-ispell-word-completion 'completion-at-point) |
| 156 | (add-hook 'completion-at-point-functions #'ispell-completion-at-point 10 t))) | ||
| 148 | 157 | ||
| 149 | (define-derived-mode paragraph-indent-text-mode text-mode "Parindent" | 158 | (define-derived-mode paragraph-indent-text-mode text-mode "Parindent" |
| 150 | "Major mode for editing text, with leading spaces starting a paragraph. | 159 | "Major mode for editing text, with leading spaces starting a paragraph. |