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:44:04 +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="7847"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Arash Esbati , help-gnu-emacs@gnu.org To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 02 21:44:38 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 1tIDHZ-0001rb-PY for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 02 Dec 2024 21:44:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIDHK-0004eM-Ea; Mon, 02 Dec 2024 15:44:22 -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 1tIDHF-0004de-Pf for help-gnu-emacs@gnu.org; Mon, 02 Dec 2024 15:44:18 -0500 Original-Received: from mail-4027.protonmail.ch ([185.70.40.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIDHC-0006ek-UV for help-gnu-emacs@gnu.org; Mon, 02 Dec 2024 15:44:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1733172250; x=1733431450; bh=lyuzANk3uySwfzu76Xyh9zLg10XN9vJCnzc6x1OG2wU=; 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=K2m5HJ3RrGBbiWXeuw40BnRZNZ+X8MjOoPu5VVh3mEeJUAlPiKcGUWNPyeY/gHIvQ j4N0GkBL6b78WWMDbhy4mfflDmXqzeG41w/swetSn/nXH36Fo31ygzaPy9lmZeYajC cEe5CRQPgacdieQM9SiXjnbo6Jb5P+elyTyT3KC2qxLUVZoIMKTpVqORCUu30OEWyl ljnpvhVfbJNRojV6lfqs0yUaG8vDriBitdcjzChLgm+ZjjYHk5HYkE7nNxIp1H5LiF J8syzAZF/Ktwo8xWNyVcCMyMxxz9nS0l+Tfg6h6kGL09P4/j350iqf3G8n7Z8MiCb7 suNFVVZujm9RQ== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: 9df0e4d44fddc21501a0531c418172eb5df49582 Received-SPF: pass client-ip=185.70.40.27; envelope-from=heimeborgia@protonmail.com; helo=mail-4027.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, TO_EQ_FM_DIRECT_MX=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:148505 Archived-At: Sent with Proton Mail secure email. On Tuesday, December 3rd, 2024 at 8:29 AM, Heime via Users list for the GNU= Emacs text editor wrote: > On Tuesday, December 3rd, 2024 at 8:17 AM, Arash Esbati arash@gnu.org wro= te: >=20 > > Heime heimeborgia@protonmail.com writes: > >=20 > > > On Tuesday, December 3rd, 2024 at 1:17 AM, Arash Esbati arash@gnu.org= wrote: > > >=20 > > > > The only point you have to consider is that there are 2 major modes= for > > > > 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 = from 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 > > 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 > > This is one opinion; but AUCTeX developers had another one for the > > prefix they used. >=20 > > > 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 name= s > > > like tex-mode, reserving such names for user-facing > > > functionality. This inconsistency is unique to AUCTeX; > >=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. >=20 >=20 > Correct, it breaks every rule. Instead of a prefix, the AUCTeX developers > decided upon a camel-case variant. Their package does not fit nicely with > emacs development preferred way. >=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 > > Did you read my first message? I missed the last hook part. Thanks. =20 > > Best, Arash > >=20 > > Footnotes: > > [1] https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Codi= ng-Conventions