unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Mode hooks for latex and tex files
@ 2024-11-30 19:55 Heime via Users list for the GNU Emacs text editor
  2024-12-01 14:43 ` Jean Louis
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-11-30 19:55 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor


What are the mode hooks for latex and tex files?

Using latex and tex is currently very non-intuitive, with things
like LaTex-mode, TeX-mode.  This mixed capitalisation is all too 
confusing because ordinary users see only a latex or tex configuration
for their modes, rather than the nuances of capitalisation changes.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-11-30 19:55 Mode hooks for latex and tex files Heime via Users list for the GNU Emacs text editor
@ 2024-12-01 14:43 ` Jean Louis
  2024-12-01 14:58   ` Heime via Users list for the GNU Emacs text editor
  2024-12-02 11:13 ` Joel Reicher
  2024-12-02 13:17 ` Arash Esbati
  2 siblings, 1 reply; 13+ messages in thread
From: Jean Louis @ 2024-12-01 14:43 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

* Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2024-11-30 22:57]:
> 
> What are the mode hooks for latex and tex files?
> 
> Using latex and tex is currently very non-intuitive, with things
> like LaTex-mode, TeX-mode.  This mixed capitalisation is all too 
> confusing because ordinary users see only a latex or tex configuration
> for their modes, rather than the nuances of capitalisation changes.

You could do:

M-x find-library RET latex TAB to see what is available

Then go into the library and search for "hook"

Then you position cursor on name of the hook and C-h v or C-h f to describe variable or function.

You need to learn to use help functions within Emacs, you will otherwise never get out of problems.

-- 
Jean Louis



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-01 14:43 ` Jean Louis
@ 2024-12-01 14:58   ` Heime via Users list for the GNU Emacs text editor
  2024-12-01 21:20     ` Heime via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 13+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-01 14:58 UTC (permalink / raw)
  To: Jean Louis; +Cc: Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

On Monday, December 2nd, 2024 at 2:43 AM, Jean Louis <bugs@gnu.support> wrote:

> * Heime via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org [2024-11-30 22:57]:
> 
> > What are the mode hooks for latex and tex files?
> > 
> > Using latex and tex is currently very non-intuitive, with things
> > like LaTex-mode, TeX-mode. This mixed capitalisation is all too
> > confusing because ordinary users see only a latex or tex configuration
> > for their modes, rather than the nuances of capitalisation changes.
> 
> 
> You could do:
> 
> M-x find-library RET latex TAB to see what is available
> 
> Then go into the library and search for "hook"
> 
> Then you position cursor on name of the hook and C-h v or C-h f to describe variable or function.
> 
> You need to learn to use help functions within Emacs, you will otherwise never get out of problems.
> 
> --
> Jean Louis

I do not see how that would be a productive endeavour, going through the libraries to figure 
out what might be going on.  Emacs should have just a standard latex and tex modes.  And other 
libraries should start with the library name as emacs is supposed to require, instead of playing 
around with changes in capitalisation to do different things.  The whole thing becomes confusion 
101.

The design should be not to get others into problems, not about encouraging them to hack around
trying to get out of emacs self-inflicted ones!



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-01 14:58   ` Heime via Users list for the GNU Emacs text editor
@ 2024-12-01 21:20     ` Heime via Users list for the GNU Emacs text editor
  2024-12-02 10:17       ` Jean Louis
  0 siblings, 1 reply; 13+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-01 21:20 UTC (permalink / raw)
  To: Heime; +Cc: Jean Louis, Heime via Users list for the GNU Emacs text editor


On Monday, December 2nd, 2024 at 2:58 AM, Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Sent with Proton Mail secure email.
> 
> On Monday, December 2nd, 2024 at 2:43 AM, Jean Louis bugs@gnu.support wrote:
> 
> > * Heime via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org [2024-11-30 22:57]:
> > 
> > > What are the mode hooks for latex and tex files?
> > > 
> > > Using latex and tex is currently very non-intuitive, with things
> > > like LaTex-mode, TeX-mode. This mixed capitalisation is all too
> > > confusing because ordinary users see only a latex or tex configuration
> > > for their modes, rather than the nuances of capitalisation changes.
> > 
> > You could do:
> > 
> > M-x find-library RET latex TAB to see what is available
> > 
> > Then go into the library and search for "hook"
> > 
> > Then you position cursor on name of the hook and C-h v or C-h f to describe variable or function.
> > 
> > You need to learn to use help functions within Emacs, you will otherwise never get out of problems.
> > 
> > --
> > Jean Louis
> 
> 
> I do not see how that would be a productive endeavour, going through the libraries to figure
> out what might be going on. Emacs should have just a standard latex and tex modes. And other
> libraries should start with the library name as emacs is supposed to require, instead of playing
> around with changes in capitalisation to do different things. The whole thing becomes confusion
> 101.
> 
> The design should be not to get others into problems, not about encouraging them to hack around
> trying to get out of emacs self-inflicted ones!


What are the built-in default modes fol latex and tex?  




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-01 21:20     ` Heime via Users list for the GNU Emacs text editor
@ 2024-12-02 10:17       ` Jean Louis
  0 siblings, 0 replies; 13+ messages in thread
From: Jean Louis @ 2024-12-02 10:17 UTC (permalink / raw)
  To: Heime; +Cc: help-gnu-emacs

* Heime <heimeborgia@protonmail.com> [2024-12-02 00:20]:
> What are the built-in default modes fol latex and tex?  

You are long time on mailing list. First learn how to get into the Emacs Manual.

I use `C-h r' 

