aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEshel Yaron2024-01-20 12:24:32 +0100
committerEli Zaretskii2024-01-27 11:53:17 +0200
commitf0c573d8069f7ee654a550ae3d148325c49900a3 (patch)
tree5b885414336a5f9169abbd199e47ed9d2bbd1aa9
parentfa7543eeb72342544d324a54010b6cb96c246733 (diff)
downloademacs-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/NEWS13
-rw-r--r--lisp/textmodes/text-mode.el19
2 files changed, 21 insertions, 11 deletions
diff --git a/etc/NEWS b/etc/NEWS
index d69d0001135..b249f7e1ecb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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.
1349Text mode no longer binds 'M-TAB' to 'ispell-complete-word', and 1349By default, Text mode no longer binds 'M-TAB' to
1350instead this mode arranges for 'completion-at-point', globally bound 1350'ispell-complete-word'. Instead this mode arranges for
1351to '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
1352to invoke 'ispell-complete-word', as it did in previous Emacs 1352completion as well. You can have Text mode bind 'M-TAB' to
1353versions, 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. 1354disable Ispell word completion in Text mode altogether, by customizing
1355the 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.
1357In the past they included a terminating newline in most cases but not all. 1358In 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 @@
75Many other modes, such as `mail-mode' and `outline-mode', inherit 75Many other modes, such as `mail-mode' and `outline-mode', inherit
76all the commands defined in this map.") 76all 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
81By default, this option is set to `completion-at-point', which
82means that Text mode adds an Ispell word completion function to
83`completion-at-point-functions'. Any other non-nil value says to
84bind M-TAB directly to `ispell-complete-word' instead. If this
85is nil, Text mode neither binds M-TAB to `ispell-complete-word'
86nor does it extend `completion-at-point-functions'.
80 87
81This user option only takes effect when you customize it in 88This user option only takes effect when you customize it in
82Custom or with `setopt', not with `setq'." 89Custom 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.