all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Aymeric Agon-Rambosson <aymeric.agon@yandex.com>
Cc: 67158@debbugs.gnu.org
Subject: bug#67158: [PATCH] Repair tab-always-indent
Date: Sat, 25 Nov 2023 10:26:24 -0500	[thread overview]
Message-ID: <jwva5r127rh.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87msvhqkx6.fsf@X570GP> (Aymeric Agon-Rambosson's message of "Tue, 14 Nov 2023 00:43:17 +0100")

> 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






  parent reply	other threads:[~2023-11-25 15:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13 23:43 bug#67158: [PATCH] Repair tab-always-indent Aymeric Agon-Rambosson
2023-11-14 12:39 ` Eli Zaretskii
2023-11-15  0:24   ` Aymeric Agon-Rambosson
2023-11-25  9:31 ` Eli Zaretskii
2023-11-25 15:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-11-26  9:42   ` Aymeric Agon-Rambosson
2023-11-26 13:56     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-29 14:25       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwva5r127rh.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=67158@debbugs.gnu.org \
    --cc=aymeric.agon@yandex.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.