From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#67158: [PATCH] Repair tab-always-indent Date: Sat, 25 Nov 2023 10:26:24 -0500 Message-ID: References: <87msvhqkx6.fsf@X570GP> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39310"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 67158@debbugs.gnu.org To: Aymeric Agon-Rambosson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 25 16:27:25 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6uZ2-000A0t-EI for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Nov 2023 16:27:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6uYd-0006dJ-6M; Sat, 25 Nov 2023 10:26:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6uYb-0006d6-C2 for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 10:26:57 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r6uYb-0008Rm-2k for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 10:26:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r6uYg-00038O-5Q for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 10:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Nov 2023 15:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67158 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67158-submit@debbugs.gnu.org id=B67158.170092599912011 (code B ref 67158); Sat, 25 Nov 2023 15:27:02 +0000 Original-Received: (at 67158) by debbugs.gnu.org; 25 Nov 2023 15:26:39 +0000 Original-Received: from localhost ([127.0.0.1]:40031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6uYJ-00037f-0d for submit@debbugs.gnu.org; Sat, 25 Nov 2023 10:26:39 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6uYH-00037R-2d for 67158@debbugs.gnu.org; Sat, 25 Nov 2023 10:26:37 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id F12B11000AD; Sat, 25 Nov 2023 10:26:25 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1700925985; bh=oP7T8aBhW6D4aK+WW6ZK/NfNFOZNtvzARwJBIsoseSA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Qzm9SNv/iYLW8PE9oGPP01SUOIdhPbZcb+qccoexPYlFl5dyQShdLZZTFGszw3qC5 NiQpAHQrNuhMCbF/Phk+l1z11tpnxzFnCm45LXtj367WTmSX5wcdao0qt8zdWCGUZT CWli4/1QHPRfUVBpEA5KeBCjI6so6Ogj4PV6BPys1xDph93lawYNojUShFaQn11ahm Wl4HbXGtOgqpem02QM1Q3INuDBKwe2ZnsB8U8FzMdcRQ1bEe9icFNbIf4XzPeWyW3Z eRf5BO8I1FsZPYeJCX2770Ij9VWeSZ32umaXUEAn6IFZ578yFnXTmLWdbfzEAHS7Ud FO5gDnaNJ0ulQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 41A76100043; Sat, 25 Nov 2023 10:26:25 -0500 (EST) Original-Received: from pastel (unknown [45.72.227.120]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1CC0312043F; Sat, 25 Nov 2023 10:26:25 -0500 (EST) In-Reply-To: <87msvhqkx6.fsf@X570GP> (Aymeric Agon-Rambosson's message of "Tue, 14 Nov 2023 00:43:17 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274990 Archived-At: > 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