From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken Resent-From: Rahguzar Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Wed, 04 Jun 2025 08:49:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: 78693@debbugs.gnu.org Cc: ultrono@gmail.com X-Debbugs-Original-To: bug-auctex@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174902694030437 (code B ref -1); Wed, 04 Jun 2025 08:49:03 +0000 Received: (at submit) by debbugs.gnu.org; 4 Jun 2025 08:49:00 +0000 Received: from localhost ([127.0.0.1]:46941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uMjnu-0007uX-DJ for submit@debbugs.gnu.org; Wed, 04 Jun 2025 04:48:59 -0400 Received: from lists.gnu.org ([2001:470:142::17]:60446) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uMjnq-0007st-Lx for submit@debbugs.gnu.org; Wed, 04 Jun 2025 04:48:56 -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 1uMjnk-0006Qx-6y for bug-auctex@gnu.org; Wed, 04 Jun 2025 04:48:48 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1uMjni-0001kl-4B for bug-auctex@gnu.org; Wed, 04 Jun 2025 04:48:47 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4bC1Sx09MGz9sd7; Wed, 4 Jun 2025 10:48:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1749026913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=G/mvT4XMsfv0Ays0qYYtXaZV/1aDZIGZVOF/OVgkNns=; b=OWmgEryPIRAgUo92AtqfvwVTOo4xvquPuQNmzC7McW8BUxJBfhqbveDbnhMsaEgk9TCT5m ZcW3AxJBQB8A7NSwjRtuHulDirDBRDA1yzMMOFbIorvGarErymQ9+9CzY76uERpo6suK21 +53g2LiiO1XpNZdSJyupBgx8Jl3fXJE8oySTGnwmFnaOc5udarAS+p0EJpo0LyyEmqGNFD 7kI5kvW4cN8iUMdVa9LHWgkUadmZxBOeboTnKe6GRLBO9XoyDtmQlZxpDq+Q1372VewQcS grg5V+UPtW7buqIgrB38jXVN6ZN+/KKb9XwnQ2CK+UwpfEqVh9Z234m64A9vyg== From: Rahguzar Date: Wed, 04 Jun 2025 13:48:28 +0500 Message-ID: <87bjr3nb8j.fsf@mailbox.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-MBO-RS-META: ddiz8bzzszs3xzhf3cm84xmtautzfpxz X-MBO-RS-ID: ce2494cff2d64b24087 Received-SPF: pass client-ip=80.241.56.151; envelope-from=rahguzar@mailbox.org; helo=mout-p-101.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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-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 Dear AucTeX maintainers, The commits d0a57d8d Fix math macro folding to not consume subsequent brackets 33f9eb07 Fix TeX macro end detection in some edge cases break the folding of math macros with a function spec. E.g. evaluate (setq TeX-fold-math-spec-list `((,(lambda (text) (propertize text 'face '(underline))) ("underline")))) and open the attached file. Do `M-x TeX-fold-mode RET` followed by `M-x TeX-fold-buffer RET`. This results in [Error: no content or function found] getting displayed instead of \underline. My config has many folding specs which are functions and all of them exhibit the same behavior. Reverting the commits above fixes the issue. Thanks, Rahguzar Emacs : GNU Emacs 30.1 (build 1, aarch64-redhat-linux-gnu, GTK+ Version 3.24.49, cairo version 1.18.2) of 2025-04-08 Package: 14.0.9 current state: ============== (setq window-system 'pgtk LaTeX-version "2e" TeX-style-path '("/home/azeem/.local/state/emacs/auctex/" "/home/azeem/.local/state/emacs/elpaca/builds/auctex/style" "/home/azeem/.local/state/emacs/auctex/auto" "/home/azeem/.local/state/emacs/auctex/style" "auto" "style") TeX-auto-save nil TeX-parse-self nil TeX-master t TeX-command-list '(("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %(output-dir) %t" TeX-run-TeX nil (plain-TeX-mode AmSTeX-mode Texinfo-mode) :help "Run plain TeX") ("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil (LaTeX-mode docTeX-mode) :help "Run LaTeX") ("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t" TeX-run-compile nil (Texinfo-mode) :help "Run Makeinfo with Info output") ("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) --html %t" TeX-run-compile nil (Texinfo-mode) :help "Run Makeinfo with HTML output") ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %(output-dir) %t" TeX-run-TeX nil (AmSTeX-mode) :help "Run AMSTeX") ("ConTeXt" "%(cntxcom) --once %(extraopts) %(execopts)%t" TeX-run-TeX nil (ConTeXt-mode) :help "Run ConTeXt once") ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil (ConTeXt-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %(O?aux)" TeX-run-BibTeX nil (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode ConTeXt-mode) :help "Run BibTeX") ("Biber" "biber %(output-dir) %s" TeX-run-Biber nil (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run Biber") ("Texindex" "texindex %s.??" TeX-run-command nil (Texinfo-mode) :help "Run Texindex") ("Texi2dvi" "%(PDF)texi2dvi %t" TeX-run-command nil (Texinfo-mode) :help "Run Texi2dvi or Texi2pdf") ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file") ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Generate PostScript file") ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Convert DVI file to PostScript") ("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" TeX-run-dvipdfmx nil (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Convert DVI file to PDF with dvipdfmx") ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Convert PostScript file to PDF") ("LaTeXMk" "latexmk %(latexmk-out) %(file-line-error) %(output-dir) %`%(extraopts) %S%(mode)%' %t" TeX-run-TeX nil (LaTeX-mode docTeX-mode) :help "Run LaTeXMk") ("Glossaries" "makeglossaries %(d-dir) %s" TeX-run-command nil (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run makeglossaries to create glossary file") ("Index" "makeindex %(O?idx)" TeX-run-index nil (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run makeindex to create index file") ("upMendex" "upmendex %(O?idx)" TeX-run-index t (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run upmendex to create index file") ("Xindy" "texindy %s" TeX-run-command nil (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run xindy to create index file") ("Check" "lacheck %s" TeX-run-compile nil (LaTeX-mode) :help "Check LaTeX file for correctness") ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (LaTeX-mode) :help "Check LaTeX file for common mistakes") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files") ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command")) ) --=-=-= Content-Type: application/x-tex Content-Disposition: attachment; filename=test.tex Content-Transfer-Encoding: base64 XGRvY3VtZW50Y2xhc3N7YXJ0aWNsZX0KClxiZWdpbntkb2N1bWVudH0KJFx1bmRlcmxpbmV7YWJj fSQKXGVuZHtkb2N1bWVudH0K --=-=-=-- From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken References: <87bjr3nb8j.fsf@mailbox.org> Resent-From: "Paul D. Nelson" Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Wed, 04 Jun 2025 10:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Rahguzar Cc: 78693@debbugs.gnu.org X-Debbugs-Original-Cc: bug-auctex@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174903314321924 (code B ref -1); Wed, 04 Jun 2025 10:33:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Jun 2025 10:32:23 +0000 Received: from localhost ([127.0.0.1]:47651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uMlPy-0005hW-Sc for submit@debbugs.gnu.org; Wed, 04 Jun 2025 06:32:23 -0400 Received: from lists.gnu.org ([2001:470:142::17]:54224) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uMlPv-0005h3-VS for submit@debbugs.gnu.org; Wed, 04 Jun 2025 06:32:20 -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 1uMlPp-0004w2-J8 for bug-auctex@gnu.org; Wed, 04 Jun 2025 06:32:13 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uMlPn-0006g8-Ku for bug-auctex@gnu.org; Wed, 04 Jun 2025 06:32:13 -0400 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-3105ef2a08dso55208461fa.0 for ; Wed, 04 Jun 2025 03:32:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749033130; x=1749637930; darn=gnu.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=9AS3n6R4jfnvaDM5RJ0RzshwYQim/zCVvO9Bgk59Bjw=; b=ZUxJd0QhbzcWfI7C7EE4gfGPTHr7KDwshg9XaqmCIE12HFmCpc4J5gd/a5hJBWWS/s 94bhVkckt4COfWk4CnA1ON/QhTfoNMbTAzoiaYVSVfzhElvY39sUUYvtrWdYshx6fFyw 2a20cxRZZlU7pVfOBgxKxT+xfOXUotXfiscYCkH5IU6cYn7Z/sQ4mk+v5vPJ7imtp5yw rfNQKn02Lr8bu+ms25vcDY1B2Fygmdz/lNhkLHjo/KCzqyMWxVZMOmyhtwYV0uya2ey7 5SOMUJRk1fwj+J0KTcdoJcM5Liy2xQAodYIuw92P+Vqa+t3xur49WcnAmpRgJAZZMyT6 3DBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749033130; x=1749637930; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9AS3n6R4jfnvaDM5RJ0RzshwYQim/zCVvO9Bgk59Bjw=; b=iqKQR+bpH4F+rOSWmQeKqAXGYI7ftNGw6IAohwlNYHjRbqr73tK8pqzxPRmp+33o2w sT6G2cspFYwDH3qg7ow5ErfNaiKmQTIM6x9nmXlNbWZTfnQtMvwdbHxve7bipmFPpoxY gon2Bp83rbhs/8NMawVRl7UiJiGIXm4ej1gm47gu8w0oVx7gNKelGW1sTDhRxaJuBc9r 3UzySF+PjSxDdSBTn8odlyGmuM6e4Hz6YiRbEJV0/B5j4DYtyX6b9hE5XDxoQ9DNnl9g ad5sxNN3RVDfariZWJKbl8GKIZYAM6nVWVFfViRo5RTF5uNljZB9BkPC1bnkQ/Mw4Fzk 5n6Q== X-Gm-Message-State: AOJu0YySQXQsNtU2BBzF/KCTegSzT/x+OrdnIFyxQIDMxWvaF4ZQBnBd MkxQA+/MYvj5lgtmvQ/QG8YxNNhWa1ZSq0Ep1Le1j6c/kL53ORlfHceo X-Gm-Gg: ASbGncszIrY5FVEWIGj5z9HtQrCkYxOqgwMY7VESMmfbTEUrRzp67ryCZ4bgY3muiJU 8qWLsbyOTyqMjadUnYi+E2TPF3W/T94fiN31BccVMFG/5wy1/eA/RiWm36s79sLGRvcsO6I9l4C G0Bw/RPIxBSWBIEv0tiacw7LGcTbX0yxZvWghIcLKafn4uxw6wJKHvQuTtfGWMYHAb59DoBSB9s lPS75axI+GoMMhRpfO/7ooKZ4E+Ch+kG1iMk5SS0DnhwSMmmqcpLq64ZWgtg2GFis87kiMyOkHx DyN6KaRcFLNi8a3ghuw+pvq7mH7wDz1mF+S1mqKOfzLnC+ET+os8IKb3giOLnY/U+0pax9f1vFc n1W1UldKJ9P30hCuMBtjBH299jgfhbQ== X-Google-Smtp-Source: AGHT+IErFpJSigw5Fg06S8X5DbolxoNHU33PuIEKmwuL4q0RazKPrr2PZIr1Lxr6maDFHIRVinaa6Q== X-Received: by 2002:a2e:b8c6:0:b0:32a:7f39:1a2a with SMTP id 38308e7fff4ca-32ac71d986fmr6142971fa.16.1749033129581; Wed, 04 Jun 2025 03:32:09 -0700 (PDT) Received: from localhost (wlan-eduroam-130-237-240-154.su.se. [130.237.240.154]) by smtp.gmail.com with UTF8SMTPSA id 38308e7fff4ca-32a85bd26e5sm20847551fa.96.2025.06.04.03.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jun 2025 03:32:09 -0700 (PDT) From: "Paul D. Nelson" In-Reply-To: <87bjr3nb8j.fsf@mailbox.org> (message from Rahguzar on Wed, 04 Jun 2025 13:48:28 +0500) Date: Wed, 04 Jun 2025 12:32:08 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=ultrono@gmail.com; helo=mail-lj1-x230.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-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 (/) Thanks Raghuzar. The issue is the result of this change: --8<---------------cut here---------------start------------->8--- 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))))) --8<---------------cut here---------------end--------------->8--- The intent here was that "math macros" built-in to tex-fold don't take arguments, but this is not the case for the custom one you provide. > (setq TeX-fold-math-spec-list `((,(lambda (text) (propertize text 'face '(underline))) ("underline")))) Is there a reason to prefer this vs. the same with TeX-fold-macro-spec-list in place of TeX-fold-math-spec-list? Paul From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken References: <87bjr3nb8j.fsf@mailbox.org> Resent-From: "Paul D. Nelson" Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Fri, 06 Jun 2025 09:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Rahguzar Cc: 78693@debbugs.gnu.org Received: via spool by 78693-submit@debbugs.gnu.org id=B78693.174920275627876 (code B ref 78693); Fri, 06 Jun 2025 09:40:01 +0000 Received: (at 78693) by debbugs.gnu.org; 6 Jun 2025 09:39:16 +0000 Received: from localhost ([127.0.0.1]:41933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNTXf-0007FV-Qw for submit@debbugs.gnu.org; Fri, 06 Jun 2025 05:39:16 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:48529) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uNTXc-0007FG-DV for 78693@debbugs.gnu.org; Fri, 06 Jun 2025 05:39:13 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5532f9ac219so2247922e87.1 for <78693@debbugs.gnu.org>; Fri, 06 Jun 2025 02:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749202746; x=1749807546; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=k3rsnAXSjdviPk90cgvn7rkGoHh7+ndrwqx8KmIPztA=; b=FwRkbJLaJGtDyNayKnEPsCsBbjjhque9hCddEeF8q9Ey6SJNvoh2lmxPPLH0QY4dca uEcxJX5EbWch/eZHXy8wc4a/W477Dv56O2PAPI4C3DL4FsfoHXnVJ9zIU59s9fS3oEmb P5sD/sJJkK/YHQ7CDmUQ/PVW61gvUVh48CNrfOdmc72i72gbjVnLQeg1DnrAiFC7YLAs kISkAzJ8x9ykxeo1Foo+iKTlrwzv2mFg4iotJZVbIktfPAwk9cz1IQQ3uT94vCsKwAFD cf0kgQJaPM0wwLxHy3HHwX+Yx/O3iYocXIN40hdXgBsWS2kXKamN9saFTtYwQ2qN8v0D KZMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749202746; x=1749807546; h=content-transfer-encoding:mime-version:message-id:date:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=k3rsnAXSjdviPk90cgvn7rkGoHh7+ndrwqx8KmIPztA=; b=UU2GOqoSKEDQZPMoZtuZC1JdJVXWHx2TN3kn6E7zR1dY5Ycyr8jFg9cMSWkwnpFDiy b3wbNVEwbdUdvQP6wDrDIy3fxsWIDesdTl/IhidUv1FnesGrsCb2NLl1ImsegLuzBUZX YTvAW5/ZZHZgjvCYBxiLNDXJ0f6fP8Yp1dVdNu2PNztGHxaukQb0Vz9audM73HvyKIJA H/EMokKiFpb+OS9vwdtO/ZC53c9PXNPRZM2klY10yvpX0WdPhw92smJ4AAOIOM6ABZri RLy4dSkb2B9gYSXibYn5J3qKyp9nnBiI0OOJY29oqZSfm5i1dhQ5bxPyBBcA8LAq01X3 ErLQ== X-Gm-Message-State: AOJu0YztCmh2CW0LBmO/Z1b52TO7wk+C8/tbBOBcBhiTH3kTAzM1mB5u MqKXIO+V5nVwqdDz3O57PW1dtU4Rxq0gT2nRHF+Bntrmf1XM/2map1xD X-Gm-Gg: ASbGncui8RK032SbXNPMFuVY2rj8WXt4mKYRPZ4JURihwF5USFfRWiApzj+hDlASmZl 7WddzrK5tyx7WZe1r7rj3sRiPOlU1zaLMT9b7Ke25mtVbf4quCrBwEoJtE3XZsI9mGbFyI8lYIk 5fOeFWZl9ZF3pTBaZHCDG0pcy9Jptp0Hefm8xhLwsI2gT//7gC4dgp3c9PoNqQctNZWk/U1COqQ h2APtRyCfCi3AOjnvn3Fu+N28o+0bOf+Jzh8immsNB3Q8RrLmSve9DjY1EsI0WSsp7NClgFRcJV GCcZL85i0hA5karMfRoCKEbdD4gxnKescgUITSZN3shaDdWAc+q+AXruRQ== X-Google-Smtp-Source: AGHT+IG0TURswVQ5hsBurXkL+2WO2x9UDxaSbZgYSvImmfro2DlyhpwyglYxwKzdMLhkV5yl7iDiqQ== X-Received: by 2002:a05:6512:3d03:b0:553:2418:8c0c with SMTP id 2adb3069b0e04-55366c39e0cmr587546e87.57.1749202745335; Fri, 06 Jun 2025 02:39:05 -0700 (PDT) Received: from localhost ([131.164.245.154]) by smtp.gmail.com with UTF8SMTPSA id 2adb3069b0e04-553676d7638sm136031e87.83.2025.06.06.02.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jun 2025 02:39:04 -0700 (PDT) From: "Paul D. Nelson" In-Reply-To: <877c1qlu6l.fsf@mailbox.org> (message from Rahguzar on Thu, 05 Jun 2025 08:54:26 +0500) Date: Fri, 06 Jun 2025 11:39:03 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi Raghuzar, thanks for your suggestions. Regarding (1) and (2), I searched my shared tex projects and found examples that those approaches would not fold correctly: > 1) Assume that there is no white-space between the macro name and the > brackets enclosing the arguments. This is probably not how TeX syntax > works but I think (not too sure about this) it is the [...] Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [131.164.245.154 listed in zen.spamhaus.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ultrono[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:129 listed in] [list.dnswl.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: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi Raghuzar, thanks for your suggestions. Regarding (1) and (2), I searched my shared tex projects and found examples that those approaches would not fold correctly: > 1) Assume that there is no white-space between the macro name and the > brackets enclosing the arguments. This is probably not how TeX syntax > works but I think (not too sure about this) it is the [...] Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:129 listed in] [list.dnswl.org] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [131.164.245.154 listed in zen.spamhaus.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ultrono[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Hi Raghuzar, thanks for your suggestions. Regarding (1) and (2), I searched my shared tex projects and found examples that those approaches would not fold correctly: > 1) Assume that there is no white-space between the macro name and the > brackets enclosing the arguments. This is probably not how TeX syntax > works but I think (not too sure about this) it is the usual style. This > behavior can be controlled by a custom variable. "\in[0,1]" I also worry that style like \includegraphics [width=3D0.8\textwidth] {result.pdf} is not too uncommon. > 2) Since the problem is with optional arguments we can allow { after the > macro name but not [. "\in{\rm SL}_2" > 3) Another option can be to introduce a new spec alist for macros > without optional args. Maybe call it TeX-fold-unargumented-spec-list. Then, we would have: TeX-fold-macro-spec-list TeX-fold-math-spec-list TeX-fold-env-spec-list TeX-fold-unargumented-spec-list The defaults for *math* would move to *unargumented* and *macro*/*math* would behave identically. This seems a bit complicated. Moreover, none of the above solutions address related (but rarer) issues with argumented macros. For instance, if one includes \mathbf in *macro*/*math*, then the following folds incorrectly: $\mathbf{text} [0,1]$ (I feel like I've seen similar examples occur organically over the years, but can't quickly think of one.) ---------------------------------------------------------------------- Here's a proposed solution that seems more robust to me. Recall that *macro*/*math* are lists consisting of items (SPEC (M1 M2 ...)), where SPEC is a display specification (an integer, a string or a function) and M1, M2, ... are macro names as strings. We could enhance the display specification to allow ((SPEC . SIG) (M1 M2 ...)), where SIG is a "signature" that restricts the number of args: - nil means no restriction, - an integer n means at most n total args (so 0 means unargumented), and - a cons cell (p . q) means at most p optional and q required args. With that enhancement, we could revert d0a57d8d and tag the defaults for LaTeX-fold-math-spec-list with "0", e.g., ("=E2=88=88" ("in")) -> (("=E2=88=88" . 0) ("in")) That would fix the original "\in [0,1]" issue as well as the issue raised by Raghuzar. It would also make it easy to fix related issues, like the one with \mathbf noted above. Thoughts? ---------------------------------------------------------------------- I also thought I'd link the original proposal [1] for TeX-fold math-spec-list. My reading is that the purpose of the *macro*/*math* split was just to better organize the defaults. [1] https://lists.gnu.org/archive/html/auctex-devel/2007-01/msg00078.html ---------------------------------------------------------------------- Finally, I noticed that we've been CC'ing bug-auctex rather than the specific bug number, which is generating duplicated bugs at https://lists.gnu.org/archive/html/bug-auctex/2025-06/threads.html. I've tried to fix that here. From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken Resent-From: Rahguzar Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Sat, 07 Jun 2025 17:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: "Paul D. Nelson" Cc: 78693@debbugs.gnu.org Received: via spool by 78693-submit@debbugs.gnu.org id=B78693.174931758720800 (code B ref 78693); Sat, 07 Jun 2025 17:34:03 +0000 Received: (at 78693) by debbugs.gnu.org; 7 Jun 2025 17:33:07 +0000 Received: from localhost ([127.0.0.1]:49487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNxPn-0005PP-0f for submit@debbugs.gnu.org; Sat, 07 Jun 2025 13:33:07 -0400 Received: from mout-p-201.mailbox.org ([80.241.56.171]:46124) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uNxPj-0005Oj-DY for 78693@debbugs.gnu.org; Sat, 07 Jun 2025 13:33:05 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4bF4yX3bqfz9sv0; Sat, 7 Jun 2025 19:32:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1749317572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NDQ1KzOARol7YNDCdaZib2p8qVBy88eRSld3WMP1LM4=; b=XqbwbkcmaQyQT8/311KsUYFQzVL2Xy/RKAvoGq/cx/rDu9TiIKCYruVyc1p+eeLeIlZabh wTo63DN3HvYfTQfZnrNIqUM1bDUUG/IupaE52k+YXC4yRq79p8ElEnPPZvn/0ZTk3TYuBs quzuehQIxBx0PyMPq9LzewPUw6knCmXgmjQOi2x++8ru6io4ZbkSqJyAXormrqDvakG8JI SY0F6Jl4FDJr8IUTDDfE2C7O4VFy4S/7Ao66/RNe+kbmASak+yWmJcSiQq8m2kpmuyeSPU 6g+2jgp46wIh1WV8wFaMsXAApLxh7e3xHm7BK4II6cp+suFMDAWPvDuVQra60w== From: Rahguzar In-Reply-To: (Paul D. Nelson's message of "Fri, 06 Jun 2025 11:39:03 +0200") References: Date: Sat, 07 Jun 2025 22:32:46 +0500 Message-ID: <87bjqzihj5.fsf@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-MBO-RS-META: 7dsrkznw9w3reic36zezy3fcneoik1q1 X-MBO-RS-ID: 0c8c111011a08c621fa X-Spam-Score: -0.7 (/) 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: -1.7 (-) Hi Paul, "Paul D. Nelson" writes: > Here's a proposed solution that seems more robust to me. Recall that > *macro*/*math* are lists consisting of items > > (SPEC (M1 M2 ...)), > > where SPEC is a display specification (an integer, a string or a > function) and M1, M2, ... are macro names as strings. We could enhance > the display specification to allow > > ((SPEC . SIG) (M1 M2 ...)), > > where SIG is a "signature" that restricts the number of args: > > - nil means no restriction, > > - an integer n means at most n total args (so 0 means unargumented), and > > - a cons cell (p . q) means at most p optional and q required args. > > With that enhancement, we could revert d0a57d8d and tag the defaults for > LaTeX-fold-math-spec-list with "0", e.g., > > ("=E2=88=88" ("in")) -> (("=E2=88=88" . 0) ("in")) > > That would fix the original "\in [0,1]" issue as well as the issue > raised by Raghuzar. It would also make it easy to fix related issues, > like the one with \mathbf noted above. Thoughts? I like this proposal. It is backward compatible I think it should also allow us to deal with optional arguments in a function spec. Currently if the spec is a function it only receives the mandatory arguments. If the number of arguments is part of the spec we can allow it to receive up to p+q args without breaking existing code. > Finally, I noticed that we've been CC'ing bug-auctex rather than the > specific bug number, which is generating duplicated bugs at > https://lists.gnu.org/archive/html/bug-auctex/2025-06/threads.html. > I've tried to fix that here. Thanks for catching this. I was surprised by emails about those new bugs. Rahguzar From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken References: <87bjr3nb8j.fsf@mailbox.org> Resent-From: "Paul D. Nelson" Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Sat, 07 Jun 2025 18:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Rahguzar Cc: 78693@debbugs.gnu.org Received: via spool by 78693-submit@debbugs.gnu.org id=B78693.174932118510283 (code B ref 78693); Sat, 07 Jun 2025 18:34:02 +0000 Received: (at 78693) by debbugs.gnu.org; 7 Jun 2025 18:33:05 +0000 Received: from localhost ([127.0.0.1]:49578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNyLp-0002fm-4r for submit@debbugs.gnu.org; Sat, 07 Jun 2025 14:33:05 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]:56491) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uNyLn-0002el-D2 for 78693@debbugs.gnu.org; Sat, 07 Jun 2025 14:33:04 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-32ac42bb4e4so27223491fa.0 for <78693@debbugs.gnu.org>; Sat, 07 Jun 2025 11:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749321177; x=1749925977; darn=debbugs.gnu.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=5AjDPgiiFCZ/JlNSUtSXOf8dD/gjPnCHl6HOml11Wiw=; b=FJvfJwD2yipAF15X98IVQjzRwBsu8KnP4d1If+NYBNT2W2XEHNaxCAwGzCyXlv8P9u 8NGN/7v+UOXxRJ1fGw3OvB9iI1+WbBzT3I/EhfUhNzfXVnjeLOlt10MuNqnkOjdY/I9P 9UlAJyIfG0IIAl+r/Pn+qeM4EIgLksa+4NGOtcY+vuRpPcf9OwHq9bli+yqVjF52mUrv fBeVVlAEJtJsjZGBj/c0buaXNySuXHx6fGbaUrfsCVPt8Nqtqzk47kxu8xovbFk8a/t2 pCRQi5wgwEeUnIQxjZBcNZNsTAdEAWEPWHOwDQ+5J5kk5Yb64O033H8UAsFfm4amf+pj ASSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749321177; x=1749925977; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5AjDPgiiFCZ/JlNSUtSXOf8dD/gjPnCHl6HOml11Wiw=; b=UMYVSaS0Ly37r/GeqDlsIL1BisioTgep9Jhdae5TH2LzPgccwXM0/0loVzE28OyPIz n0jVW7uc5DfQBYKlz8KytbMlat1DnhL5VMH5vtu6fzOHrcW/VRaun/dqKyp088tzC+KD s4rXY1iFWLVOp8UBpO3CTQq5ZqEnRaQMj4V/7bPt2it4OYKUFAfVGIMl/DRVkbGyLTSg 9WWMwwWMNDLKoHNVNH1RAvtEnmfdXzQGpj6y2wVVA11CFv0AbUQcH8oh3QBeQNS2O+1N OmQV3tARxq9tsPNMiXg0Tt2WjJHEntY5RssIGsbXhpseGSvff/BY8gkm43Ov6xOLoEgO 0AOQ== X-Gm-Message-State: AOJu0YzBFePX8LTZyvx12bG5+ywDHyPVT/zAAeAhEwwNFjiwJVrZstaj o3T4lRGDUgkfA3tkTUu4ulkhGc6I3uSBiRN8BfLrDNOAlGUHCuyHzV6tXIUKGpKB X-Gm-Gg: ASbGncv+1rEwODIb361eGk9iB7yj71HdXcwuS/Cdg3KiMmlgcPRK0JZuf6PLZCdPg7A X33fRRcyG/PlRCXsznzPMLWyGXQwssJUvnJdaJFyNYnbRV0ArY0CZDcFEd+ofJm+MBScyayPAif bevXKcHelI0qINozjddnoo6z9Ks478APGxAABG2UzrnBmThvJEnWf7YfBSzogPdcQ/KtxIfx5xN OPxvn6bq/dQaFwD4JAU8rhzy9cHbFASdfUhoKPFyaccrAlJIfBMvkZWjzvkMJf6T0Ux2nXzm+Eb MGstave9i3sAE2ErUY6A70g2qmGon2dy6+/bfluMC2Fprx4maQsOCKXg X-Google-Smtp-Source: AGHT+IGA8HDE8OSYwWD7o3KNj2FZ2b1qpakF++/Jwejh4GgWshMNCsHxpRECUETPtkO78q5g6Sh/zg== X-Received: by 2002:a2e:b88c:0:b0:32a:943d:e43 with SMTP id 38308e7fff4ca-32adfb68040mr19041231fa.22.1749321176599; Sat, 07 Jun 2025 11:32:56 -0700 (PDT) Received: from localhost ([185.229.155.48]) by smtp.gmail.com with UTF8SMTPSA id 38308e7fff4ca-32ae1d0367asm5433471fa.114.2025.06.07.11.32.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jun 2025 11:32:55 -0700 (PDT) From: "Paul D. Nelson" In-Reply-To: <87bjqzihj5.fsf@mailbox.org> (message from Rahguzar on Sat, 07 Jun 2025 22:32:46 +0500) Date: Sat, 07 Jun 2025 20:32:53 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) 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: -1.0 (-) Hi Raghuzar, > I like this proposal. It is backward compatible I think it should also > allow us to deal with optional arguments in a function spec. OK, great. I'll try fleshing it out when I get the chance. > Currently if the spec is a function it only receives the mandatory > arguments. If the number of arguments is part of the spec we can allow > it to receive up to p+q args without breaking existing code. Regarding optional arguments, I am in the habit of extracting those using TeX-fold-macro-nth-arg. This is possible because (with recent enough AUCTeX) the function display spec is always called with point at the beginning of the macro to be folded. See for instance the implementation of TeX-fold-cite-display. For this reason, I'm inclined to first implement the proposal without changing how optional args are used - we could change that later, if desired. Thanks, best, Paul From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken Resent-From: Rahguzar Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Mon, 09 Jun 2025 18:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: "Paul D. Nelson" Cc: 78693@debbugs.gnu.org Received: via spool by 78693-submit@debbugs.gnu.org id=B78693.174949222228947 (code B ref 78693); Mon, 09 Jun 2025 18:04:01 +0000 Received: (at 78693) by debbugs.gnu.org; 9 Jun 2025 18:03:42 +0000 Received: from localhost ([127.0.0.1]:57052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOgqU-0007Wm-0m for submit@debbugs.gnu.org; Mon, 09 Jun 2025 14:03:42 -0400 Received: from mout-p-202.mailbox.org ([80.241.56.172]:56564) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOgqQ-0007Vr-2A for 78693@debbugs.gnu.org; Mon, 09 Jun 2025 14:03:39 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4bGKXv1xHLz9stK; Mon, 9 Jun 2025 20:03:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1749492207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GDRWjCWoJKsRmwmUBwxGYKJsb6CRSjmfDBA9Z7HKsEs=; b=vnVRsD+3T3L3d6nsiNBLdoB4NDmk1g4ufGldFEH5E+ySoSPFsau5Hr2DmhEuCgPTvYJGRY Kz3Ndd9CdBYVQRqXMhCZ2I922vPxVHFvy5bHipGCJE9UjNLD/h4A2imnPhm7I9xkJn8f4K dJBZ45XLQqnSfxFFgTl6/rsk042pRBSkfKkzmO+fSBzMq/prHeBrNIAW0/TZCHOORp8mFQ LnbD4TqT5SWCdzDHVd2d/JgjDKsrYvXciHuZYiiwCGhXUD3top5m6NiX+a2hARvfntmSZq jWTFHctvLlGSXlJPknZHEsdL8xjTzVIMPCYuCAHBeA1WMbF+RYBOfGxFPaYoNQ== From: Rahguzar In-Reply-To: (Paul D. Nelson's message of "Sat, 07 Jun 2025 20:32:53 +0200") References: Date: Mon, 09 Jun 2025 23:03:18 +0500 Message-ID: <87o6uw3i8p.fsf@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain X-MBO-RS-ID: de8411df30011669d63 X-MBO-RS-META: 57ohc37tjzp7nydnt8hqen4b4hh7obca X-Spam-Score: -0.7 (/) 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: -1.7 (-) Hi Paul, "Paul D. Nelson" writes: > Hi Raghuzar, > >> Currently if the spec is a function it only receives the mandatory >> arguments. If the number of arguments is part of the spec we can allow >> it to receive up to p+q args without breaking existing code. > > Regarding optional arguments, I am in the habit of extracting those > using TeX-fold-macro-nth-arg. This is possible because (with recent > enough AUCTeX) the function display spec is always called with point at > the beginning of the macro to be folded. See for instance the > implementation of TeX-fold-cite-display. > > For this reason, I'm inclined to first implement the proposal without > changing how optional args are used - we could change that later, if > desired. I think the difference between passing optional arg now vs later would be backward compatibility. Since the the signature part of spec is new there are no backward compatibility concerns. However if people start using the feature assuming no optional arguments are passed to the function and we start passing them later there can be breakage. I think passing the arguments directly to the function is more user friendly. However, I think documenting TeX-fold-macro-nth-arg as the way to access optional arguments is also good enough. > > Thanks, best, > Paul Best, Rahguzar From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Wed, 11 Jun 2025 07:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: 78693@debbugs.gnu.org Cc: rahguzar@mailbox.org, ultrono@gmail.com X-Debbugs-Original-To: Rahguzar via bug-auctex via Bug reporting list for AUCTeX X-Debbugs-Original-Cc: 78693@debbugs.gnu.org, Rahguzar , ultrono@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.174962719622625 (code B ref -1); Wed, 11 Jun 2025 07:34:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jun 2025 07:33:16 +0000 Received: from localhost ([127.0.0.1]:46096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uPFxU-0005sp-0b for submit@debbugs.gnu.org; Wed, 11 Jun 2025 03:33:16 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43636) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uPFxD-0005r7-12 for submit@debbugs.gnu.org; Wed, 11 Jun 2025 03:32:59 -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 1uPFx7-0007SE-BJ for bug-auctex@gnu.org; Wed, 11 Jun 2025 03:32:53 -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 1uPFx5-0003Ly-GT; Wed, 11 Jun 2025 03:32:51 -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=NysgRVepcoa4om6ZRH31MxnH0ZdI8rt6BaILKhV3idM=; b=eQ0B1IC3y/Rw+zl8WN+G 32R8aJbyodcIp/fG4eWBWaMy2o4wucASCsEJHYpf+FT9HnX5A/d250nTgzOxB+RsrrEjlJ2+InV7+ MSJnsqhIj35/S3PAZvqxT6rk7pzgyuJxZUTtmX1+JDdjb6R45Tpc9KL9KWh9bQyGY7fUfbrmTmqVu taNNBRYiNkzBHrbPzn5VLS9Bw7R8LHmOMi4wXa7D1R0GGkaNZckWTQdbZlXH675ODGwtr8r5CAH1s 7AJnuWfOZ+Hv6jpZCfmv87csYGC34IOUeKmHvemhtLjZEt+4bnPC3WtlK98SQD7YE9XLiBzKlOetw XkPqZzmQwrRDSg==; From: Arash Esbati In-Reply-To: <87bjr3nb8j.fsf@mailbox.org> References: <87bjr3nb8j.fsf@mailbox.org> Date: Wed, 11 Jun 2025 09:32:47 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) 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: -1.0 (-) forcemerge 78693 78696 78698 thanks Rahguzar via bug-auctex via Bug reporting list for AUCTeX writes: > Dear AucTeX maintainers, > > The commits > > d0a57d8d Fix math macro folding to not consume subsequent brackets > 33f9eb07 Fix TeX macro end detection in some edge cases > > break the folding of math macros with a function spec. Gents, somehow 3 bug reports where opened for this report which I'm merging now. Please try to avoid this in future. TIA. Best, Arash From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken References: <87bjr3nb8j.fsf@mailbox.org> Resent-From: "Paul D. Nelson" Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Wed, 11 Jun 2025 07:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Arash Esbati Cc: 78693@debbugs.gnu.org, rahguzar@mailbox.org X-Debbugs-Original-Cc: bug-auctex@gnu.org, 78693@debbugs.gnu.org, rahguzar@mailbox.org Received: via spool by 78693-submit@debbugs.gnu.org id=B78693.174962741423694 (code B ref 78693); Wed, 11 Jun 2025 07:37:02 +0000 Received: (at 78693) by debbugs.gnu.org; 11 Jun 2025 07:36:54 +0000 Received: from localhost ([127.0.0.1]:46112 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uPG0u-000690-CG for submit@debbugs.gnu.org; Wed, 11 Jun 2025 03:36:53 -0400 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]:45178) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uPG0s-00068f-As for 78693@debbugs.gnu.org; Wed, 11 Jun 2025 03:36:46 -0400 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-5533302b49bso6589150e87.2 for <78693@debbugs.gnu.org>; Wed, 11 Jun 2025 00:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749627400; x=1750232200; darn=debbugs.gnu.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ibREudmxaDk2nRzoMq7KfiHEQbxBFg+N05yDmwY5+Fg=; b=W62ma/z4tm+Als0YnYysg+Jczudl4tLZhPL4Dbyc45AZk7X3vv9tCPdSmvaxu2adKc q5GSf1gOraC0z5RyV0Jt3TqZ0gg2c2/z2rnbYIGlgjo6MgO6iGwab7Z8g/64RAK/91Kp P8+u9aKd352sRO/5HyhwxJTmnEcsTdgb8Fxf9DlTb0m8Ij/rQCjOavnL5X+bz0T4R5NH kuCUB5WamxoDHMhJI2hWSGA7hBSa1of6dIHtzSGyqv5zBn6XmG2FIEuMnoNfBU/8sjle QqS3an99xg/7TpmCOAZ8iGVJ8uu/XNCaB1xJOOMyX8LCypHTQ0hJqTPg9CadljojBTLe XGfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749627400; x=1750232200; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ibREudmxaDk2nRzoMq7KfiHEQbxBFg+N05yDmwY5+Fg=; b=pbgqmGlFthVink5mqA/533d4Bj+aieaEokn8dbrVb/vI046v6QkJEqWTN2Fsy6HloH flYTVhlFwhV3kRxXQZ6Xvc7zYSsIHplks29GZV92IB+xlYzXBG3DHa7Do6R8mw3kOsBm h6SJNzZH3N/DdKLr6ioVPQGaieJAy5oHuXWs3gDH1vL5wpaFGKNcvOcAD+GdDg+4b3/o X+u936YKb/KZm95SygVTUo3ApBDAK/nRZ9UmM6UTZznpE8b9yUjoIXNDITfuQSN2j5mg 6xPfSs8Wv4rmG1DI8CKEFqZT4cYuVUilWPR8MGyEJdtneZI1dBDkiaIBuP7DCMOd4YSX Bhlg== X-Forwarded-Encrypted: i=1; AJvYcCWxOMcksgLaL4fn0NvXIWy5HqA+b0ea1xdiNbDQdB70y3sGU3KmDhAswDFk/x1EyPS+OeqVvA==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzREXd28RUA+gzvXMq+SEMekjGkLJgBuhkyH9ZcebenQqkqj9KS xkGiDCmRoxUodHmHmLheRDxEZ/nyHpAJYkFI6/BQt1rB0qRbtq/efoEN X-Gm-Gg: ASbGncu5Dus/DHLiW3GqmwbJSk9f+vXsAmHwoXIzWZJ/itAiQOzkNJG5Hau0g0SSTzP ToDCAMX07Jxp95xgmv/8Vv3F3VwxVvk7StEAjQug5+gZ7yM66WHlXI13Plj1MFnfaoSmJvgtaix rG67+pVIWwOJABGLH1cJwrZhtvfouOS60SH9ODkfezk2GhkKiJqie9WDAs+i5MxM2xb1IJ/oaca +8Q58HTXcluGRqOmZCyIpfGjo94q6VdLUKkchy+MqqsMCrwqFlnQYLo8xv+KmMGFeT8FodcoQM4 eXwiR1ALGVgQ/QF7nqrYe04xqu3ncwk+fY3wElCWm2VjUuQyqb546Mk9lfMu9IflXVQ= X-Google-Smtp-Source: AGHT+IG8KJbaKE1JLj8sll+4Wz4TDjjrsDkMXHuZYrIhrvHkwHq+fY0Zx4L7ukS1eFQB4IhHulfGHg== X-Received: by 2002:a05:6512:4006:b0:553:28b8:eecb with SMTP id 2adb3069b0e04-5539c23931bmr780191e87.38.1749627399524; Wed, 11 Jun 2025 00:36:39 -0700 (PDT) Received: from localhost ([185.229.155.48]) by smtp.gmail.com with UTF8SMTPSA id 2adb3069b0e04-553676d0ee3sm1844636e87.8.2025.06.11.00.36.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jun 2025 00:36:39 -0700 (PDT) From: "Paul D. Nelson" In-Reply-To: (message from Arash Esbati on Wed, 11 Jun 2025 09:32:47 +0200) Date: Wed, 11 Jun 2025 09:36:38 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) 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: -1.0 (-) Arash Esbati writes: > somehow 3 bug reports where opened for this report which I'm merging > now. Please try to avoid this in future. TIA. Thanks. For future reference, the issue is that I was CC'd on the original bug (and responded to that message, causing a cascade of new bugs), but the correct approach (as I've now learned) is to use the X-Debbugs-CC pseudo-header (https://www.debian.org/Bugs/Reporting). From unknown Tue Jun 17 22:11:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78693: 14.0.9; Folding of math macros with a function spec is broken References: <87bjr3nb8j.fsf@mailbox.org> Resent-From: "Paul D. Nelson" Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Sun, 15 Jun 2025 10:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78693 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Rahguzar Cc: 78693@debbugs.gnu.org Received: via spool by 78693-submit@debbugs.gnu.org id=B78693.174998337731663 (code B ref 78693); Sun, 15 Jun 2025 10:30:02 +0000 Received: (at 78693) by debbugs.gnu.org; 15 Jun 2025 10:29:37 +0000 Received: from localhost ([127.0.0.1]:55236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uQkcK-0008EY-10 for submit@debbugs.gnu.org; Sun, 15 Jun 2025 06:29:37 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:49617) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uQkcG-0008Di-Ug for 78693@debbugs.gnu.org; Sun, 15 Jun 2025 06:29:34 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-606b6dbe316so7450967a12.3 for <78693@debbugs.gnu.org>; Sun, 15 Jun 2025 03:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749983366; x=1750588166; darn=debbugs.gnu.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=O7ZrhGrnB8CSOUueVf4FMH5dkKdtd9IwPDD668iT50Q=; b=ReaDZX5vZ6AKadadtCPeVb8eXcMRt+7vAB3fVXfHuEn2/huirT+Q5F7XAU1tIkcIo8 g1N06ZUyKTuF23PP22MSvfVE1TvUJOS9xCdxKz2O8j4VmurZylIvU0OXV2e3pNU11WZT NBAV/LExnVkp5zECvQJRmkf/h9YNp6Y2Rap0L09Ymyl9f372t3y/TtfkegG6o0n5zdVo MkBg4pfEUHkB9Zs2Q/uvgZZsfnnWg5umbru5QzmQjTtd62T4ZMn1SC48mGhkhl/jyUwW 2U63rS2OQliRKB5GbMFaJvXZ7bvKsN8XO/u6lv50SprxwAKZ6VuVHoWtz4xNiipV4hAz 6ojw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749983366; x=1750588166; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O7ZrhGrnB8CSOUueVf4FMH5dkKdtd9IwPDD668iT50Q=; b=uqFmMZxxzwqybMX5JGAP43zXGw8VY0l+ARGaTVkN6YehWs5MVyac18huBJ6ersrEnw aSYEVP7zQmH42IuGxuWVncX9HtJCO0YMIbLwwSGvrUJZZAgjIbd8L+sW0AaZynVPt4qe 0FVgUvLvOsiO8TW3K6YhvAek7qL63ixyBDDXZjlpEis0nRQ08g/bbPPoCBF6OvPdoq7W aQHMnqLXxEWAWRecUWelrDXEx0yvnb9LDagxkgY6gPS+AdknfizemP2zsmU4aG8Yeki+ IFcl49vAXjL9dmpkZqI2+oLafyCyjrRb9VU+7G0SD9riqvjfBPe/u4u0Ylg/WbZuNM08 wPIw== X-Gm-Message-State: AOJu0YzbZMELWchgFyr/3BUvaJrrVj+Et3ZgUo97pBcQOOsnn3Alin+K MUNdjqeyxDnywvDUyRzjo53x6ePlLX8ebnCJrdvx0x6bfuozeQK+SNTD X-Gm-Gg: ASbGncuQNVbwnHKKaDOs4yHnV0dls82fVTYFMcq/fx1HsOjqTsXnxVMQmleJdXnEnE2 MUo5ouYTP6vUjWEHct0Ng8jxsyn4dSvLVJuflr0t7vuciuTjPop2SKvTvM9Ya1bVKlwsxGCyu/D TllqbXjWtpY6yN4dU6b5VkMU9mtTDvBQrLyB63JuzYxaaG5ytL6CirDqSLfn9dlxDip7I7qpPsB 9D3m6VfrjOZ2hdFW7ZtOf2pDAEfkDo+THbCIvTP1sOQ6zevA8eiScLJYEtK34UKyaTs0Vz+RAM8 q8aPM33e+1NcWFmrcWhxn7eVxniFyecUbYuuL2aUnE0rvHQOfL/fdj7a23JdDjwxqRs= X-Google-Smtp-Source: AGHT+IEMeUY8ynE3rx3PbbYrx/bACDoYLTSwdcLdy/O7+SljH+VTQk+jz/1B45H8kycY9pERAHqFyA== X-Received: by 2002:a17:906:4fca:b0:ad8:9909:20ac with SMTP id a640c23a62f3a-adfad596675mr456623066b.50.1749983366313; Sun, 15 Jun 2025 03:29:26 -0700 (PDT) Received: from localhost ([193.33.149.190]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-adec8158d4dsm455240966b.28.2025.06.15.03.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jun 2025 03:29:25 -0700 (PDT) From: "Paul D. Nelson" In-Reply-To: <87o6uw3i8p.fsf@mailbox.org> (message from Rahguzar on Mon, 09 Jun 2025 23:03:18 +0500) Date: Sun, 15 Jun 2025 12:29:24 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --=-=-= Content-Type: text/plain Hi Raghuzar and all, Please see the attached patch which implements signature support for macro folds, following the plan outlined in my earlier email. This should address both the issue in your report and that in my earlier bug. We also need to update the manual, but I'll do that later once the general shape of the proposal is agreed upon. If you get the chance, please let me know what you think. Thanks, best, Paul --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-signature-support-for-macro-folding.patch >From 2e07366d1d5856f615c8bf7bc36fbbcdf5350055 Mon Sep 17 00:00:00 2001 From: Paul Nelson Date: Sun, 15 Jun 2025 12:24:11 +0200 Subject: [PATCH] Add signature support for macro folding Support signature restrictions to limit the number of arguments considered when folding LaTeX macros (bug#78693). * tex.el (TeX-find-macro-boundaries, TeX-find-macro-end) (TeX-find-macro-end-helper): Add optional SIGNATURE argument to restrict allowed arguments. * tex-fold.el (TeX-fold-macro-spec-list): Update docstring and type specification to document new signature format. (TeX-fold-region-macro-or-env, TeX-fold-item): Extract signature from spec and pass to 'TeX-fold-item-end'. (TeX-fold-item-end): Add optional SIGNATURE parameter. Remove special handling for math type, reverting d0a57d8d and delegating instead to 'TeX-find-macro-end'. * latex.el (LaTeX-fold-math-spec-list): Add "signature 0" to each entry, reflecting that it is a macro with no arguments. --- latex.el | 2 +- tex-fold.el | 108 +++++++++++++++++++++++++++++++--------------------- tex.el | 108 +++++++++++++++++++++++++++++++--------------------- 3 files changed, 130 insertions(+), 88 deletions(-) diff --git a/latex.el b/latex.el index 5bff638b..94666fe8 100644 --- a/latex.el +++ b/latex.el @@ -6729,7 +6729,7 @@ char." "Accents"))) submenu))) (when (and (stringp tex-token) (integerp uchar) noargp) - `(,(char-to-string uchar) (,tex-token))))) + `((,(char-to-string uchar) . 0) (,tex-token))))) `((nil "to" "" 8594) (nil "gets" "" 8592) ,@LaTeX-math-default))) diff --git a/tex-fold.el b/tex-fold.el index 78e5b822..d980ac1b 100644 --- a/tex-fold.el +++ b/tex-fold.el @@ -95,38 +95,55 @@ macros, `math' for math macros and `comment' for comments." "textbf" "textsc" "textup"))) "List of replacement specifiers and macros to fold. -The first element of each item can be a string, an integer or a -function symbol. The second element is a list of macros to fold -without the leading backslash. - -If the first element is a string, it will be used as a display -replacement for the whole macro. Numbers in braces, brackets, -parens or angle brackets will be replaced by the respective macro -argument. For example \"{1}\" will be replaced by the first -mandatory argument of the macro. One can also define -alternatives within the specifier which are used if an argument -is not found. Alternatives are separated by \"||\". They are -most useful with optional arguments. As an example, the default -specifier for \\item is \"[1]:||*\" which means that if there is -an optional argument, its value is shown followed by a colon. If -there is no optional argument, only an asterisk is used as the -display string. - -If the first element is an integer, the macro will be replaced by -the respective macro argument. - -If the first element is a function symbol, the function will be -called with all mandatory arguments of the macro and the result -of the function call will be used as a replacement for the macro. -Such functions typically return a string, but may also return the -symbol `abort' to indicate that the macro should not be folded. +The first element is of the form SPEC or (SPEC . SIG), where SPEC can be +a string, an integer or a function symbol and SIG is described below. +The second element is a list of macros to fold without the leading +backslash. + +If SPEC is a string, it will be used as a display replacement for the +whole macro. Numbers in braces, brackets, parens or angle brackets will +be replaced by the respective macro argument. For example \"{1}\" will +be replaced by the first mandatory argument of the macro. One can also +define alternatives within the specifier which are used if an argument +is not found. Alternatives are separated by \"||\". They are most +useful with optional arguments. As an example, the default specifier +for \\item is \"[1]:||*\" which means that if there is an optional +argument, its value is shown followed by a colon. If there is no +optional argument, only an asterisk is used as the display string. + +If SPEC is an integer, the macro will be replaced by the respective +macro argument. + +If SPEC is a function symbol, the function will be called with all +mandatory arguments of the macro and the result of the function call +will be used as a replacement for the macro. Such functions typically +return a string, but may also return the symbol `abort' to indicate that +the macro should not be folded. + +SIG optionally restricts the number of arguments that follow the macro. +It can be either nil, an integer, or a cons cell consisting of integers. +If it is nil, then there is no restriction. If it is an integer n, then +at most n total arguments are allowed. If it is a cons cell (p . q), +then at most p optional and q required arguments are allowed. Setting this variable does not take effect immediately. Use Customize or reset the mode." - :type '(repeat (group (choice (string :tag "Display String") - (integer :tag "Number of argument" :value 1) - (function :tag "Function to execute")) - (repeat :tag "Macros" (string)))) + :type '(repeat + (group + (choice + (string :tag "Display String") + (integer :tag "Number of argument" :value 1) + (function :tag "Function to execute") + (cons :tag "Spec with signature" + (choice (string :tag "Display String") + (integer :tag "Number of argument" :value 1) + (function :tag "Function to execute")) + (choice (const :tag "No restriction" nil) + (integer :tag "Max total arguments") + (cons :tag "Max optional and required" + (integer :tag "Max optional arguments") + (integer :tag "Max required arguments"))))) + (repeat :tag "Macros" (string)))) :package-version '(auctex . "14.0.8")) (defvar-local TeX-fold-macro-spec-list-internal nil @@ -437,9 +454,13 @@ for macros and `math' for math macros." (string (char-after (match-end 0))))))) (let* ((item-start (match-beginning 0)) - (display-string-spec (cadr (assoc item-name - fold-list))) - (item-end (TeX-fold-item-end item-start type)) + (spec-maybe-sig (cadr (assoc item-name fold-list))) + (display-string-spec (if (consp spec-maybe-sig) + (car spec-maybe-sig) + spec-maybe-sig)) + (sig (when (consp spec-maybe-sig) + (cdr spec-maybe-sig))) + (item-end (TeX-fold-item-end item-start type sig)) (ov (TeX-fold-make-overlay item-start item-end type display-string-spec))) (TeX-fold-hide-item ov)))))))))) @@ -536,7 +557,7 @@ Return non-nil if an item was found and folded, nil otherwise." TeX-fold-math-spec-list-internal) (t TeX-fold-macro-spec-list-internal))) fold-item - (display-string-spec + (spec-maybe-sig (or (catch 'found (while fold-list (setq fold-item (car fold-list)) @@ -549,7 +570,12 @@ Return non-nil if an item was found and folded, nil otherwise." (if (eq type 'env) TeX-fold-unspec-env-display-string TeX-fold-unspec-macro-display-string)))) - (item-end (TeX-fold-item-end item-start type)) + (display-string-spec (if (consp spec-maybe-sig) + (car spec-maybe-sig) + spec-maybe-sig)) + (sig (when (consp spec-maybe-sig) + (cdr spec-maybe-sig))) + (item-end (TeX-fold-item-end item-start type sig)) (ov (TeX-fold-make-overlay item-start item-end type display-string-spec))) (TeX-fold-hide-item ov)))))) @@ -882,10 +908,12 @@ display property." (overlay-put ov 'display display-string)) ov)) -(defun TeX-fold-item-end (start type) +(defun TeX-fold-item-end (start type &optional signature) "Return the end of an item of type TYPE starting at START. TYPE can be either `env' for environments, `macro' for macros or -`math' for math macros." +`math' for math macros. +Optional SIGNATURE, as in `TeX-find-macro-end', restricts the number of +allowed arguments of LaTeX macros." (save-excursion (cond ((and (eq type 'env) (eq major-mode 'ConTeXt-mode)) @@ -901,15 +929,9 @@ 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))))) + (TeX-find-macro-end signature))))) (defun TeX-fold-overfull-p (ov-start ov-end display-string) "Return t if an overfull line will result after adding an overlay. diff --git a/tex.el b/tex.el index 6f8267ac..74572d4e 100644 --- a/tex.el +++ b/tex.el @@ -5790,11 +5790,16 @@ If LIMIT is non-nil, do not search further up than this position in the buffer." (TeX-find-balanced-brace -1 depth limit)) -(defun TeX-find-macro-boundaries (&optional lower-bound) +(defun TeX-find-macro-boundaries (&optional lower-bound signature) "Return a cons containing the start and end of a macro. If LOWER-BOUND is given, do not search backward further than this point in buffer. Arguments enclosed in brackets or braces are -considered part of the macro." +considered part of the macro. + +If SIGNATURE is given, restrict the total number of arguments. If +SIGNATURE is an integer N, allow at most N total arguments. If +SIGNATURE is a cons cell (P . Q), allow at most P optional and Q +required arguments." ;; FIXME: Pay attention to `texmathp-allow-detached-args' and ;; `reftex-allow-detached-macro-args'. ;; Should we handle cases like \"{o} and \\[3mm] (that is, a macro @@ -5839,16 +5844,17 @@ considered part of the macro." ;; Search forward for the end of the macro. (when start-point (save-excursion - (goto-char (TeX-find-macro-end-helper start-point)) + (goto-char (TeX-find-macro-end-helper start-point signature)) (if (< orig-point (point)) (cons start-point (point)) nil)))))) -(defun TeX-find-macro-end-helper (start) +(defun TeX-find-macro-end-helper (start &optional signature) "Find the end of a macro given its START. START is the position just before the starting token of the macro. If the macro is followed by square brackets or curly braces, -those will be considered part of it." +those will be considered part of it. SIGNATURE, as in +`TeX-find-macro-boundaries', restricts how many arguments are allowed." (save-excursion (save-match-data (catch 'found @@ -5856,43 +5862,56 @@ those will be considered part of it." (if (zerop (skip-chars-forward "A-Za-z@")) (forward-char) (skip-chars-forward "*")) - (while (not (eobp)) - (cond - ;; Skip over pairs of square brackets - ((or (looking-at "[ \t]*\n?[ \t]*\\(\\[\\)") ; Be conservative: Consider + (let* ((max-tot (and (integerp signature) signature)) + (max-opt (and (consp signature) (car signature))) + (max-req (and (consp signature) (cdr signature))) + (num-opt 0) + (num-req 0)) + (while (not (eobp)) + (cond + ;; Skip over pairs of square brackets + ((or (looking-at "[ \t]*\n?[ \t]*\\(\\[\\)") ; Be conservative: Consider ; only consecutive lines. - (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp)) - (save-excursion - (forward-line 1) - (looking-at "[ \t]*\\(\\[\\)")))) - (goto-char (match-beginning 1)) - ;; Imitate `font-latex-find-matching-close', motivated by - ;; examples like \begin{enumerate}[a{]}]. - (let ((syntax (TeX-search-syntax-table ?\[ ?\])) - (parse-sexp-ignore-comments - (not (derived-mode-p 'docTeX-mode)))) - (modify-syntax-entry ?\{ "|" syntax) - (modify-syntax-entry ?\} "|" syntax) - (modify-syntax-entry ?\\ "/" syntax) - (condition-case nil - (with-syntax-table syntax - (forward-sexp)) - (scan-error (throw 'found (point)))))) - ;; Skip over pairs of curly braces - ((or (looking-at "[ \t]*\n?[ \t]*{") ; Be conservative: Consider + (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp)) + (save-excursion + (forward-line 1) + (looking-at "[ \t]*\\(\\[\\)")))) + (if (or (and max-tot (>= (+ num-opt num-req) max-tot)) + (and max-opt (>= num-opt max-opt))) + (throw 'found (point))) + (cl-incf num-opt) + (goto-char (match-beginning 1)) + ;; Imitate `font-latex-find-matching-close', motivated by + ;; examples like \begin{enumerate}[a{]}]. + (let ((syntax (TeX-search-syntax-table ?\[ ?\])) + (parse-sexp-ignore-comments + (not (derived-mode-p 'docTeX-mode)))) + (modify-syntax-entry ?\{ "|" syntax) + (modify-syntax-entry ?\} "|" syntax) + (modify-syntax-entry ?\\ "/" syntax) + (condition-case nil + (with-syntax-table syntax + (forward-sexp)) + (scan-error (throw 'found (point)))))) + ;; Skip over pairs of curly braces + ((or (looking-at "[ \t]*\n?[ \t]*{") ; Be conservative: Consider ; only consecutive lines. - (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp)) - (save-excursion - (forward-line 1) - (looking-at "[ \t]*{")))) - (goto-char (match-end 0)) - (goto-char (or (TeX-find-closing-brace) - ;; If we cannot find a regular end, use the - ;; next whitespace. - (save-excursion (skip-chars-forward "^ \t\n") - (point))))) - (t - (throw 'found (point))))) + (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp)) + (save-excursion + (forward-line 1) + (looking-at "[ \t]*{")))) + (if (or (and max-tot (>= (+ num-opt num-req) max-tot)) + (and max-req (>= num-req max-req))) + (throw 'found (match-beginning 0))) + (cl-incf num-req) + (goto-char (match-end 0)) + (goto-char (or (TeX-find-closing-brace) + ;; If we cannot find a regular end, use the + ;; next whitespace. + (save-excursion (skip-chars-forward "^ \t\n") + (point))))) + (t + (throw 'found (point)))))) ;; Make sure that this function does not return nil, even ;; when the above `while' loop is totally skipped. (bug#35638) (throw 'found (point)))))) @@ -5904,11 +5923,12 @@ in buffer. Arguments enclosed in brackets or braces are considered part of the macro." (car (TeX-find-macro-boundaries limit))) -(defun TeX-find-macro-end () +(defun TeX-find-macro-end (&optional signature) "Return the end of a macro. -Arguments enclosed in brackets or braces are considered part of -the macro." - (cdr (TeX-find-macro-boundaries))) +Arguments enclosed in brackets or braces are considered part of the +macro. SIGNATURE, as in `TeX-find-macro-boundaries', restricts how many +arguments are allowed." + (cdr (TeX-find-macro-boundaries nil signature))) (defun TeX-search-forward-unescaped (string &optional bound noerror) "Search forward from point for unescaped STRING. -- 2.39.3 (Apple Git-145) --=-=-=--