[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67158: [PATCH] Repair tab-always-indent
From: |
Stefan Monnier |
Subject: |
bug#67158: [PATCH] Repair tab-always-indent |
Date: |
Sat, 25 Nov 2023 10:26:24 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> diff --git a/lisp/indent.el b/lisp/indent.el
> index 89de0a1d7d1..e5f2acdd33b 100644
> --- a/lisp/indent.el
> +++ b/lisp/indent.el
> @@ -171,7 +171,7 @@ prefix argument is ignored."
> (let ((old-tick (buffer-chars-modified-tick))
> (old-point (point))
> (old-indent (current-indentation))
> - (syn (syntax-after (point))))
> + (syn (syntax-class (syntax-after (point)))))
>
> ;; Indent the line.
> (or (not (eq (indent--funcall-widened indent-line-function) 'noindent))
Duh! Yes, of course. And I think this patch is better than the other
since `syntax-after` returns a cons-cell but not a list, so using `memq`
on it is weird (and in addition to that, its `car` is a funny integer
which we usually don't want to compare directly to things like 2).
> The following form will correctly return nil :
>
> (and (memq tab-first-completion
> '(word word-or-paren word-or-paren-or-punct))
> (not (memq 2 syn)))
>
> But this one will return non-nil :
>
> (and (memq tab-first-completion
> '(word-or-paren word-or-paren-or-punct))
> (not (or (eql 4 syn)
> (eql 5 syn))))
>
> Since syn is equal to (2) (we are within a word).
Indeed.
I reworked the code based on your patch and pushed it to `master`.
Thank you, and sorry for the delay (and thanks Eli again for (re)pinging me).
Stefan