From unknown Sat Aug 16 16:57:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70811: ConTeXt-mode-cleanup clobbers my paragraph-start Resent-From: Jim Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 07 May 2024 04:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70811 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: 70811@debbugs.gnu.org X-Debbugs-Original-To: bug-auctex@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171505514214473 (code B ref -1); Tue, 07 May 2024 04:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 May 2024 04:12:22 +0000 Received: from localhost ([127.0.0.1]:41986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4CBf-0003lI-PK for submit@debbugs.gnu.org; Tue, 07 May 2024 00:12:22 -0400 Received: from lists.gnu.org ([2001:470:142::17]:46102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s43SV-0005sF-IY for submit@debbugs.gnu.org; Mon, 06 May 2024 14:53:10 -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 1s43Rw-0001p6-7R for bug-auctex@gnu.org; Mon, 06 May 2024 14:52:33 -0400 Received: from seout9.web-dns1.com ([67.215.8.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s43Rr-0003LH-Sg for bug-auctex@gnu.org; Mon, 06 May 2024 14:52:31 -0400 Received: from mailpro1.whc.ca ([51.79.16.13]) by se2.web-dns1.com with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s43Rl-0028rB-Jz for bug-auctex@gnu.org; Mon, 06 May 2024 14:52:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=jdvb.ca; s=default; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date:Sender :Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=au/Yc/EzwinU053uHajOuFbWE8RQGdc/r+ZYmzJOXio=; b=nZfhvfmguAjPitGO6QVBD4nnDF kLF2q+sGpzrUrA0dFDADFnQrSJRcybFeFJjKWYpUmMcf249olxKfifxegcdqk8CZowvhdrsIDyfIG 72WYnccckY93oKWSBoBYqPKxYqpoPUd9Q9V6QcTtR+BiLpv8WCadC5WCzcrNrepNRnFkIWbhR2v6y Edelnv+uVF/MStaKQ3MO/Npq26J9puiOYSBL2SMJeQ+kKCCjmGIaptYteONQjaELviqqtkNA69IWl oHnVv1xoEuLF7JM/mY6cmA3j/8vVzxOxcBUOuKPShbsD5ddw5ct02bcc7sAA92sU4BHYKtB0hIWQl aAAsEmaA==; Received: from [47.55.144.2] (port=43402 helo=x360) by mailpro1.whc.ca with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s43Rf-007nVL-1n for bug-auctex@gnu.org; Mon, 06 May 2024 14:52:21 -0400 Received: by x360 (Postfix, from userid 1000) id 31FED1E08C0; Mon, 6 May 2024 15:52:15 -0300 (ADT) Date: Mon, 6 May 2024 15:52:15 -0300 From: Jim Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Originating-IP: 51.79.16.13 X-SpamExperts-Domain: out.mailpro1.whc.ca X-SpamExperts-Username: 51.79.16.13 Authentication-Results: web-dns1.com; auth=pass smtp.auth=51.79.16.13@out.mailpro1.whc.ca X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.17) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT9Gmax8hlRQJlOTBI+tkVUuPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5y00TxNscjI4HQ0N3k20ktvbA/nwrcN5XO9vX75jP2nUwAz C4whBdxWwxYa7fxrYRTilbHtbFYVmmyNP/jzd7CCzPgfBgZM0FjuQW6Y55dUiQZmnW/XN+tohdLu D74c7RJey+lU4Oj2iGrtiUqNmPb3g8CBO1Snvm6qXHQp7O9kdZPt1ptJqUeJtZx82lIVH48BGzKf EMfQP5IsMlZ0RJfOLDnQGgRgHjioU8fpt7xeC7AK0L/uTNt3WCw41GzGb1Zq+pu9ho29CVyp3Dt9 A9c5hLgYgFsBSgLe7UmHHVjYG3miwWlZPQX1IIQlogJHCycAsawbI+6QsvJaO9JaZuEs7/qwOtde lIbggRfmI0RxW12PHznFCr1UPjZRtNG50GjfX8TdqEXkwxwMjsp2mNApEnLWbO6tEnRR1Tf3gZYq uP6uBURpwkG/UI8Lt+k41p20dSKMlXKQF8X1HlycPD0imcsYv2hW6E1AGgNPXZJT/2iH1Wgh6RAe nBR+licROGYAH3vFdsree+S451a6uiKsfCBWSRYbp8p3pscUyw8d/z4yiWuHEShzC1WQtgkTNilG iOL7Adggx8EUfoUWJKaZBu+AJzYMbmuNPXXlQ52f9MKOH9b/rC04xwIOceXtiZarrJeKkIgSwV7B WBPfAUvwGJgfamGHhdfHHLkmPS+jbXBmiJl7zi2qQnM+uIAeq3dvB/PR/SgGDncmVDwAGwr8PAlb DjazCbhs7qBpykynMml2i7rnOluNqSFrd7v7uxMwLclCdUbWRokAnDDOfrtFE8Wp/BRpkpCFhA6u HMiYiH+kaTqeg21i1JxPwutIwAkY1NPvz9RL91srsmyVInvOJGjR44ZWgp6vOMhZlKkU4TBtUD9+ Z7GHz/OHPkRStyqVlZJp6ZhYtSzkWBJ5GKUr40VrmANl+DlVnkHux/4aSA== X-Report-Abuse-To: spam@se1.web-dns1.com Received-SPF: pass client-ip=67.215.8.20; envelope-from=zlists+auctex@jdvb.ca; helo=seout9.web-dns1.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, 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-Mailman-Approved-At: Tue, 07 May 2024 00:12:13 -0400 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 (/) ConTeXt mode has the defun ConTeXt-mode-cleanup which is the :after-hook of ConTeXt-mode. In this cleanup defun, paragraph-start is re-set. Unfortunately, this over-writes my choice of paragraph-start which I set in my ConTeXt-mode hook. Unless there is some ":after-after-hook" or ":really-after-hook" or ":my-after-hook" or some other (unknown to me) way of doing something after ConTeXt-mode-cleanup, I have to handraulically (re-)setq paragraph-start after loading my file. This is not a good thing. The comment in context.el mentions doing this for reasons similar to the same part of latex.el, ;; Don't do locally-bound test for `LaTeX-paragraph-commands-regexp' ;; and `paragraph-start'. See comments in similar part in latex.el. but not being a latex user I don't understand why this is desired for latex users, and so I can't transmogrify that to why context users might want this. In any case, (a) do we really need the paragraph-start setting code in context.el, and (b) if so, could there be some user option which tells ConTeXt-mode-cleanup to *not* setq paragraph-start ? (Or perhaps there is already a way which I don't have enough emacs-fu to know. I am happy to be enlightened.) Thanks. Jim Emacs : GNU Emacs 27.2 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 3.24.27) of 2021-03-25 Package: 14.0.3.2024-03-17 current state: ============== (setq AUCTeX-date "2024-03-17" window-system 'x LaTeX-version "2e" TeX-style-path '("~/.emacs.d/auctex" "/home/zsd/.emacs.d/elpa/auctex-14.0.4/style" "/home/zsd/.emacs.d/auctex/auto" "/home/zsd/.emacs.d/auctex/style" "auto" "style") TeX-auto-save nil TeX-parse-self t TeX-master t a-bunch-of-other-stuff nil ) From unknown Sat Aug 16 16:57:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70811: ConTeXt-mode-cleanup clobbers my paragraph-start Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 07 May 2024 05:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70811 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Jim Cc: 70811@debbugs.gnu.org Received: via spool by 70811-submit@debbugs.gnu.org id=B70811.171505940018188 (code B ref 70811); Tue, 07 May 2024 05:24:01 +0000 Received: (at 70811) by debbugs.gnu.org; 7 May 2024 05:23:20 +0000 Received: from localhost ([127.0.0.1]:42276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4DIO-0004jI-4s for submit@debbugs.gnu.org; Tue, 07 May 2024 01:23:20 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:48818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4DIK-0004jA-GT for 70811@debbugs.gnu.org; Tue, 07 May 2024 01:23:19 -0400 Received: from localhost (42-144-18-247.rev.home.ne.jp [42.144.18.247]) by smtp1a.inetd.co.jp (Postfix) with ESMTPSA id 25D127A; Tue, 7 May 2024 14:22:48 +0900 (JST) From: Ikumi Keita In-reply-to: References: Comments: In-reply-to Jim message dated "Mon, 06 May 2024 15:52:15 -0300." X-Mailer: MH-E 8.6+git; nmh 1.8; Emacs 29.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8377.1715059367.1@localhost> Date: Tue, 07 May 2024 14:22:47 +0900 Message-ID: <8378.1715059367@localhost> 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 Jim, >>>>> Jim writes: > ConTeXt mode has the defun ConTeXt-mode-cleanup which is the :after-hook > of ConTeXt-mode. In this cleanup defun, paragraph-start is re-set. > Unfortunately, this over-writes my choice of paragraph-start which I set > in my ConTeXt-mode hook. Unless there is some ":after-after-hook" or > ":really-after-hook" or ":my-after-hook" or some other (unknown to me) > way of doing something after ConTeXt-mode-cleanup, I have to > handraulically (re-)setq paragraph-start after loading my file. > This is not a good thing. > The comment in context.el mentions doing this for reasons similar to the > same part of latex.el, > ;; Don't do locally-bound test for `LaTeX-paragraph-commands-regexp' > ;; and `paragraph-start'. See comments in similar part in latex.el. > but not being a latex user I don't understand why this is desired for latex > users, and so I can't transmogrify that to why context users might want > this. > In any case, > (a) do we really need the paragraph-start setting code in context.el, and > (b) if so, could there be some user option which tells ConTeXt-mode-cleanup > to *not* setq paragraph-start ? > (Or perhaps there is already a way which I don't have enough emacs-fu to > know. I am happy to be enlightened.) Thank you for the report. The reason for LaTeX mode is that this treatment enables AUCTeX to add flexibly new commands afterwards as paragraph starters through sub files supporting various LaTeX packages ("style files" in AUCTeX terminology). AUCTeX style files overwrites `paragraph-start' casually in LaTeX mode, so users who want to customize it in the LaTeX mode hook should actually set `LaTeX-paragraph-commands' instead. In principle, ConTeXt mode should have similar framework, although the current AUCTeX style files have no support for ConTeXt modules except TikZ. I think I can implement `ConTeXt-paragraph-commands' like LaTeX mode and then you can set it instead of `paragraph-start'. What do you think about this idea? Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW From unknown Sat Aug 16 16:57:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70811: ConTeXt-mode-cleanup clobbers my paragraph-start Resent-From: Jim Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 07 May 2024 11:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70811 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Ikumi Keita Cc: 70811@debbugs.gnu.org Received: via spool by 70811-submit@debbugs.gnu.org id=B70811.171508223912899 (code B ref 70811); Tue, 07 May 2024 11:44:01 +0000 Received: (at 70811) by debbugs.gnu.org; 7 May 2024 11:43:59 +0000 Received: from localhost ([127.0.0.1]:42567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4JEh-0003Lz-W8 for submit@debbugs.gnu.org; Tue, 07 May 2024 07:43:59 -0400 Received: from seout2.web-dns1.com ([68.168.119.163]:47136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4JEe-0003Lr-4t for 70811@debbugs.gnu.org; Tue, 07 May 2024 07:43:54 -0400 Received: from mailpro1.whc.ca ([51.79.16.13]) by se3.web-dns1.com with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s4JE6-00888q-Jd; Tue, 07 May 2024 07:43:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=jdvb.ca; s=default; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ynxhDanzxxoN+bhgcD0mnLjHQ3nhaFQbfuGbYZvbdi0=; b=NVVgmsOp+1g33iqb5yqGe8Z04Z NiIiQSvARIdfSKW6tTMiATHwT1PsLta+HHjjU/l7Jbv8N8sE5uGNgFDSpT9K01FBg8aVXNmXToeyq H/Pifn44bUrAWMhR8c1ur/UYj/tv3VeZq5zL8mplUbSSS5xB5dCN3yKFcF2D8Ovt6cvwvgLdFdUuc CY+LkSKSqlBUOJhkSFc1a5Y3mGB25n1JXNJqthJP0ZQrD7h7OMMiwtN/vEuJ0J5vx0G7J11Jsv7r2 ch5xkScS4Z+nZSq/1HOC3yg1WDMnAoWpLfulsFZ8G0VtFNL/pGo5kG4SQgo5ALpl4mcD3bTbIWpqH j25WNklA==; Received: from [47.55.144.2] (port=33276 helo=x360) by mailpro1.whc.ca with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s4JDz-00C2gV-0h; Tue, 07 May 2024 07:43:17 -0400 Received: by x360 (Postfix, from userid 1000) id AC4501E08C0; Tue, 7 May 2024 08:43:10 -0300 (ADT) Date: Tue, 7 May 2024 08:43:10 -0300 From: Jim Message-ID: References: <8378.1715059367@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8378.1715059367@localhost> X-Microslop: Just say no X-Originating-IP: 51.79.16.13 X-SpamExperts-Domain: out.mailpro1.whc.ca X-SpamExperts-Username: 51.79.16.13 Authentication-Results: web-dns1.com; auth=pass smtp.auth=51.79.16.13@out.mailpro1.whc.ca X-SpamExperts-Outgoing-Class: unsure X-SpamExperts-Outgoing-Evidence: Combined (0.31) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT8TvHqHVMvss05Gou53WyxAPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5zld3ahR2A9C95nDwwqDAET6NsFgs4TCG7+oUQcOpKHVYTb zWrvh7wwQJ02cfXBRNZm0Xh5EP6p27sCbKZ5p+Cn6BeAX27kmjzAva6vKOvDhGXx2azEPCntGfKY yhVHoInaJoqXa/JTDnzrd0b8b//38d7cYwJIzmjFIFIPSmgrgRxEeItq2JIRL0zr8XaAo87KpGdV Ql66JOJcRP6QmVEQQp4Csm9mGJQ0FI/szsInqf+lAdUByrvJirBGd40nfYsuDz3CzEYcGg6WVmeK cXh06cTrAfIBtLJVe62uoyOAUtfsPev7LNp/T0V6wcNiJWFv2Utyejz4sxZCS0To4ZUrBePc1eIG JIZGIi4gpoFggFIv9AWVxc1ygXreuz2BbYaLb5mum9xAXSaS3KKPtTZXWZip9+GhedmPokL8D3vh vVtGeuE5PWdy78KchNensgLp0sJdOkKqdD9x6uqeC1JiFH069urP+T0mXHxFNmQkKyk4xAm9D8KT eKJT7gNACPfrpX5tbW2x+DbE8DYItjA3CIUoAP97wmbMPbfAVX0yhDBBBiR9uLBlVFC/D9uLpGF1 QH646qPlrd7IcHUCiWiMkDCbsvXI/bvEyGq0IYwZfK+1QA2Bh1mjGxshvfghEpxfS9s5XUYLi1ZJ 0wR9fSpm1lxh+UgxtpMkbHXGD8vUrWAgWDjgJ9G+twY7XfT9BqMo/EDd2mryMusHc2XdR6NX93AW n8Z/boO/2WQuwvU/utfIUGn2GjIWwPYLOoCR80bAP/cRoI+7WicVrR2fe7mKCn59t8zu+Fl1CJmX KqRXcfUf9oDBqtClgM5jH/om1Q72bZa2BZnaUdqx0vA1TuurTRmYULvrS5JolvqqkXYQ/c6saKij f57BQaw0ovmP9JGt8S1/28qz51Ert2n+wxI46QabxNmZXDZB6iqpbd+3m3b3oZN6TtW+vK/GHUVx oG72OKHH5lr9xXvSM4nM3avg X-Report-Abuse-To: spam@se1.web-dns1.com 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.7 (-) Hi Ikumi, On Tue, May 7, 2024 at 14:22 (+0900), Ikumi Keita wrote: >>>>>> Jim writes: >> ConTeXt mode has the defun ConTeXt-mode-cleanup which is the :after-hook >> of ConTeXt-mode. In this cleanup defun, paragraph-start is re-set. >> Unfortunately, this over-writes my choice of paragraph-start which I set >> in my ConTeXt-mode hook. Unless there is some ":after-after-hook" or >> ":really-after-hook" or ":my-after-hook" or some other (unknown to me) >> way of doing something after ConTeXt-mode-cleanup, I have to >> handraulically (re-)setq paragraph-start after loading my file. >> This is not a good thing. >> The comment in context.el mentions doing this for reasons similar to the >> same part of latex.el, >> ;; Don't do locally-bound test for `LaTeX-paragraph-commands-regexp' >> ;; and `paragraph-start'. See comments in similar part in latex.el. >> but not being a latex user I don't understand why this is desired for latex >> users, and so I can't transmogrify that to why context users might want >> this. >> In any case, >> (a) do we really need the paragraph-start setting code in context.el, and >> (b) if so, could there be some user option which tells ConTeXt-mode-cleanup >> to *not* setq paragraph-start ? >> (Or perhaps there is already a way which I don't have enough emacs-fu to >> know. I am happy to be enlightened.) > Thank you for the report. The reason for LaTeX mode is that this > treatment enables AUCTeX to add flexibly new commands afterwards as > paragraph starters through sub files supporting various LaTeX packages > ("style files" in AUCTeX terminology). AUCTeX style files overwrites > `paragraph-start' casually in LaTeX mode, so users who want to customize > it in the LaTeX mode hook should actually set `LaTeX-paragraph-commands' > instead. > In principle, ConTeXt mode should have similar framework, although the > current AUCTeX style files have no support for ConTeXt modules except > TikZ. > I think I can implement `ConTeXt-paragraph-commands' like LaTeX mode and > then you can set it instead of `paragraph-start'. What do you think > about this idea? I spent a few minutes looking at the code; I now have a glimmer of understanding, thanks. I still am unclear about why the setting of paragraph-start is done in the after-hook, rather than before the user's hook is called. However, it may well be that I don't need to understand this. I think your solution would work for me. My current paragraph-start does not have "[ \t]*" and yet does what I want, but perhaps having "[ \t]*" won't hurt. Maybe it will make things better in some way I don't see now. Time will tell. In summary, thanks very much for the response, and if you are able to implement that for ConTeXt-mode I would very much appreciate it. Jim From unknown Sat Aug 16 16:57:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70811: ConTeXt-mode-cleanup clobbers my paragraph-start Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Thu, 09 May 2024 06:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70811 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Jim Cc: 70811@debbugs.gnu.org Received: via spool by 70811-submit@debbugs.gnu.org id=B70811.171523527613555 (code B ref 70811); Thu, 09 May 2024 06:15:01 +0000 Received: (at 70811) by debbugs.gnu.org; 9 May 2024 06:14:36 +0000 Received: from localhost ([127.0.0.1]:53270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4x35-0003WY-Fl for submit@debbugs.gnu.org; Thu, 09 May 2024 02:14:36 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:57218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4x32-0003WP-Ih for 70811@debbugs.gnu.org; Thu, 09 May 2024 02:14:34 -0400 Received: from localhost (42-144-18-247.rev.home.ne.jp [42.144.18.247]) by smtp1a.inetd.co.jp (Postfix) with ESMTPSA id 4E1D06C; Thu, 9 May 2024 15:14:02 +0900 (JST) From: Ikumi Keita In-reply-to: References: <8378.1715059367@localhost> Comments: In-reply-to Jim message dated "Tue, 07 May 2024 08:43:10 -0300." X-Mailer: MH-E 8.6+git; nmh 1.8; Emacs 29.3 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Thu, 09 May 2024 15:14:00 +0900 Message-ID: <21936.1715235240@localhost> 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 Jim, >>>>> Jim writes: >> I think I can implement `ConTeXt-paragraph-commands' like LaTeX mode and >> then you can set it instead of `paragraph-start'. What do you think >> about this idea? > I spent a few minutes looking at the code; I now have a glimmer of > understanding, thanks. > I still am unclear about why the setting of paragraph-start is done in > the after-hook, rather than before the user's hook is called. However, > it may well be that I don't need to understand this. Suppose that there is a file local variable entry for `LaTeX-paragraph-commands'. LaTeX mode uses after-hook so that its value is reflected to `paragraph-start'. In addition, AUCTeX style files casually overwrite `paragraph-start' to support various paragraph commands; in that procedure, they never care what the user set to `paragraph-start' in the mode hook and just overwrite. In other words, AUCTeX doesn't consider `paragraph-start' as a variable which is to be customized in the mode hook. The users are expected to use other variables to control `paragraph-start'. > I think your solution would work for me. My current paragraph-start > does not have "[ \t]*" and yet does what I want, but perhaps having "[ > \t]*" won't hurt. Maybe it will make things better in some way I don't > see now. Time will tell. > In summary, thanks very much for the response, and if you are able to > implement that for ConTeXt-mode I would very much appreciate it. Thanks. Can you try the attached patch? If you customize the new option `ConTeXt-paragraph-commands', its value will be reflected to `paragraph-start' (for new buffers created after the customization). Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Improve-paragraph-commands-management-for-ConTeXt-mo.patch >From b6bbde5c5678f23fdf6031d7f5dd29e811a792cd Mon Sep 17 00:00:00 2001 From: Ikumi Keita Date: Thu, 9 May 2024 14:47:06 +0900 Subject: [PATCH] Improve paragraph commands management for ConTeXt mode (bug#70811) * context.el (ConTeXt-paragraph-commands): New customize option similar to LaTeX counterpart. (ConTeXt-extra-paragraph-commands): Provide proper defvar. (ConTeXt-paragraph-commands-regexp-make): Rename from `ConTeXt-paragraph-commands-regexp' for consistency with latex.el. Make efficient regexp using `regexp-opt'. (ConTeXt-paragraph-commands-regexp): Add alias for backward compatibility. (ConTeXt-set-paragraph-start): Factor out following latex.el. (ConTeXt-paragraph-commands-add-locally): New convinience function similar to LaTeX counterpart. (ConTeXt-mode-cleanup): Use `ConTeXt-set-paragraph-start' so that the value of `ConTeXt-paragraph-commands' is refected to `paragraph-start'. --- context.el | 79 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 22 deletions(-) diff --git a/context.el b/context.el index 0d5b9adb..3ccd0637 100644 --- a/context.el +++ b/context.el @@ -53,9 +53,6 @@ (require 'latex) ; for functions like `TeX-look-at' and `LaTeX-split-long-menu' (require 'plain-tex) ; for `plain-TeX-common-initialization' -;; Silence the compiler: -(defvar ConTeXt-extra-paragraph-commands) - (defgroup ConTeXt-macro nil "Special support for ConTeXt macros in AUCTeX." :prefix "TeX-" @@ -1121,18 +1118,61 @@ If OPTIONAL, only insert it if not empty, and then use square brackets." (defvar ConTeXt-item-list () "List of macro's considered items.") -(defun ConTeXt-paragraph-commands-regexp () - "Return a regexp matching macros that should have their own line." +(defvar ConTeXt-extra-paragraph-commands nil + "List of default ConTeXt macros that should begin their own line. +Updated in language-specific initialization.") + +(defcustom ConTeXt-paragraph-commands nil + "List of user ConTeXt macros that should begin their own line. +The list should contain macro names without the leading backslash. + +If you change this variable, its value is reflected to only new buffers +created afterwards; existing ConTeXt mode buffers aren't affected." + :group 'ConTeXt-macro + :type '(repeat (string))) + +(defun ConTeXt-paragraph-commands-regexp-make () + "Return a regexp matching macros that should begin their own line." (concat - (regexp-quote TeX-esc) "\\(" + (regexp-quote TeX-esc) "\\(?:" "[][]\\|" ; display math delimitors (is this applicable to ConTeXt??) - (ConTeXt-environment-start-name) "\\|" - (ConTeXt-environment-stop-name) "\\|" - (mapconcat #'car ConTeXt-numbered-section-list "\\b\\|") "\\b\\|" - (mapconcat #'car ConTeXt-unnumbered-section-list "\\b\\|") "\\b\\|" - (mapconcat #'identity ConTeXt-extra-paragraph-commands "\\b\\|") - "\\b\\|" - (mapconcat #'identity ConTeXt-item-list "\\b\\|") "\\b\\)")) + (regexp-opt + (append + (list + (ConTeXt-environment-start-name) + (ConTeXt-environment-stop-name)) + (mapcar #'car ConTeXt-numbered-section-list) + (mapcar #'car ConTeXt-unnumbered-section-list) + ConTeXt-paragraph-commands + ConTeXt-extra-paragraph-commands + ConTeXt-item-list) + 'words) + "\\)")) +;; Backward compatibility. +(defalias 'ConTeXt-paragraph-commands-regexp + #'ConTeXt-paragraph-commands-regexp-make) + +(defun ConTeXt-set-paragraph-start () + "Set `paragraph-start'." + (setq paragraph-start + (concat + "[ \t]*\\(?:" + LaTeX-paragraph-commands-regexp "\\|" + "\\$\\$\\|" ; Plain TeX display math + "$\\)"))) + +(defun ConTeXt-paragraph-commands-add-locally (commands) + "Make COMMANDS be recognized as paragraph commands. +COMMANDS can be a single string or a list of strings which will be added +to `ConTeXt-extra-paragraph-commands'. Additionally +`LaTeX-paragraph-commands-regexp' will be updated. +This is mainly a convenience function which can be used in style files." + (unless (listp commands) (setq commands (list commands))) + (dolist (elt commands) + (add-to-list 'ConTeXt-extra-paragraph-commands elt)) + (setq-local LaTeX-paragraph-commands-regexp + (ConTeXt-paragraph-commands-regexp-make)) + (ConTeXt-set-paragraph-start)) ;; Outline support @@ -1908,16 +1948,11 @@ Run after mode hooks and file local variables application." (mapconcat #'identity ConTeXt-item-list "\\|") "\\)\\>"))) - ;; Don't do locally-bound test for `LaTeX-paragraph-commands-regexp' - ;; and `paragraph-start'. See comments in similar part in latex.el. (setq-local LaTeX-paragraph-commands-regexp - (ConTeXt-paragraph-commands-regexp)) - (setq paragraph-start - (concat - "[ \t]*\\(" - (ConTeXt-paragraph-commands-regexp) "\\|" - "\\$\\$\\|" ; Plain TeX display math - "$\\)"))) + (ConTeXt-paragraph-commands-regexp-make)) + ;; Don't do locally-bound test for `paragraph-start'. See comments in + ;; similar part in latex.el. + (ConTeXt-set-paragraph-start)) (defun context-guess-current-interface () "Guess what ConTeXt interface the current buffer is using." -- 2.44.0 --=-=-=-- From unknown Sat Aug 16 16:57:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70811: ConTeXt-mode-cleanup clobbers my paragraph-start Resent-From: Jim Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Sun, 12 May 2024 19:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70811 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Ikumi Keita Cc: 70811@debbugs.gnu.org Received: via spool by 70811-submit@debbugs.gnu.org id=B70811.171554281532625 (code B ref 70811); Sun, 12 May 2024 19:41:01 +0000 Received: (at 70811) by debbugs.gnu.org; 12 May 2024 19:40:15 +0000 Received: from localhost ([127.0.0.1]:56184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6F3O-0008U9-KQ for submit@debbugs.gnu.org; Sun, 12 May 2024 15:40:15 -0400 Received: from seout13.web-dns1.com ([67.215.8.22]:52010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6F3H-0008Tw-Rx for 70811@debbugs.gnu.org; Sun, 12 May 2024 15:40:13 -0400 Received: from mailpro1.whc.ca ([51.79.16.13]) by se1.web-dns1.com with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s6F39-00432w-E9; Sun, 12 May 2024 15:40:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=jdvb.ca; s=default; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TLyfYvedsD0o5HgZGXXNZx7tm/ftqLmsEKdj17Uzcx4=; b=gV2xRpZ4gHWAnSUkNLMFkqQS4w +M1KwRE4/HAbS7uzm7H/1QRyfRfjQqK1y4+5oB6MLL2pik1P6eQJxzeINFdkLdHjUH1HjygFmjvsg S3aVnBA0bQACsHexIw7VvcA9C69Ewg/NgvDmhUkPqPQpcbf8WxSV2ZfRVflpHbHMdgTxL+AQx36cd QzXotr3f2P8FRsE17NhsLXSPEyKzD4WTh334iTGYg9M1ORVrOY7HdY0+XOAiq8G+To1fXF9N7hVpo 64uaLBLaqBpdJIC5eBdELJqvmn5LW9VegeWoSrQcjiIDHbaukPzG642bVA5U7Xjh/z5T9F3YsIXXN FNDrE3GA==; Received: from [47.55.144.2] (port=46444 helo=x360) by mailpro1.whc.ca with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s6F31-00Aqfd-13; Sun, 12 May 2024 15:39:57 -0400 Received: by x360 (Postfix, from userid 1000) id BF4331E08DD; Sun, 12 May 2024 16:39:50 -0300 (ADT) Date: Sun, 12 May 2024 16:39:50 -0300 From: Jim Message-ID: References: <8378.1715059367@localhost> <21936.1715235240@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21936.1715235240@localhost> X-Microslop: Just say no X-Originating-IP: 51.79.16.13 X-SpamExperts-Domain: out.mailpro1.whc.ca X-SpamExperts-Username: 51.79.16.13 Authentication-Results: web-dns1.com; auth=pass smtp.auth=51.79.16.13@out.mailpro1.whc.ca X-SpamExperts-Outgoing-Class: unsure X-SpamExperts-Outgoing-Evidence: Combined (0.34) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT8BuBc9TAxgXcuMP1Q0VYKOPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5zld3ahR2A9C95nDwwqDAET6NsFgs4TCG7+oUQcOpKHVYTb zWrvh7wwQJ02cfXBRNZm0Xh5EP6p27sCbKZ5p+CnVX6DKESDu6jEIYYcUJ6gbWXx2azEPCntGfKY yhVHoInaJoqXa/JTDnzrd0b8b//38d7cYwJIzmjFIFIPSmgrgQx6WNq3qBrqFirkWusk5vcIInjg h2FHIdvKJ3QlAwaeQp4Csm9mGJQ0FI/szsInqf+lAdUByrvJirBGd40nfYsuDz3CzEYcGg6WVmeK cXh06cTrAfIBtLJVe62uoyOAUtfsPev7LNp/T0V6wcNiJWFv2Utyejz4sxZCS0To4ZUrBePc1eIG JIZGIi4gpoFggFIv9AWVxc1ygXreuz2BbYaLb5mum9xAXSaS3KKPtTZXWZip9+GhedmPokL8D3vh vVtGeuE5PWdy78KchNensgLp0sJdOkKqdD9x6uqeC1JiFH069urP+T0mXHxFNmQkKyk4xAm9D8KT eKJT7gNACPfrpX5tbW2x+DbE8DYItjA3VKykPleqV+WwxIlzrEfKJ9P5pROqw+/zlUP6TeTsOgXm FuENK/Kk2HR/u8O5EvIgn/JJ5H4qRHcZufIYrEiGYWGGW6zEtBDxtBJRScabKQUxCnbRrsNzTdgu XXkJRfGnT1x3J3x9C/JvCw0OsaaS7pBpMv6XivSqOVF9dOkUQ6u45yZIVeO0dDU5Wq59q7QsBAq7 myDun4fi/7WJWrFC77gLFt8LUcWHHWGiQcW8ROpvA3QEKTMFvUWB5kl7tpOKC5WxiWGubx+Y+UVt /SqZUuuO5TcDeKjrEmYPn2IVWRuZugsMmckvsCm2uLlbyBQeeA3W5s5CQMWewsivofMgUVuzlEXU F5Xku3OEdnsQ1QSoTtVfe5+13BWNcC5km3of7HdsJQ9VgfAYiaG2zv4s6PoumsD+E65k6PweojVG 7oHJJ8slNEAaYitUH/s60iid X-Report-Abuse-To: spam@se1.web-dns1.com 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 Ikumi, sorry for the slow reply. See below. On Thu, May 9, 2024 at 15:14 (+0900), Ikumi Keita wrote: >>>>>> Jim writes: >>> I think I can implement `ConTeXt-paragraph-commands' like LaTeX mode and >>> then you can set it instead of `paragraph-start'. What do you think >>> about this idea? >> I spent a few minutes looking at the code; I now have a glimmer of >> understanding, thanks. >> I still am unclear about why the setting of paragraph-start is done in >> the after-hook, rather than before the user's hook is called. However, >> it may well be that I don't need to understand this. > Suppose that there is a file local variable entry for > `LaTeX-paragraph-commands'. LaTeX mode uses after-hook so that its value > is reflected to `paragraph-start'. In addition, AUCTeX style files > casually overwrite `paragraph-start' to support various paragraph > commands; in that procedure, they never care what the user set to > `paragraph-start' in the mode hook and just overwrite. In other words, > AUCTeX doesn't consider `paragraph-start' as a variable which is to be > customized in the mode hook. The users are expected to use other > variables to control `paragraph-start'. >> I think your solution would work for me. My current paragraph-start >> does not have "[ \t]*" and yet does what I want, but perhaps having "[ >> \t]*" won't hurt. Maybe it will make things better in some way I don't >> see now. Time will tell. >> In summary, thanks very much for the response, and if you are able to >> implement that for ConTeXt-mode I would very much appreciate it. > Thanks. Can you try the attached patch? If you customize the new option > `ConTeXt-paragraph-commands', its value will be reflected to > `paragraph-start' (for new buffers created after the customization). Thank you very much for spending some time on this. I tried it on this section of code \startitemize[yadda] \item sslkdslkd lskdlskdls slkd slkdslk sldk sldkl lkslks d sldsldk s sldksldk slkdsldksd sldsldk s sldksldk slkdsldksd sldsldk s sldksldk slkdsldksd \item sldsldk s sldksldk slkdsldksd \item fill this paragraph right here fill this paragraph right here fill this paragraph right here fill this paragraph right here \stopitemize and if I run fill-paragraph on the last item, I get ... \item fill this paragraph right here fill this paragraph right here fill this paragraph right here fill this paragraph right here \stopitemize (i.e., the \stopitemize has become "part of" the "\item" paragraph). I won't try to imagine what other ConTeXt users want, but I don't like this. I customized Context-Paragraph-Commands by adding stopitemize, and that fixed this particular issue. But there are many built-in \stop commands, and I wonder if the default definition should (could?) somehow capture all of them. (My initial attempt was to add 'stop' to the customization, but that did not work for me.) At the risk of startling anyone reading this, I'll mention that for my plain TeX usage, I use (setq paragraph-start "\\\\") This does what I want in 99.5% of the cases, and I can live with the incorrect thing happening 0.5% of the time. Given that the (interactive) customization doesn't want the leading '\', is there any way to add that to paragraph-start with the code you recently added? Thanks very much. Jim From unknown Sat Aug 16 16:57:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70811: ConTeXt-mode-cleanup clobbers my paragraph-start Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Mon, 13 May 2024 15:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70811 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Jim Cc: 70811@debbugs.gnu.org Received: via spool by 70811-submit@debbugs.gnu.org id=B70811.171561446032708 (code B ref 70811); Mon, 13 May 2024 15:35:02 +0000 Received: (at 70811) by debbugs.gnu.org; 13 May 2024 15:34:20 +0000 Received: from localhost ([127.0.0.1]:33339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6Xgy-0008VU-4a for submit@debbugs.gnu.org; Mon, 13 May 2024 11:34:20 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:41856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6Xgv-0008VO-2f for 70811@debbugs.gnu.org; Mon, 13 May 2024 11:34:19 -0400 Received: from localhost (42-144-18-247.rev.home.ne.jp [42.144.18.247]) by smtp1a.inetd.co.jp (Postfix) with ESMTPSA id A884C76; Tue, 14 May 2024 00:34:12 +0900 (JST) From: Ikumi Keita In-reply-to: References: <8378.1715059367@localhost> <21936.1715235240@localhost> Comments: In-reply-to Jim message dated "Sun, 12 May 2024 16:39:50 -0300." X-Mailer: MH-E 8.6+git; nmh 1.8; Emacs 29.3 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Tue, 14 May 2024 00:34:11 +0900 Message-ID: <6122.1715614451@localhost> 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 Jim, >>>>> Jim writes: > Thank you very much for spending some time on this. I tried it on this > section of code > \startitemize[yadda] > \item sslkdslkd lskdlskdls slkd slkdslk > sldk sldkl > lkslks d sldsldk s sldksldk slkdsldksd sldsldk s sldksldk slkdsldksd > sldsldk s sldksldk slkdsldksd > \item sldsldk s sldksldk slkdsldksd > \item fill this paragraph right here > fill this paragraph right here fill this paragraph right here > fill this paragraph right here > \stopitemize > and if I run fill-paragraph on the last item, I get > ... > \item fill this paragraph right here fill this paragraph right here fill > this paragraph right here fill this paragraph right here \stopitemize > (i.e., the \stopitemize has become "part of" the "\item" paragraph). I > won't try to imagine what other ConTeXt users want, but I don't like this. Thanks for your report. I'm sorry, I was wrong at altering regexp generation code. Can you try the attached patch? (Undo the last patch and apply the attached patch to the fresh source, please.) > I wonder if the default definition should (could?) somehow capture all > of them. I expect the revised patch fills that bill. > Given that the (interactive) customization doesn't want the leading > '\', Do you mean that `ConTeXt-paragraph-commands' doesn't include the leading backslash? Then it isn't specific to interactive customization. It is desgined after LaTeX counterpart, which also doesn't include the leading backslash. > is there any way to add that to paragraph-start with the code you > recently added? You can use (add-hook 'LaTeX-mode-hook (lambda () (add-hook 'find-file-hook (lambda () (setq paragraph-start "abc")) <-- Set whatever you like nil t))) in your init file if you really need, but I'd like you to try the patch below first. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Improve-paragraph-commands-management-for-ConTeXt-mo.patch Content-Description: revised patch >From edc178926f57eca69c1676715657486f2e6ac952 Mon Sep 17 00:00:00 2001 From: Ikumi Keita Date: Thu, 9 May 2024 14:47:06 +0900 Subject: [PATCH] Improve paragraph commands management for ConTeXt mode (bug#70811) * context.el (ConTeXt-paragraph-commands): New customize option similar to LaTeX counterpart. (ConTeXt-extra-paragraph-commands): Provide proper defvar. (ConTeXt-paragraph-commands-regexp-make): Rename from `ConTeXt-paragraph-commands-regexp' for consistency with latex.el. Include `ConTeXt-paragraph-commands' to generate the regexp. (ConTeXt-paragraph-commands-regexp): Add alias for backward compatibility. (ConTeXt-set-paragraph-start): Factor out following latex.el. (ConTeXt-paragraph-commands-add-locally): New convinience function similar to LaTeX counterpart. (ConTeXt-mode-cleanup): Use new functions. --- context.el | 63 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/context.el b/context.el index 0d5b9adb..8b0c88ee 100644 --- a/context.el +++ b/context.el @@ -53,9 +53,6 @@ (require 'latex) ; for functions like `TeX-look-at' and `LaTeX-split-long-menu' (require 'plain-tex) ; for `plain-TeX-common-initialization' -;; Silence the compiler: -(defvar ConTeXt-extra-paragraph-commands) - (defgroup ConTeXt-macro nil "Special support for ConTeXt macros in AUCTeX." :prefix "TeX-" @@ -1121,18 +1118,59 @@ If OPTIONAL, only insert it if not empty, and then use square brackets." (defvar ConTeXt-item-list () "List of macro's considered items.") -(defun ConTeXt-paragraph-commands-regexp () - "Return a regexp matching macros that should have their own line." +(defvar ConTeXt-extra-paragraph-commands nil + "List of default ConTeXt macros that should begin their own line. +Unlike `ConTeXt-paragraph-commands', each entry should be a regular +expression without leading backslash. +Updated in language-specific initialization.") + +(defcustom ConTeXt-paragraph-commands nil + "List of user ConTeXt macros that should begin their own line. +The list should contain macro names without the leading backslash. + +If you change this variable, its value is reflected to only new buffers +created afterwards; existing ConTeXt mode buffers aren't affected." + :group 'ConTeXt-macro + :type '(repeat (string))) + +(defun ConTeXt-paragraph-commands-regexp-make () + "Return a regexp matching macros that should begin their own line." (concat - (regexp-quote TeX-esc) "\\(" + (regexp-quote TeX-esc) "\\(?:" "[][]\\|" ; display math delimitors (is this applicable to ConTeXt??) (ConTeXt-environment-start-name) "\\|" (ConTeXt-environment-stop-name) "\\|" (mapconcat #'car ConTeXt-numbered-section-list "\\b\\|") "\\b\\|" (mapconcat #'car ConTeXt-unnumbered-section-list "\\b\\|") "\\b\\|" + (mapconcat #'identity ConTeXt-paragraph-commands "\\b\\|") "\\b\\|" (mapconcat #'identity ConTeXt-extra-paragraph-commands "\\b\\|") "\\b\\|" (mapconcat #'identity ConTeXt-item-list "\\b\\|") "\\b\\)")) +;; Backward compatibility. +(defalias 'ConTeXt-paragraph-commands-regexp + #'ConTeXt-paragraph-commands-regexp-make) + +(defun ConTeXt-set-paragraph-start () + "Set `paragraph-start'." + (setq paragraph-start + (concat + "[ \t]*\\(?:" + LaTeX-paragraph-commands-regexp "\\|" + "\\$\\$\\|" ; Plain TeX display math + "$\\)"))) + +(defun ConTeXt-paragraph-commands-add-locally (commands) + "Make COMMANDS be recognized as paragraph commands. +COMMANDS can be a single string or a list of strings which will be added +to `ConTeXt-extra-paragraph-commands'. Additionally +`LaTeX-paragraph-commands-regexp' will be updated. +This is mainly a convenience function which can be used in style files." + (unless (listp commands) (setq commands (list commands))) + (dolist (elt commands) + (add-to-list 'ConTeXt-extra-paragraph-commands elt)) + (setq-local LaTeX-paragraph-commands-regexp + (ConTeXt-paragraph-commands-regexp-make)) + (ConTeXt-set-paragraph-start)) ;; Outline support @@ -1908,16 +1946,11 @@ Run after mode hooks and file local variables application." (mapconcat #'identity ConTeXt-item-list "\\|") "\\)\\>"))) - ;; Don't do locally-bound test for `LaTeX-paragraph-commands-regexp' - ;; and `paragraph-start'. See comments in similar part in latex.el. (setq-local LaTeX-paragraph-commands-regexp - (ConTeXt-paragraph-commands-regexp)) - (setq paragraph-start - (concat - "[ \t]*\\(" - (ConTeXt-paragraph-commands-regexp) "\\|" - "\\$\\$\\|" ; Plain TeX display math - "$\\)"))) + (ConTeXt-paragraph-commands-regexp-make)) + ;; Don't do locally-bound test for `paragraph-start'. See comments in + ;; similar part in latex.el. + (ConTeXt-set-paragraph-start)) (defun context-guess-current-interface () "Guess what ConTeXt interface the current buffer is using." -- 2.44.0 --=-=-=-- From unknown Sat Aug 16 16:57:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70811: ConTeXt-mode-cleanup clobbers my paragraph-start Resent-From: Jim Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Mon, 13 May 2024 16:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70811 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Ikumi Keita Cc: 70811@debbugs.gnu.org Received: via spool by 70811-submit@debbugs.gnu.org id=B70811.171561949814708 (code B ref 70811); Mon, 13 May 2024 16:59:01 +0000 Received: (at 70811) by debbugs.gnu.org; 13 May 2024 16:58:18 +0000 Received: from localhost ([127.0.0.1]:33749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6Z0E-0003pA-9R for submit@debbugs.gnu.org; Mon, 13 May 2024 12:58:18 -0400 Received: from seout2.web-dns1.com ([68.168.119.163]:51910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6Z0A-0003p2-Hv for 70811@debbugs.gnu.org; Mon, 13 May 2024 12:58:16 -0400 Received: from mailpro1.whc.ca ([51.79.16.13]) by se3.web-dns1.com with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s6Z01-00ANEj-GU; Mon, 13 May 2024 12:58:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=jdvb.ca; s=default; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=a3fwzqn1U60IXq/fElQfuuXxqh0kjKCQmcD9jk8UWnU=; b=P7ks0Tygche8SbGqazhjxwuz2n OCz7QuZGGLjEZbFs7g9JiOn/PjBbscKZfbe1OpDMCQn2iDxe1Hmpj3K2aF1ETHzwsV8hl//mubwus RWlOEDBLW6zG5wC/4nm3gZ9mXiPw4Roa9cvQPxdqxXLiEf7i+HqegGtpp9GDI6bwKpd+qVC8SHlVy uEGS51Bi0JKWMDalKtnzTdALK4YPt0QKi/PlnKQGuiMIqbqs4Q9DoBwskXzO+cbbryz+abctuCSkB lFvba6LcJDrtpyKJ3kf2fc7pKXC+O4BG6Dc0cc5P9I/CylpxYX4/4M3r2ORuqWXMskN6UVXS+js/5 d9cTzstQ==; Received: from [47.55.144.2] (port=55466 helo=x360) by mailpro1.whc.ca with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s6Yzs-00GLM6-1R; Mon, 13 May 2024 12:58:04 -0400 Received: by x360 (Postfix, from userid 1000) id 11B621E08E1; Mon, 13 May 2024 13:57:56 -0300 (ADT) Date: Mon, 13 May 2024 13:57:56 -0300 From: Jim Message-ID: References: <8378.1715059367@localhost> <21936.1715235240@localhost> <6122.1715614451@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6122.1715614451@localhost> X-Microslop: Just say no X-Originating-IP: 51.79.16.13 X-SpamExperts-Domain: out.mailpro1.whc.ca X-SpamExperts-Username: 51.79.16.13 Authentication-Results: web-dns1.com; auth=pass smtp.auth=51.79.16.13@out.mailpro1.whc.ca X-SpamExperts-Outgoing-Class: unsure X-SpamExperts-Outgoing-Evidence: Combined (0.35) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT+X2fAPKoBvUg1bb3yZpLmOPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5zld3ahR2A9C95nDwwqDAET6NsFgs4TCG7+oUQcOpKHVYTb zWrvh7wwQJ02cfXBRNZm0Xh5EP6p27sCbKZ5p+CnqsQ3/YYowz84XV5TyePXsWXx2azEPCntGfKY yhVHoInaJoqXa/JTDnzrd0b8b//38d7cYwJIzmjFIFIPSmgrgQx6WNq3qBrqFirkWusk5vfKpGdV Ql66JOJcRP6QmVEQQp4Csm9mGJQ0FI/szsInqf+lAdUByrvJirBGd40nfYsuDz3CzEYcGg6WVmeK cXh06cTrAfIBtLJVe62uoyOAUtfsPev7LNp/T0V6wcNiJWFv2Utyejz4sxZCS0To4ZUrBePc1eIG JIZGIi4gpoFggFIv9AWVxc1ygXreuz2BbYaLb5mum9xAXSaS3KKPtTZXWZip9+GhedmPokL8D3vh vVtGeuE5PWdy78KchNensgLp0sJdOkKqdD9x6uqeC1JiFH069urP+T0mXHxFNmQkKyk4xAm9D8KT eKJT7gNACPfrpX5tbW2x+DbE8DYItjA3CIUoAP97wmbMPbfAVX0yhDBBBiR9uLBlVFC/D9uLpGE3 TeL9YvcKlnYr6yxmu3f8JyxikeSJ9iVUOiXCkHoj2q+1QA2Bh1mjGxshvfghEpxfS9s5XUYLi1ZJ 0wR9fSpm1lxh+UgxtpMkbHXGD8vUrWAgWDjgJ9G+twY7XfT9BqMo/EDd2mryMusHc2XdR6NXUWED K3RD133/aw0D4JK51AJatazjptFkSnW84v/3747AP/cRoI+7WicVrR2fe7mKCn59t8zu+Fl1CJmX KqRXcfUf9oDBqtClgM5jH/om1Q72bZa2BZnaUdqx0vA1TuurTRmYULvrS5JolvqqkXYQ/c6saKij f57BQaw0ovmP9JGt8S1/28qz51Ert2n+wxI46QabxNmZXDZB6iqpbd+3m3b3oZN6TtW+vK/GHUVx oG72OKHH5lr9xXvSM4nM3avg X-Report-Abuse-To: spam@se1.web-dns1.com 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 Ikumi, On Tue, May 14, 2024 at 00:34 (+0900), Ikumi Keita wrote: >>>>>> Jim writes: >> Thank you very much for spending some time on this. I tried it on this >> section of code >> \startitemize[yadda] >> \item sslkdslkd lskdlskdls slkd slkdslk >> sldk sldkl >> lkslks d sldsldk s sldksldk slkdsldksd sldsldk s sldksldk slkdsldksd >> sldsldk s sldksldk slkdsldksd >> \item sldsldk s sldksldk slkdsldksd >> \item fill this paragraph right here >> fill this paragraph right here fill this paragraph right here >> fill this paragraph right here >> \stopitemize >> and if I run fill-paragraph on the last item, I get >> ... >> \item fill this paragraph right here fill this paragraph right here fill >> this paragraph right here fill this paragraph right here \stopitemize >> (i.e., the \stopitemize has become "part of" the "\item" paragraph). I >> won't try to imagine what other ConTeXt users want, but I don't like this. > Thanks for your report. I 'm sorry, I was wrong at altering regexp > generation code. Can you try the attached patch? (Undo the last patch > and apply the attached patch to the fresh source, please.) In the interest of getting you an answer quickly, I only tested it for about 5 minutes, but in all of those tests, I can happily say that it did what I wanted it to do. >> I wonder if the default definition should (could?) somehow capture all >> of them. > I expect the revised patch fills that bill. It certainly did in my brief tests. >> Given that the (interactive) customization doesn't want the leading >> '\', > Do you mean that `ConTeXt-paragraph-commands' doesn't include the leading > backslash? Then it isn't specific to interactive customization. It is > designed after LaTeX counterpart, which also doesn't include the leading > backslash. Indeed, I assumed that restriction was not from the interactive customization, but instead from the auctex code. >> is there any way to add that to paragraph-start with the code you >> recently added? > You can use > (add-hook 'LaTeX-mode-hook > (lambda () > (add-hook 'find-file-hook > (lambda () > (setq paragraph-start "abc")) <-- Set whatever you like > nil t))) > in your init file if you really need, but I'd like you to try the patch > below first. Thanks for that emacs-fu. (Although I wonder if I want 'ConTeXt-mode-hook' intead of 'LaTeX-mode-hook'.) Regardless of what hook I should use, this version of your patch seems to work very nicely. Thank you for all the time you have put into this. Jim From unknown Sat Aug 16 16:57:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70811: ConTeXt-mode-cleanup clobbers my paragraph-start Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 14 May 2024 11:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70811 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Jim Cc: 70811@debbugs.gnu.org Received: via spool by 70811-submit@debbugs.gnu.org id=B70811.17156863723693 (code B ref 70811); Tue, 14 May 2024 11:33:02 +0000 Received: (at 70811) by debbugs.gnu.org; 14 May 2024 11:32:52 +0000 Received: from localhost ([127.0.0.1]:38808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6qOo-0000xV-6G for submit@debbugs.gnu.org; Tue, 14 May 2024 07:32:51 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:44730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6qOj-0000xP-UM for 70811@debbugs.gnu.org; Tue, 14 May 2024 07:32:48 -0400 Received: from localhost (42-144-18-247.rev.home.ne.jp [42.144.18.247]) by smtp1a.inetd.co.jp (Postfix) with ESMTPSA id 4861374; Tue, 14 May 2024 20:32:42 +0900 (JST) From: Ikumi Keita In-reply-to: References: <8378.1715059367@localhost> <21936.1715235240@localhost> <6122.1715614451@localhost> Comments: In-reply-to Jim message dated "Mon, 13 May 2024 13:57:56 -0300." X-Mailer: MH-E 8.6+git; nmh 1.8; Emacs 29.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 14 May 2024 20:32:39 +0900 Message-ID: <8007.1715686359@localhost> 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 Jim, >>>>> Jim writes: > In the interest of getting you an answer quickly, I only tested it for > about 5 minutes, but in all of those tests, I can happily say that it did > what I wanted it to do. Thanks for testing. I pushed the fix to the git repository. >> You can use >> (add-hook 'LaTeX-mode-hook >> (lambda () >> (add-hook 'find-file-hook >> (lambda () >> (setq paragraph-start "abc")) <-- Set whatever you like >> nil t))) >> in your init file if you really need, but I'd like you to try the patch >> below first. > Thanks for that emacs-fu. (Although I wonder if I want 'ConTeXt-mode-hoo= k' > intead of 'LaTeX-mode-hook'.) You are right. That's `ConTeXt-mode-hook'. =F0=9F=92=A6 > Regardless of what hook I should use, this version of your patch seems to > work very nicely. Thank you for all the time you have put into this. You're welcome. I'll close this bug. Best regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW From debbugs-submit-bounces@debbugs.gnu.org Tue May 14 07:33:23 2024 Received: (at control) by debbugs.gnu.org; 14 May 2024 11:33:23 +0000 Received: from localhost ([127.0.0.1]:38813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6qPJ-0000yH-15 for submit@debbugs.gnu.org; Tue, 14 May 2024 07:33:23 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:44738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6qPD-0000y9-PE for control@debbugs.gnu.org; Tue, 14 May 2024 07:33:19 -0400 Received: from localhost (42-144-18-247.rev.home.ne.jp [42.144.18.247]) by smtp1a.inetd.co.jp (Postfix) with ESMTPSA id CA0D874 for ; Tue, 14 May 2024 20:33:13 +0900 (JST) To: control@debbugs.gnu.org From: Ikumi Keita Subject: control message for bug #70811 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8050.1715686391.1@localhost> Date: Tue, 14 May 2024 20:33:11 +0900 Message-ID: <8052.1715686391@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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 (-) close 70811 quit