From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Mode hooks for latex and tex files Date: Mon, 02 Dec 2024 20:29:34 +0000 Message-ID: References: Reply-To: Heime Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32393"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Arash Esbati Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 02 21:30:14 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tID3d-0008FH-Pn for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 02 Dec 2024 21:30:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tID3F-00089d-8d; Mon, 02 Dec 2024 15:29:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tID38-00089E-Jv for help-gnu-emacs@gnu.org; Mon, 02 Dec 2024 15:29:42 -0500 Original-Received: from mail-43167.protonmail.ch ([185.70.43.167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tID35-00029V-SZ for help-gnu-emacs@gnu.org; Mon, 02 Dec 2024 15:29:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1733171377; x=1733430577; bh=t3PdwlImoMvYRjRggaZ5/eCe8wuAECSlQWCsMQqs0yg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=OpYmN4BNsMgDGxJKAKsU4U5oGQg/f+z6yv3XWTjCS2NsHuQHNZCJ/BnCNgG9hAlWs /qgF3Q1zIqKwF2wG95RgG0kxIw7sQedalgt+qLQkRYpbRHSJw8Zd8oQ2HDrRY4we+w /qxvr9Dm/Ug57LYlO4fUJjZ7cnCeJMGOHUuQSeft17CjoLxzqQFdWbqvP1Fds9TTHw WdWTprA22DXkRZcU7NQBuimYjrzwbaBpC57Xr785JrJevPqlagJFx9TVymATHidTbx di7gJ6rAFeMe7MXpqC9m8dhIBa/yaYshtHOvUYEePLKj1SEew5DR6Cp0WSZSz3H0uc PwcPGDYLDsODQ== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: 7210acc9fd2c4a47d20051900ebbcc5464e3a5d2 Received-SPF: pass client-ip=185.70.43.167; envelope-from=heimeborgia@protonmail.com; helo=mail-43167.protonmail.ch 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148502 Archived-At: On Tuesday, December 3rd, 2024 at 8:17 AM, Arash Esbati wro= te: > Heime heimeborgia@protonmail.com writes: >=20 > > On Tuesday, December 3rd, 2024 at 1:17 AM, Arash Esbati arash@gnu.org w= rote: > >=20 > > > The only point you have to consider is that there are 2 major modes f= or > > > editing plain-tex and latex files: > > >=20 > > > =E2=80=A2 The modes bundled with Emacs (in tex-mode.el, do > > > 'M-x locate-library RET tex-mode RET') and > > >=20 > > > =E2=80=A2 the modes provided by AUCTeX (a package you must install fr= om ELPA > > > first). > > >=20 > > > If you're using the former, use `plain-tex-mode-hook' or` > > > latex-mode-hook', and with the latter, set `plain-TeX-mode-hook' or` > > > LaTeX-mode-hook'. > > >=20 > > > `tex-mode-hook' and` TeX-mode-hook' are sort of meta-modes and not > > > intended for end users, so don't set them. > >=20 > > AUCTeX introduces unnecessary complexity by deviating from standard > > naming conventions for tool-related modes. >=20 >=20 > Which naming conventions are you referring to and where are they > described? The ones I'm aware of are written here[1] which read: >=20 > You should choose a short word to distinguish your program from other > Lisp programs. The names of all global symbols in your program, that > is the names of variables, constants, and functions, should begin with > that chosen prefix. Separate the prefix from the rest of the name with > a hyphen, =E2=80=98-=E2=80=99. This practice helps avoid name conflicts, = since all > global variables in Emacs Lisp share the same name space, and all > functions share another name space. >=20 > AUCTeX uses camel-case prefix based on the file names, a sort of > MyLib-varname. As another example, you can grep through the gnus > sub-directory to see that not every hook defined there is prefixed with > 'gnus-'. >=20 > > Instead of adhering to the typical package-prefixed predicate style > > (e.g., auctex-tex-mode and auctex-latex-mode), it opts for > > inconsistent and unintuitive names. >=20 >=20 > This is one opinion; but AUCTeX developers had another one for the > prefix they used. > > The use of plain-tex-mode instead of a unified tex-mode (as seen with > > latex-mode) adds further redundancy. Meta-modes not intended for > > direct user interaction should avoid using intuitive and general names > > like tex-mode, reserving such names for user-facing > > functionality. This inconsistency is unique to AUCTeX; >=20 >=20 > The mode names above (and the corresponding hooks) are all defined in > tex-mode.el which is distributed with Emacs; they don't belong to > AUCTeX: >=20 > $ grep define-derived-mode tex-mode.el > (define-derived-mode tex-mode text-mode "generic-TeX" > (define-derived-mode plain-tex-mode tex-mode "TeX" > (define-derived-mode latex-mode tex-mode "LaTeX" > (define-derived-mode slitex-mode latex-mode "SliTeX" > (define-derived-mode tex-shell shell-mode "TeX-Shell" > (define-derived-mode doctex-mode latex-mode "DocTeX" >=20 > As you can see, tex-mode.el breaks every "rule" you think you're > describing with "typical package-prefixed predicate style". A "mylib-" > prefix might be a natural choice for single file libraries, but it isn't > a must as long you get the prefix right. Correct, it breaks every rule. Instead of a prefix, the AUCTeX developers= =20 decided upon a camel-case variant. Their package does not fit nicely with emacs development preferred way. =20 =20 > > I am also interested in the made hooks. Would the built-in be > > plain-tex-mode-hook and latex-mode-hook? Is there also tex-mode-hook? >=20 >=20 > Did you read my first message? >=20 > Best, Arash >=20 > Footnotes: > [1] https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Coding= -Conventions