From debbugs-submit-bounces@debbugs.gnu.org Sun May 25 11:55:21 2025 Received: (at submit) by debbugs.gnu.org; 25 May 2025 15:55:21 +0000 Received: from localhost ([127.0.0.1]:47102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uJDh2-00023Q-My for submit@debbugs.gnu.org; Sun, 25 May 2025 11:55:21 -0400 Received: from lists.gnu.org ([2001:470:142::17]:57228) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uJDgz-0001yN-L8 for submit@debbugs.gnu.org; Sun, 25 May 2025 11:55:18 -0400 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 1uJDgu-0007pc-6R for bug-auctex@gnu.org; Sun, 25 May 2025 11:55:12 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uJDgs-0002U8-7c for bug-auctex@gnu.org; Sun, 25 May 2025 11:55:11 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-604b9c53f6fso44749a12.2 for ; Sun, 25 May 2025 08:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748188507; x=1748793307; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=kQ6KkL3Ckq2OiyWUS8ThStSgkpl9oHB4gnez0/f5Ps8=; b=ZI+TB80uN4wY4hvkqRuwa71j9NBXTOy4Uq6HrUoLcg2wQIKDx9VKLPue8/K98OyV4T +iLVdPiDg/BuBpGNY6FJthdmt+VMzPSdBf31eJz2MECkprJ2MnDp7JWJPHtKKoyAs1H5 uxrlETfczvZrD6fELjYrVLWSzdTOsT+3SKRjxJQXNnVHhmviO9PhbQWbnWBSJD/mmzHI SwzZwjYjOwDkQf0RYXM+pXaP0XV1oqOGVm6ENSES2SrV+NSuwOM/m+rkpyLbIKjFVsn1 9IEIrN+lsV3bpbIkvsJFcJlpt0UwI+lgwoZitWDKTEXPhiJiYjpmZ0nIKmWfzEp7+Go/ Jj9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748188507; x=1748793307; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kQ6KkL3Ckq2OiyWUS8ThStSgkpl9oHB4gnez0/f5Ps8=; b=d+n2ch7G67a4FZQAH0CRfYR4j3nFs5Mqetn2kOKolb3TkcqxrfI4Y2WSLqWEsrz09X djM7983mwqCb9WG4R2yW3qSzkuw4aeiXqfTNS4MUw70bSGHR1fsicy7Wq1MahPW8V5AD 3Dhp+kP18kmQkBSCpWKJ7Jv8eIE9xXZlXz/4tYoSci7QegWjtWxXjLNIrgeL1Zlu1CG8 msqg0zCvsvvU8HY2+15bokLZFjvWoanr++MRzK9vZiNqb8XR5MapukiREKv5o4MdTZqH MXBSvqDw47Qji8ahsAB+JQpHpueGUSxs75lwWEHy8M92QYMxLw5vLx3PVVg4TPt94ZR3 hYXg== X-Gm-Message-State: AOJu0YxT8h1OPnDS6OR1cmX2f5SI27UrczM+yCKoQpUzCSqmsqoDWgaJ GA4IRnwC8nVPrajuWCkCiAC3v7EehmigMnkVITNtTy0g4bgI9CJzvxKAsnuMuK6u X-Gm-Gg: ASbGncuBcHRKqHNzTL+giccXUaQKdWKLVT+acBG3K4eU8T4Eb8A/CcNiJC5KmdsLU+C 7yXvWIJeXRjLA4iN8GQ82PMbK68fZBYEWaRQNRjpIkkv4BZraoNR6jweZIBHJP0HXUIY7tplQXr e0OePKtVzAI35zTCeGGsVujqidRcot7snrIsrcegyaG2umdCNxIiSsfiAAxir3ETrhdmfaBArzq U+TqEBqG0lbUXM/X8IMYkcGtPQcq9IIJX82mshmZ9hRD7Y6Sp5H4qeXjN1ebnZ1MhDlti3FPiv9 3JNPyPU4f+SJydiLNJ2ZwsshzTE77FUYOIjpcLOWVIub0J2DcBT+8fPMkg== X-Google-Smtp-Source: AGHT+IGc2IlpXR/6nDZjUtELtZ605F/ZaPc9AN4LQRpmSYcaY6eANEkLvr6RjFhyuY2te99fWgSe3w== X-Received: by 2002:a05:6402:90d:b0:602:3b60:926e with SMTP id 4fb4d7f45d1cf-602da1f0d5cmr4573878a12.10.1748188507033; Sun, 25 May 2025 08:55:07 -0700 (PDT) Received: from localhost ([185.229.154.237]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-604586f9b4esm1603713a12.12.2025.05.25.08.55.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 May 2025 08:55:06 -0700 (PDT) From: "Paul D. Nelson" To: bug-auctex@gnu.org Subject: [PATCH] Fix math macro folding to not consume subsequent brackets Date: Sun, 25 May 2025 17:55:05 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=ultrono@gmail.com; helo=mail-ed1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Hi again, Folding $x \in [0,1]$ doesn't work as intended: [0,1] gets folded as if it were an optional argument to \in. The issue is that, when called on 'math macros, TeX-fold-item-end calls TeX-find-macro, which skips past any {...} or [...]. The attached patch makes an expection in TeX-fold-item-end for 'math macros, so that only the macro name itself (e.g., "\in") is folded. This only affects the folding of macros in the list TeX-fold-math-spec-list-internal, and looking through that list, I didn't spot any for which this change would have an undesired effect. Any feedback welcome. Thanks, best, Paul --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-math-macro-folding-to-not-consume-subsequent-bra.patch >From 83db375da4ea71b5abae3c010f2160f87086e850 Mon Sep 17 00:00:00 2001 From: Paul Nelson Date: Sun, 25 May 2025 17:54:15 +0200 Subject: [PATCH] Fix math macro folding to not consume subsequent brackets * tex-fold.el (TeX-fold-item-end): Add special handling for math macros to only fold the macro name itself, not following arguments. For instance, in "$x \in [0,1]$", this prevents folding [0,1] as an optional argument to \in. --- tex-fold.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tex-fold.el b/tex-fold.el index 766270ef..78e5b822 100644 --- a/tex-fold.el +++ b/tex-fold.el @@ -901,6 +901,12 @@ TYPE can be either `env' for environments, `macro' for macros or (goto-char (1+ start)) (LaTeX-find-matching-end) (point)) + ((eq type 'math) + (goto-char (1+ start)) + (if (zerop (skip-chars-forward "A-Za-z@")) + (forward-char) + (skip-chars-forward "*")) + (point)) (t (goto-char start) (TeX-find-macro-end))))) -- 2.39.3 (Apple Git-145) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri May 30 11:21:21 2025 Received: (at 78588-done) by debbugs.gnu.org; 30 May 2025 15:21:21 +0000 Received: from localhost ([127.0.0.1]:49444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uL1Xt-00056Z-4c for submit@debbugs.gnu.org; Fri, 30 May 2025 11:21:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36588) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uL1Xp-000564-2k for 78588-done@debbugs.gnu.org; Fri, 30 May 2025 11:21:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uL1Xg-0003pJ-Qq; Fri, 30 May 2025 11:21:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=fy8lxSYnKYjjZ9GhPaZG19yWgQRgxHrJYrZw7a8+Xck=; b=e+Tg47SnKW+wcyHV08Lr 6ZY+TWRI8r74EHRWS8+ZgVdcbKiu+GtI9WBi631s/bktp2MYn0o2pi28XVdoCTon6fyAP8LHAdjgR 2aVQhPG7YEn19N4k3DPbjKf6lhAeSOVNNK9HVRCpnIJ5cCJ6GqLejfb9CikvLyvJl2EuzsCrzH8G6 bA14cee/whS8Addy0ufDOvnRQ3HoPOZOau0+smlAN9IGsxW4M9JJj+l0VkKVQd38mCXDwbFVy5Njr BAvwxEbQr/X8Qt6QcFS4D31dGKvLQP24ySDXcHDcwn69GII8YwhyUFCvo9qFtxBlnL3gwI28mk1nG Mp5/7CVNGJHmxQ==; From: Arash Esbati To: "Paul D. Nelson" Subject: Re: bug#78588: [PATCH] Fix math macro folding to not consume subsequent brackets In-Reply-To: References: Date: Fri, 30 May 2025 17:21:04 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78588-done Cc: 78588-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) "Paul D. Nelson" writes: > Folding $x \in [0,1]$ doesn't work as intended: [0,1] gets folded as if it > were an optional argument to \in. > > The issue is that, when called on 'math macros, TeX-fold-item-end calls > TeX-find-macro, which skips past any {...} or [...]. > > The attached patch makes an expection in TeX-fold-item-end for 'math > macros, so that only the macro name itself (e.g., "\in") is folded. > > This only affects the folding of macros in the list > TeX-fold-math-spec-list-internal, and looking through that list, I > didn't spot any for which this change would have an undesired effect. I installed that change. Again, many thanks, closing. Best, Arash