aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAymeric Agon-Rambosson2023-11-25 10:07:49 -0500
committerStefan Monnier2023-11-25 10:24:39 -0500
commitc20226a1ef5fbdfd3e71e2ef8654ee19994c0f2f (patch)
treebf2b8d8ccb593e4ed9f1fbbcaf020954c542948f
parentefae0e68efc79bc5eb7c86a30c127006d3b374e2 (diff)
downloademacs-c20226a1ef5fbdfd3e71e2ef8654ee19994c0f2f.tar.gz
emacs-c20226a1ef5fbdfd3e71e2ef8654ee19994c0f2f.zip
Repair `tab-first-completion` (bug#67158)
Copyright-paperwork-exempt: yes * lisp/indent.el (indent-for-tab-command): Use `syntax-class` to fix longstanding thinko introduced back in 2020 in commit 64c851166442. Rework the check for `syn` because TAB always completed when `tab-first-completion` had value `word-or-paren` or `word-or-paren-or-punct`.
-rw-r--r--lisp/indent.el24
1 files changed, 9 insertions, 15 deletions
diff --git a/lisp/indent.el b/lisp/indent.el
index 89de0a1d7d1..f64049d64b2 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -170,8 +170,7 @@ prefix argument is ignored."
170 (t 170 (t
171 (let ((old-tick (buffer-chars-modified-tick)) 171 (let ((old-tick (buffer-chars-modified-tick))
172 (old-point (point)) 172 (old-point (point))
173 (old-indent (current-indentation)) 173 (old-indent (current-indentation)))
174 (syn (syntax-after (point))))
175 174
176 ;; Indent the line. 175 ;; Indent the line.
177 (or (not (eq (indent--funcall-widened indent-line-function) 'noindent)) 176 (or (not (eq (indent--funcall-widened indent-line-function) 'noindent))
@@ -185,19 +184,14 @@ prefix argument is ignored."
185 ((and (eq tab-always-indent 'complete) 184 ((and (eq tab-always-indent 'complete)
186 (eql old-point (point)) 185 (eql old-point (point))
187 (eql old-tick (buffer-chars-modified-tick)) 186 (eql old-tick (buffer-chars-modified-tick))
188 (or (null tab-first-completion) 187 (or (eq last-command this-command)
189 (eq last-command this-command) 188 (let ((syn (syntax-class (syntax-after (point)))))
190 (and (eq tab-first-completion 'eol) 189 (pcase tab-first-completion
191 (eolp)) 190 ('nil t)
192 (and (memq tab-first-completion 191 ('eol (eolp))
193 '(word word-or-paren word-or-paren-or-punct)) 192 ('word (not (eql 2 syn)))
194 (not (eql 2 syn))) 193 ('word-or-paren (not (memql syn '(2 4 5))))
195 (and (memq tab-first-completion 194 ('word-or-paren-or-punct (not (memq syn '(2 4 5 1))))))))
196 '(word-or-paren word-or-paren-or-punct))
197 (not (or (eql 4 syn)
198 (eql 5 syn))))
199 (and (eq tab-first-completion 'word-or-paren-or-punct)
200 (not (eql 1 syn)))))
201 (completion-at-point)) 195 (completion-at-point))
202 196
203 ;; If a prefix argument was given, rigidly indent the following 197 ;; If a prefix argument was given, rigidly indent the following