From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.help Subject: Re: Mode hooks for latex and tex files Date: Mon, 02 Dec 2024 21:17:49 +0100 Message-ID: References: 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="26074"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 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:18:43 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 1tICsV-0006ai-LX for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 02 Dec 2024 21:18:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tICsB-00060E-U7; Mon, 02 Dec 2024 15:18:23 -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 1tICs7-0005zv-Rb for help-gnu-emacs@gnu.org; Mon, 02 Dec 2024 15:18:20 -0500 Original-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 1tICs6-0007ct-BW; Mon, 02 Dec 2024 15:18:19 -0500 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=ua7GkpCwcSaI68e+wEpH0Ctv3lqPkg/EB4HsDaQIQh8=; b=mHkNIhyHFmhDUs2Be6ep QoRUzsj0rPu+oeHxwCBqSmjs0+V74VET4AtRbrFuZZXOLgTdT50qM0Y0whk8lfXUrc9RTVtj9Ow4O 9uFyzJWAk1UPxdVKIaGKKvgeAY7yoZ5u4q38rN6uN3Rx8fpJvk5mLylUYDqJRvsYmB7FjbAE2X5A6 ccMU+wkWgAkhf5lyxUjSfXjL7uQ2mdZe8EvVYZSWUOlr2RQ4jRLrT6zYcWHgJKUX1WJLXhJrjeeYG 2GWCvvZVQQE6eKR5aWgm3oL06Q/g57IH5j90AI44b5RkDAepsqAPTw/P/Xr5OfH7Kmtuj1yHuh9o5 7OMr4QUH8gY0ig==; In-Reply-To: (Heime's message of "Mon, 02 Dec 2024 15:58:13 +0000") 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:148501 Archived-At: Heime writes: > On Tuesday, December 3rd, 2024 at 1:17 AM, Arash Esbati w= rote: > >> The only point you have to consider is that there are 2 major modes for >> editing plain-tex and latex files: >> >> =E2=80=A2 The modes bundled with Emacs (in tex-mode.el, do >> 'M-x locate-library RET tex-mode RET') and >> >> =E2=80=A2 the modes provided by AUCTeX (a package you must install from = ELPA >> first). >> >> 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'. >> >> `tex-mode-hook' and` TeX-mode-hook' are sort of meta-modes and not >> intended for end users, so don't set them. > > AUCTeX introduces unnecessary complexity by deviating from standard > naming conventions for tool-related modes. Which naming conventions are you referring to and where are they described? The ones I'm aware of are written here[1] which read: 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. 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-'. > 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. 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; 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: $ 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" 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. > 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? Did you read my first message? Best, Arash Footnotes: [1] https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Coding-= Conventions