Then use search. Search for LaTex or TeX and you will find various
modes.

I think you should use help system of Emacs more for trivial
questions.

-- 
Jean Louis



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-11-30 19:55 Mode hooks for latex and tex files Heime via Users list for the GNU Emacs text editor
  2024-12-01 14:43 ` Jean Louis
@ 2024-12-02 11:13 ` Joel Reicher
  2024-12-02 13:17 ` Arash Esbati
  2 siblings, 0 replies; 13+ messages in thread
From: Joel Reicher @ 2024-12-02 11:13 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor; +Cc: Heime

Heime via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> writes:

> What are the mode hooks for latex and tex files?
>
> Using latex and tex is currently very non-intuitive, with things 
> like LaTex-mode, TeX-mode.  This mixed capitalisation is all too 
> confusing because ordinary users see only a latex or tex 
> configuration for their modes, rather than the nuances of 
> capitalisation changes.

What do you know how to do without Emacs that you do not know how 
to do in Emacs?

Regards,

        - Joel



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-11-30 19:55 Mode hooks for latex and tex files Heime via Users list for the GNU Emacs text editor
  2024-12-01 14:43 ` Jean Louis
  2024-12-02 11:13 ` Joel Reicher
@ 2024-12-02 13:17 ` Arash Esbati
  2024-12-02 15:58   ` Heime via Users list for the GNU Emacs text editor
  2 siblings, 1 reply; 13+ messages in thread
From: Arash Esbati @ 2024-12-02 13:17 UTC (permalink / raw)
  To: help-gnu-emacs

Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:

> What are the mode hooks for latex and tex files?

It depends.

> Using latex and tex is currently very non-intuitive, with things
> like LaTex-mode, TeX-mode.  This mixed capitalisation is all too 
> confusing because ordinary users see only a latex or tex configuration
> for their modes, rather than the nuances of capitalisation changes.

The only point you have to consider is that there are 2 major modes for
editing plain-tex and latex files:

• The modes bundled with Emacs (in tex-mode.el, do
'M-x locate-library RET tex-mode RET') and

• 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.

Best, Arash




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-02 13:17 ` Arash Esbati
@ 2024-12-02 15:58   ` Heime via Users list for the GNU Emacs text editor
  2024-12-02 16:15     ` Heime via Users list for the GNU Emacs text editor
  2024-12-02 20:17     ` Arash Esbati
  0 siblings, 2 replies; 13+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-02 15:58 UTC (permalink / raw)
  To: Arash Esbati; +Cc: help-gnu-emacs


On Tuesday, December 3rd, 2024 at 1:17 AM, Arash Esbati <arash@gnu.org> wrote:

> Heime via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org writes:
>
> > What are the mode hooks for latex and tex files?
>
> It depends.
>
> > Using latex and tex is currently very non-intuitive, with things
> > like LaTex-mode, TeX-mode. This mixed capitalisation is all too
> > confusing because ordinary users see only a latex or tex configuration
> > for their modes, rather than the nuances of capitalisation changes.
>
>
> The only point you have to consider is that there are 2 major modes for
> editing plain-tex and latex files:
>
> • The modes bundled with Emacs (in tex-mode.el, do
> 'M-x locate-library RET tex-mode RET') and
>
> • 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.
>
> Best, Arash

AUCTeX introduces unnecessary complexity by deviating from standard
naming conventions for tool-related modes. 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.

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; other language
tools, such as for C, avoid analogous confusion—there is no equivalent
plain-c-mode.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-02 15:58   ` Heime via Users list for the GNU Emacs text editor
@ 2024-12-02 16:15     ` Heime via Users list for the GNU Emacs text editor
  2024-12-02 20:17     ` Arash Esbati
  1 sibling, 0 replies; 13+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-02 16:15 UTC (permalink / raw)
  To: Arash Esbati; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

On Tuesday, December 3rd, 2024 at 3:58 AM, Heime <heimeborgia@protonmail.com> wrote:

> On Tuesday, December 3rd, 2024 at 1:17 AM, Arash Esbati arash@gnu.org wrote:
> 
> > Heime via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org writes:
> > 
> > > What are the mode hooks for latex and tex files?
> > 
> > It depends.
> > 
> > > Using latex and tex is currently very non-intuitive, with things
> > > like LaTex-mode, TeX-mode. This mixed capitalisation is all too
> > > confusing because ordinary users see only a latex or tex configuration
> > > for their modes, rather than the nuances of capitalisation changes.
> > 
> > The only point you have to consider is that there are 2 major modes for
> > editing plain-tex and latex files:
> > 
> > • The modes bundled with Emacs (in tex-mode.el, do
> > 'M-x locate-library RET tex-mode RET') and
> > 
> > • 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.
> > 
> > Best, Arash
> 
> 
> AUCTeX introduces unnecessary complexity by deviating from standard
> naming conventions for tool-related modes. 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.
> 
> 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; other language
> tools, such as for C, avoid analogous confusion—there is no equivalent
> plain-c-mode.


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 ?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-02 15:58   ` Heime via Users list for the GNU Emacs text editor
  2024-12-02 16:15     ` Heime via Users list for the GNU Emacs text editor
@ 2024-12-02 20:17     ` Arash Esbati
  2024-12-02 20:29       ` Heime via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 13+ messages in thread
From: Arash Esbati @ 2024-12-02 20:17 UTC (permalink / raw)
  To: Heime; +Cc: help-gnu-emacs

Heime <heimeborgia@protonmail.com> writes:

> On Tuesday, December 3rd, 2024 at 1:17 AM, Arash Esbati <arash@gnu.org> wrote:
>
>> The only point you have to consider is that there are 2 major modes for
>> editing plain-tex and latex files:
>>
>> • The modes bundled with Emacs (in tex-mode.el, do
>> 'M-x locate-library RET tex-mode RET') and
>>
>> • 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, ‘-’. 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



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-02 20:17     ` Arash Esbati
@ 2024-12-02 20:29       ` Heime via Users list for the GNU Emacs text editor
  2024-12-02 20:38         ` Arash Esbati
  2024-12-02 20:44         ` Heime via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 13+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-02 20:29 UTC (permalink / raw)
  To: Arash Esbati; +Cc: help-gnu-emacs


On Tuesday, December 3rd, 2024 at 8:17 AM, Arash Esbati <arash@gnu.org> wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> > On Tuesday, December 3rd, 2024 at 1:17 AM, Arash Esbati arash@gnu.org wrote:
> > 
> > > The only point you have to consider is that there are 2 major modes for
> > > editing plain-tex and latex files:
> > > 
> > > • The modes bundled with Emacs (in tex-mode.el, do
> > > 'M-x locate-library RET tex-mode RET') and
> > > 
> > > • 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, ‘-’. 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.

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.  
 
> > 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



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-02 20:29       ` Heime via Users list for the GNU Emacs text editor
@ 2024-12-02 20:38         ` Arash Esbati
  2024-12-02 20:44         ` Heime via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 13+ messages in thread
From: Arash Esbati @ 2024-12-02 20:38 UTC (permalink / raw)
  To: Heime; +Cc: help-gnu-emacs

Heime <heimeborgia@protonmail.com> writes:

> On Tuesday, December 3rd, 2024 at 8:17 AM, Arash Esbati <arash@gnu.org> wrote:
>
>> 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.
>
> 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.  

I don't how often I have to repeat this: tex-mode.el is part of Emacs
and not part of AUCTeX:

  https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/textmodes/tex-mode.el

And AFAICT, it does the job right.

Best, Arash



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Mode hooks for latex and tex files
  2024-12-02 20:29       ` Heime via Users list for the GNU Emacs text editor
  2024-12-02 20:38         ` Arash Esbati
@ 2024-12-02 20:44         ` Heime via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 13+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-02 20:44 UTC (permalink / raw)
  To: Heime; +Cc: Arash Esbati, help-gnu-emacs






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 <help-gnu-emacs@gnu.org> wrote:

> On Tuesday, December 3rd, 2024 at 8:17 AM, Arash Esbati arash@gnu.org wrote:
> 
> > Heime heimeborgia@protonmail.com writes:
> > 
> > > On Tuesday, December 3rd, 2024 at 1:17 AM, Arash Esbati arash@gnu.org wrote:
> > > 
> > > > The only point you have to consider is that there are 2 major modes for
> > > > editing plain-tex and latex files:
> > > > 
> > > > • The modes bundled with Emacs (in tex-mode.el, do
> > > > 'M-x locate-library RET tex-mode RET') and
> > > > 
> > > > • 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, ‘-’. 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.
> 
> 
> 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.
> 
> > > 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?

I missed the last hook part.  Thanks.
 
> > Best, Arash
> > 
> > Footnotes:
> > [1] https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Coding-Conventions



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-12-02 20:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-30 19:55 Mode hooks for latex and tex files Heime via Users list for the GNU Emacs text editor
2024-12-01 14:43 ` Jean Louis
2024-12-01 14:58   ` Heime via Users list for the GNU Emacs text editor
2024-12-01 21:20     ` Heime via Users list for the GNU Emacs text editor
2024-12-02 10:17       ` Jean Louis
2024-12-02 11:13 ` Joel Reicher
2024-12-02 13:17 ` Arash Esbati
2024-12-02 15:58   ` Heime via Users list for the GNU Emacs text editor
2024-12-02 16:15     ` Heime via Users list for the GNU Emacs text editor
2024-12-02 20:17     ` Arash Esbati
2024-12-02 20:29       ` Heime via Users list for the GNU Emacs text editor
2024-12-02 20:38         ` Arash Esbati
2024-12-02 20:44         ` Heime via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).