all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* latex-mode hook?
@ 2014-09-07  7:43 Sharon Kimble
  2014-09-07  7:49 ` Teemu Likonen
       [not found] ` <mailman.8384.1410076210.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 29+ messages in thread
From: Sharon Kimble @ 2014-09-07  7:43 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

I'm writing a lot of latex at the moment and have tried to get the Imenu
automatically working there, just like in org-mode it works.

--8<---------------cut here---------------start------------->8---
(add-hook 'org-mode-hook
(lambda () (imenu-add-to-menubar "Imenu")))
(setq org-imenu-depth 6)

(add-hook 'latex-mode-hook
(lambda () (imenu-add-to-menubar "Imenu")))
(setq latex-imenu-depth 6)
--8<---------------cut here---------------end--------------->8---

The org-mode hook works but the latex-mode one does not. How then can I
get the latex one working please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.3.93.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: latex-mode hook?
  2014-09-07  7:43 latex-mode hook? Sharon Kimble
@ 2014-09-07  7:49 ` Teemu Likonen
  2014-09-07 13:22   ` Sharon Kimble
       [not found] ` <mailman.8384.1410076210.1147.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 29+ messages in thread
From: Teemu Likonen @ 2014-09-07  7:49 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

Sharon Kimble [2014-09-07 08:43:25 +01:00] wrote:

> I'm writing a lot of latex at the moment and have tried to get the
> Imenu automatically working there, just like in org-mode it works.

> The org-mode hook works but the latex-mode one does not. How then can
> I get the latex one working please?

Probably you need to use LaTeX-mode-hook variable instead. It's
different from latex-mode-hook (note the letter case difference).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: latex-mode hook?
  2014-09-07  7:49 ` Teemu Likonen
@ 2014-09-07 13:22   ` Sharon Kimble
  0 siblings, 0 replies; 29+ messages in thread
From: Sharon Kimble @ 2014-09-07 13:22 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 734 bytes --]

Teemu Likonen <tlikonen@iki.fi> writes:

> Sharon Kimble [2014-09-07 08:43:25 +01:00] wrote:
>
>> I'm writing a lot of latex at the moment and have tried to get the
>> Imenu automatically working there, just like in org-mode it works.
>
>> The org-mode hook works but the latex-mode one does not. How then can
>> I get the latex one working please?
>
> Probably you need to use LaTeX-mode-hook variable instead. It's
> different from latex-mode-hook (note the letter case difference).

Brilliant, thanks. That's sorted it!

Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.3.93.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: latex-mode hook?
       [not found] ` <mailman.8384.1410076210.1147.help-gnu-emacs@gnu.org>
@ 2014-09-07 18:49   ` Emanuel Berg
  2014-09-08  9:10     ` Marcin Borkowski
       [not found]     ` <mailman.8444.1410167430.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 29+ messages in thread
From: Emanuel Berg @ 2014-09-07 18:49 UTC (permalink / raw)
  To: help-gnu-emacs

Teemu Likonen <tlikonen@iki.fi> writes:

> Probably you need to use LaTeX-mode-hook variable
> instead. It's different from latex-mode-hook (note
> the letter case difference).

Indeed, but how so? And why?

I always used the latex-mode-hook and it works for the
major mode that I use for LaTeX, logically named
LaTeX-mode:

    LaTeX mode defined in `tex-mode.el':
    Major mode for editing files of input for LaTeX.

I know there are other modes for LaTeX, most notably
AUCTeX that seems to be more popular than latex-mode.
(To me it is not really an issue since all I need is
syntax highlighting, basically, as well as the mode
itself so I can setup certain options and a couple of
dufuns.)

Is AUCTeX what Kimble is using? If not, what? And, why
is that called something that can be confused
(apparently) with the latex-mode stuff?

Case-sensitiveness is a good thing but it doesn't mean
it makes sense to have one "ls" command and one "LS"
command and one "lS" and one "Ls".

This is what I wrote in the LaTeX/BibTeX business. I
wouldn't be surprised if some of that stuff is in
AUCTeX or even in latex-mode:

http://user.it.uu.se/~embe8573/conf/emacs-init/latex.el

-- 
underground experts united


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

* Re: latex-mode hook?
  2014-09-07 18:49   ` Emanuel Berg
@ 2014-09-08  9:10     ` Marcin Borkowski
  2014-09-08 10:30       ` Thorsten Jolitz
       [not found]       ` <mailman.8449.1410172233.1147.help-gnu-emacs@gnu.org>
       [not found]     ` <mailman.8444.1410167430.1147.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 29+ messages in thread
From: Marcin Borkowski @ 2014-09-08  9:10 UTC (permalink / raw)
  To: help-gnu-emacs

Dnia 2014-09-07, o godz. 20:49:27
Emanuel Berg <embe8573@student.uu.se> napisał(a):

> Teemu Likonen <tlikonen@iki.fi> writes:
> 
> > Probably you need to use LaTeX-mode-hook variable
> > instead. It's different from latex-mode-hook (note
> > the letter case difference).
> 
> Indeed, but how so? And why?
> 
> I always used the latex-mode-hook and it works for the
> major mode that I use for LaTeX, logically named
> LaTeX-mode:
> 
>     LaTeX mode defined in `tex-mode.el':
>     Major mode for editing files of input for LaTeX.
> 
> I know there are other modes for LaTeX, most notably
> AUCTeX that seems to be more popular than latex-mode.
> (To me it is not really an issue since all I need is
> syntax highlighting, basically, as well as the mode
> itself so I can setup certain options and a couple of
> dufuns.)
> 
> Is AUCTeX what Kimble is using? If not, what? And, why
> is that called something that can be confused
> (apparently) with the latex-mode stuff?

AFAIK, latex-mode is the built-in, very limited LaTeX mode, and
LaTeX-mode is the AUCTeX's one (which is much, much better - think
autocompletion, for instance).  Also the texmathp function.  And
parsing of \usepackage[...]{inputenc}.  And more.

> Case-sensitiveness is a good thing but it doesn't mean
> it makes sense to have one "ls" command and one "LS"
> command and one "lS" and one "Ls".

I guess AUCTeX might call latex-mode-hook, too.

Best

PS. Also, don't use \em, \bf & friends.  They are evil.  See e.g.
http://tex.stackexchange.com/questions/25911/what-is-the-difference-between-em-and-emph
and
http://tex.stackexchange.com/questions/11199/why-different-commands-for-seemingly-similar-tasks

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



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

* Re: latex-mode hook?
  2014-09-08  9:10     ` Marcin Borkowski
@ 2014-09-08 10:30       ` Thorsten Jolitz
       [not found]       ` <mailman.8449.1410172233.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 29+ messages in thread
From: Thorsten Jolitz @ 2014-09-08 10:30 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:

> AFAIK, latex-mode is the built-in, very limited LaTeX mode, and
> LaTeX-mode is the AUCTeX's one (which is much, much better - think
> autocompletion, for instance).  Also the texmathp function.  And
> parsing of \usepackage[...]{inputenc}.  And more.

A bit confusing is that I have AUCTEX installed and see LaTeX/P in the
mode line, but

,----
| M-: major-mode
`----

returns 'latex-mode', not 'LaTeX-mode'. 

-- 
cheers,
Thorsten




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

* Re: latex-mode hook?
       [not found]       ` <mailman.8449.1410172233.1147.help-gnu-emacs@gnu.org>
@ 2014-09-08 11:46         ` Sebastien Vauban
  2014-09-08 12:55           ` Rusi
  2014-09-09  9:17           ` Sebastien Vauban
  2014-09-08 21:57         ` Emanuel Berg
  1 sibling, 2 replies; 29+ messages in thread
From: Sebastien Vauban @ 2014-09-08 11:46 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Thorsten Jolitz wrote:
> Marcin Borkowski <mbork-12VZH/wba7B4rM3dGMyr8Q@public.gmane.org> writes:
>
>> AFAIK, latex-mode is the built-in, very limited LaTeX mode, and
>> LaTeX-mode is the AUCTeX's one (which is much, much better - think
>> autocompletion, for instance).  Also the texmathp function.  And
>> parsing of \usepackage[...]{inputenc}.  And more.
>
> A bit confusing is that I have AUCTEX installed and see LaTeX/P in the
> mode line, but
>
> ,----
> | M-: major-mode
> `----
>
> returns 'latex-mode', not 'LaTeX-mode'. 

IIRC, AUCTeX aliases latex-mode to LaTeX-mode. This can explain that.

Best regards,
  Seb

-- 
Sebastien Vauban


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

* Re: latex-mode hook?
  2014-09-08 11:46         ` Sebastien Vauban
@ 2014-09-08 12:55           ` Rusi
  2014-09-08 22:02             ` Emanuel Berg
  2014-09-09  9:17           ` Sebastien Vauban
  1 sibling, 1 reply; 29+ messages in thread
From: Rusi @ 2014-09-08 12:55 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, September 8, 2014 5:16:40 PM UTC+5:30, Sebastien Vauban wrote:
> Thorsten Jolitz wrote:
> > Marcin Borkowski  writes:
> >> AFAIK, latex-mode is the built-in, very limited LaTeX mode, and
> >> LaTeX-mode is the AUCTeX's one (which is much, much better - think
> >> autocompletion, for instance).  Also the texmathp function.  And
> >> parsing of \usepackage[...]{inputenc}.  And more.
> > A bit confusing is that I have AUCTEX installed and see LaTeX/P in the
> > mode line, but
> > ,----
> > | M-: major-mode
> > `----
> > returns 'latex-mode', not 'LaTeX-mode'. 

> IIRC, AUCTeX aliases latex-mode to LaTeX-mode. This can explain that.

Wasn't there a UN resolution, along with class, color, caste distinctions
also one against case-sensitive distinctions?


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

* Re: latex-mode hook?
       [not found]     ` <mailman.8444.1410167430.1147.help-gnu-emacs@gnu.org>
@ 2014-09-08 21:54       ` Emanuel Berg
  2014-09-09  7:51         ` Marcin Borkowski
       [not found]         ` <mailman.8504.1410249128.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 29+ messages in thread
From: Emanuel Berg @ 2014-09-08 21:54 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:

> AFAIK, latex-mode is the built-in, very limited LaTeX

It always worked for me so I don't think it is that
limited. It has indentation, font lock, and, as
mentioned it is a mode so you can add stuff to it. I
have done some stuff in LaTeX that I consider very
creative, so perhaps the limitation stayed with the
mode, it didn't got to the user :)

> and LaTeX-mode is the AUCTeX's one

It would make for less confusion if they didn't call it
the same. auctex-latex-mode, perhaps. On the other hand
perhaps it was deemed the latex-mode was indeed limited
as you say and they wanted to make a push for AUCTeX.
On the third hand (or first foot), if auctex is a
thrid-party package, perhaps not much coordination was
put into this detail... (hm)

I don't have AUCTeX, but there is a package in the
Debian repos, auctex:

    AUCTeX is a comprehensive customizable integrated
    environment for writing input files for
    TeX/LaTeX/ConTeXt/Texinfo using GNU Emacs.

> (which is much, much better think autocompletion

I
I think
I think not

> Also the texmathp function.
> And parsing of \usepackage[...]{inputenc}. And more.

What are those?

> PS. Also, don't use \em, \bf & friends. They are
> evil. See e.g. ...

So people say but they always worked for me and I like
the syntax more. I'll read those URLs when I run out of
real problems. That should happen pretty soon... (?)
No, seriously, if I ever do an ambitious project like
that again, I'll change to the modern versions.

-- 
underground experts united


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

* Re: latex-mode hook?
       [not found]       ` <mailman.8449.1410172233.1147.help-gnu-emacs@gnu.org>
  2014-09-08 11:46         ` Sebastien Vauban
@ 2014-09-08 21:57         ` Emanuel Berg
  2014-09-09  0:49           ` Thorsten Jolitz
                             ` (2 more replies)
  1 sibling, 3 replies; 29+ messages in thread
From: Emanuel Berg @ 2014-09-08 21:57 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:

> A bit confusing is that I have AUCTEX installed and
> see LaTeX/P in the mode line, but
>
> ,---- | M-: major-mode `----
>
> returns 'latex-mode', not 'LaTeX-mode'.

Yeah, this is what I'm saying, you can never rely on
case sensitivity in a "case" like this: to describe two
distinct things, that nevertheless serve the same
purpose and do a lot of virtually identical things.
This will make for confusion time and again, for sure.

-- 
underground experts united


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

* Re: latex-mode hook?
  2014-09-08 12:55           ` Rusi
@ 2014-09-08 22:02             ` Emanuel Berg
  0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2014-09-08 22:02 UTC (permalink / raw)
  To: help-gnu-emacs

Rusi <rustompmody@gmail.com> writes:

> Wasn't there a UN resolution, along with class,
> color, caste distinctions also one against
> case-sensitive distinctions?

Actually, the techno-UN has been panicking ever since
some deadlocked zombies started trashing the
assembly...

-- 
underground experts united


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

* Re: latex-mode hook?
  2014-09-08 21:57         ` Emanuel Berg
@ 2014-09-09  0:49           ` Thorsten Jolitz
       [not found]           ` <mailman.8489.1410223819.1147.help-gnu-emacs@gnu.org>
  2014-09-09 12:34           ` Stefan Monnier
  2 siblings, 0 replies; 29+ messages in thread
From: Thorsten Jolitz @ 2014-09-09  0:49 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> A bit confusing is that I have AUCTEX installed and
>> see LaTeX/P in the mode line, but
>>
>> ,---- | M-: major-mode `----
>>
>> returns 'latex-mode', not 'LaTeX-mode'.
>
> Yeah, this is what I'm saying, you can never rely on
> case sensitivity in a "case" like this: to describe two
> distinct things, that nevertheless serve the same
> purpose and do a lot of virtually identical things.
> This will make for confusion time and again, for sure.

So - which mode am I running?
I assume LaTeX-mode, but how to find out without doubt?

-- 
cheers,
Thorsten




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

* Re: latex-mode hook?
       [not found]           ` <mailman.8489.1410223819.1147.help-gnu-emacs@gnu.org>
@ 2014-09-09  1:09             ` Emanuel Berg
  2014-09-09  6:54               ` Thorsten Jolitz
  0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg @ 2014-09-09  1:09 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:

>> Yeah, this is what I'm saying, you can never rely on
>> case sensitivity in a "case" like this: to describe
>> two distinct things, that nevertheless serve the
>> same purpose and do a lot of virtually identical
>> things. This will make for confusion time and again,
>> for sure.
>
> So - which mode am I running? I assume LaTeX-mode, but
> how to find out without doubt?

It looks like you are running latex-mode, i.e., not the
AUCTeX mode.

In my mode line, it says "LaTeX" for the latex-mode.
The reason I know is as simple as brilliant: I don't
have AUCTeX installed.

Here is what it says on `C-h m'. 

    LaTeX mode defined in `tex-mode.el':
    Major mode for editing files of input for LaTeX.

If it is the same for you, I think it is safe to say
you run latex-mode as well. If not, you run AUCTeX
mode. Unless they aliased this as well...

-- 
underground experts united


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

* Re: latex-mode hook?
  2014-09-09  1:09             ` Emanuel Berg
@ 2014-09-09  6:54               ` Thorsten Jolitz
  0 siblings, 0 replies; 29+ messages in thread
From: Thorsten Jolitz @ 2014-09-09  6:54 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>>> Yeah, this is what I'm saying, you can never rely on
>>> case sensitivity in a "case" like this: to describe
>>> two distinct things, that nevertheless serve the
>>> same purpose and do a lot of virtually identical
>>> things. This will make for confusion time and again,
>>> for sure.
>>
>> So - which mode am I running? I assume LaTeX-mode, but
>> how to find out without doubt?
>
> It looks like you are running latex-mode, i.e., not the
> AUCTeX mode.
>
> In my mode line, it says "LaTeX" for the latex-mode.
> The reason I know is as simple as brilliant: I don't
> have AUCTeX installed.
>
> Here is what it says on `C-h m'. 

ups, should have been the obvious thing to do

>     LaTeX mode defined in `tex-mode.el':
>     Major mode for editing files of input for LaTeX.
>
> If it is the same for you, I think it is safe to say
> you run latex-mode as well. If not, you run AUCTeX
> mode. Unless they aliased this as well...

Luckily C-h m gives me:

,----
| LaTeX/P mode defined in `tex-site.el':
| Major mode in AUCTeX for editing LaTeX files.
| See info under AUCTeX for full documentation.
`----

so I did not think "AUCTeX is great" all these years without actually
using it ;) 

-- 
cheers,
Thorsten




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

* Re: latex-mode hook?
  2014-09-08 21:54       ` Emanuel Berg
@ 2014-09-09  7:51         ` Marcin Borkowski
  2014-09-09 12:06           ` Stefan Monnier
       [not found]         ` <mailman.8504.1410249128.1147.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 29+ messages in thread
From: Marcin Borkowski @ 2014-09-09  7:51 UTC (permalink / raw)
  To: help-gnu-emacs

Dnia 2014-09-08, o godz. 23:54:35
Emanuel Berg <embe8573@student.uu.se> napisał(a):

> Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
> 
> > and LaTeX-mode is the AUCTeX's one
> > (which is much, much better think autocompletion
> 
> I
> I think
> I think not

C-c C-e enum TAB RET

and you get

\begin{enumerate}
  (point)
\end{enumerate}

How is that not a win?  And it even understands your \newcommand and
\newenvironment invocations.

> > Also the texmathp function.
> > And parsing of \usepackage[...]{inputenc}. And more.
> 
> What are those?

texmathp (as the name implies?) returns t if the point is in math mode
and nil otherwise.  It knows about $...$, \(...\), \[...\],
\begin{equation} ... \end{equation}, it handles $...$ inside
\text{...} inside \[...\] etc. correctly...  See here:
http://mbork.pl/?search=texmathp for two possible applications.

In AUCTeX, if I have \usepackage[cp1250]{inputenc} near the beginning,
the buffer is automatically put in the respective encoding.  It's not
a big deal in English-speaking countries, I guess, but here in Poland,
where Windoze uses CP-1250, old Linux files use ISO-8859-2 and
everyone else uses UTF-8, it's /very/ convenient.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



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

* Re: latex-mode hook?
  2014-09-08 11:46         ` Sebastien Vauban
  2014-09-08 12:55           ` Rusi
@ 2014-09-09  9:17           ` Sebastien Vauban
  2014-09-09  9:34             ` Thorsten Jolitz
  1 sibling, 1 reply; 29+ messages in thread
From: Sebastien Vauban @ 2014-09-09  9:17 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Sebastien Vauban wrote:
> Thorsten Jolitz wrote:
>> Marcin Borkowski <mbork-12VZH/wba7B4rM3dGMyr8Q@public.gmane.org> writes:
>>
>>> AFAIK, latex-mode is the built-in, very limited LaTeX mode, and
>>> LaTeX-mode is the AUCTeX's one (which is much, much better - think
>>> autocompletion, for instance).  Also the texmathp function.  And
>>> parsing of \usepackage[...]{inputenc}.  And more.
>>
>> A bit confusing is that I have AUCTEX installed and see LaTeX/P in the
>> mode line, but
>>
>> ,----
>> | M-: major-mode
>> `----
>>
>> returns 'latex-mode', not 'LaTeX-mode'. 
>
> IIRC, AUCTeX aliases latex-mode to LaTeX-mode. This can explain that.

BTW, I *never* understood why AUCTeX mode isn't simply called "AUCTeX"
in the mode line and so forth: using the case-sensitivity to distinguish
between both versions of LaTeX support (the default one, and the AUCTeX
one) is clearly asking for trouble.

Best regards,
  Seb

-- 
Sebastien Vauban


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

* Re: latex-mode hook?
  2014-09-09  9:17           ` Sebastien Vauban
@ 2014-09-09  9:34             ` Thorsten Jolitz
  2014-09-09 12:39               ` Stefan Monnier
  0 siblings, 1 reply; 29+ messages in thread
From: Thorsten Jolitz @ 2014-09-09  9:34 UTC (permalink / raw)
  To: help-gnu-emacs

Sebastien Vauban <sva-news@mygooglest.com>
writes:

> Sebastien Vauban wrote:
>> Thorsten Jolitz wrote:
>>> Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
>>>
>>>> AFAIK, latex-mode is the built-in, very limited LaTeX mode, and
>>>> LaTeX-mode is the AUCTeX's one (which is much, much better - think
>>>> autocompletion, for instance).  Also the texmathp function.  And
>>>> parsing of \usepackage[...]{inputenc}.  And more.
>>>
>>> A bit confusing is that I have AUCTEX installed and see LaTeX/P in the
>>> mode line, but
>>>
>>> ,----
>>> | M-: major-mode
>>> `----
>>>
>>> returns 'latex-mode', not 'LaTeX-mode'. 
>>
>> IIRC, AUCTeX aliases latex-mode to LaTeX-mode. This can explain that.
>
> BTW, I *never* understood why AUCTeX mode isn't simply called "AUCTeX"
> in the mode line and so forth: using the case-sensitivity to distinguish
> between both versions of LaTeX support (the default one, and the AUCTeX
> one) is clearly asking for trouble.

Reminds me of the major-mode issue with ESS (ess-mode vs R-mode). In
outorg.el I always had to deal with R as a special case because (funcall
major-mode) wouldn't work as expected. Its due to 'historical reasons' I
would say, suboptimal decisions in a projects early stage that are hard
to change later on.

-- 
cheers,
Thorsten




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

* Re: latex-mode hook?
  2014-09-09  7:51         ` Marcin Borkowski
@ 2014-09-09 12:06           ` Stefan Monnier
  2014-09-09 12:36             ` Tassilo Horn
  2014-09-09 13:14             ` Thorsten Jolitz
  0 siblings, 2 replies; 29+ messages in thread
From: Stefan Monnier @ 2014-09-09 12:06 UTC (permalink / raw)
  To: help-gnu-emacs

> C-c C-e enum TAB RET

In plain latex-mode, it's C-c C-o enum TAB RET

> and you get

> \begin{enumerate}
>   (point)
> \end{enumerate}

And if you enable latex-electric-env-pair-mode, you can edit one of the
`enumerate' and the other one is kept in sync on the fly.

> How is that not a win?  And it even understands your \newcommand and
> \newenvironment invocations.

And that's the crucial difference between AUCTeX and plain latex-mode:
plain latex-mode does not even attempt to keep track of which packages
you use and which commands you define.

> In AUCTeX, if I have \usepackage[cp1250]{inputenc} near the beginning,
> the buffer is automatically put in the respective encoding.

This is also the case in plain latex-mode.  The two packages may differ
when it comes to the encoding used for the non-main files of
a multi-file LaTeX document, tho.


        Stefan




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

* Re: latex-mode hook?
  2014-09-08 21:57         ` Emanuel Berg
  2014-09-09  0:49           ` Thorsten Jolitz
       [not found]           ` <mailman.8489.1410223819.1147.help-gnu-emacs@gnu.org>
@ 2014-09-09 12:34           ` Stefan Monnier
  2 siblings, 0 replies; 29+ messages in thread
From: Stefan Monnier @ 2014-09-09 12:34 UTC (permalink / raw)
  To: help-gnu-emacs

>> A bit confusing is that I have AUCTEX installed and
>> see LaTeX/P in the mode line, but
>>
>> ,---- | M-: major-mode `----
>>
>> returns 'latex-mode', not 'LaTeX-mode'.

Yes, it's confusing.  AFAIK the real name of the mode is
`TeX-latex-mode', but that major mode sets `major-mode' to `latex-mode'.

And rather than running TeX-latex-mode-hook or latex-mode-hook, it runs
LaTeX-mode-hook (and TeX-mode-hook).

This is not the brightest aspect of AUCTeX, admittedly.


        Stefan




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

* Re: latex-mode hook?
  2014-09-09 12:06           ` Stefan Monnier
@ 2014-09-09 12:36             ` Tassilo Horn
  2014-09-09 13:21               ` Stefan Monnier
  2014-09-09 13:14             ` Thorsten Jolitz
  1 sibling, 1 reply; 29+ messages in thread
From: Tassilo Horn @ 2014-09-09 12:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> and you get
>
>> \begin{enumerate}
>>   (point)
>> \end{enumerate}
>
> And if you enable latex-electric-env-pair-mode, you can edit one of
> the `enumerate' and the other one is kept in sync on the fly.

In AUCTeX, you can change the surrounding environment with C-u C-c C-e.

Bye,
Tassilo



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

* Re: latex-mode hook?
  2014-09-09  9:34             ` Thorsten Jolitz
@ 2014-09-09 12:39               ` Stefan Monnier
  0 siblings, 0 replies; 29+ messages in thread
From: Stefan Monnier @ 2014-09-09 12:39 UTC (permalink / raw)
  To: help-gnu-emacs

> In outorg.el I always had to deal with R as a special case because
> (funcall major-mode) wouldn't work as expected.

FWIW, I'd consider it as a plain bug.

AUCTeX has half of the same bug: by default, AUCTeX overrides latex-mode
to call TeX-latex-mode, so in the default config it's correct to set
major-mode to `latex-mode'.  But of course, if you configure `TeX-modes'
so as not to override latex-mode, then AUCTeX has that same bug.


        Stefan




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

* Re: latex-mode hook?
  2014-09-09 12:06           ` Stefan Monnier
  2014-09-09 12:36             ` Tassilo Horn
@ 2014-09-09 13:14             ` Thorsten Jolitz
  1 sibling, 0 replies; 29+ messages in thread
From: Thorsten Jolitz @ 2014-09-09 13:14 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> This is also the case in plain latex-mode.  The two packages may differ
> when it comes to the encoding used for the non-main files of
> a multi-file LaTeX document, tho.

I recently discovered that well documented expl3, xparse and xstring
packages (i.e. coming latex3) turn the 'write-only tool for creating
incredibly messy .sty files' (called latex2) into a kind of real
programming language allowing to produce readable and structured  code.

But AUCTeX (LaTeX-mode) does not seem to support these libraries
yet. Are there plans to add latex 3 support in the future?

-- 
cheers,
Thorsten




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

* Re: latex-mode hook?
  2014-09-09 12:36             ` Tassilo Horn
@ 2014-09-09 13:21               ` Stefan Monnier
  2014-09-09 13:39                 ` Marcin Borkowski
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Monnier @ 2014-09-09 13:21 UTC (permalink / raw)
  To: help-gnu-emacs

>> And if you enable latex-electric-env-pair-mode, you can edit one of
>> the `enumerate' and the other one is kept in sync on the fly.
> In AUCTeX, you can change the surrounding environment with C-u C-c C-e.

latex-electric-env-pair-mode lets you do that without having to remember
any new key binding ;-)
And of course completion-at-point lets you complete.


        Stefan




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

* Re: latex-mode hook?
  2014-09-09 13:21               ` Stefan Monnier
@ 2014-09-09 13:39                 ` Marcin Borkowski
  2014-09-09 14:13                   ` Stefan Monnier
  0 siblings, 1 reply; 29+ messages in thread
From: Marcin Borkowski @ 2014-09-09 13:39 UTC (permalink / raw)
  To: help-gnu-emacs

Dnia 2014-09-09, o godz. 09:21:37
Stefan Monnier <monnier@iro.umontreal.ca> napisał(a):

> >> And if you enable latex-electric-env-pair-mode, you can edit one of
> >> the `enumerate' and the other one is kept in sync on the fly.
> > In AUCTeX, you can change the surrounding environment with C-u C-c
> > C-e.
> 
> latex-electric-env-pair-mode lets you do that without having to
> remember any new key binding ;-)

Not the same: C-u C-c C-e works from anywhere *inside* the environment
(you don't need to move point).  *Very* handy, I use it all the time.
(Also, C-c C-f and C-u C-c C-f.)

>         Stefan

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



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

* Re: latex-mode hook?
  2014-09-09 13:39                 ` Marcin Borkowski
@ 2014-09-09 14:13                   ` Stefan Monnier
  2014-09-09 17:00                     ` Marcin Borkowski
  0 siblings, 1 reply; 29+ messages in thread
From: Stefan Monnier @ 2014-09-09 14:13 UTC (permalink / raw)
  To: help-gnu-emacs

> Not the same: C-u C-c C-e works from anywhere *inside* the environment
> (you don't need to move point).  *Very* handy, I use it all the time.
> (Also, C-c C-f and C-u C-c C-f.)

FWIW, there shouldn't be any need to choose.  AUCTeX's latex-mode should
really inherit latex-electric-env-pair-mode from the plain latex-mode
that's bundled with your Emacs.


        Stefan




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

* Re: latex-mode hook?
  2014-09-09 14:13                   ` Stefan Monnier
@ 2014-09-09 17:00                     ` Marcin Borkowski
  2014-09-09 17:24                       ` Stefan Monnier
       [not found]                       ` <mailman.8551.1410283491.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 29+ messages in thread
From: Marcin Borkowski @ 2014-09-09 17:00 UTC (permalink / raw)
  To: help-gnu-emacs

Dnia 2014-09-09, o godz. 10:13:07
Stefan Monnier <monnier@iro.umontreal.ca> napisał(a):

> > Not the same: C-u C-c C-e works from anywhere *inside* the
> > environment (you don't need to move point).  *Very* handy, I use it
> > all the time. (Also, C-c C-f and C-u C-c C-f.)
> 
> FWIW, there shouldn't be any need to choose.  AUCTeX's latex-mode
> should really inherit latex-electric-env-pair-mode from the plain
> latex-mode that's bundled with your Emacs.

True.  Although it's hard to deny that the added value of AUCTeX (as
opposed to vanilla Emacs latex-mode) is considerable.  Consider also,
say, C-c C-r, autocompletion of label/ref labels, folding...

(Disclaimer: I am not involved in AUCTeX development in any way.)

>         Stefan


-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



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

* Re: latex-mode hook?
  2014-09-09 17:00                     ` Marcin Borkowski
@ 2014-09-09 17:24                       ` Stefan Monnier
       [not found]                       ` <mailman.8551.1410283491.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 29+ messages in thread
From: Stefan Monnier @ 2014-09-09 17:24 UTC (permalink / raw)
  To: help-gnu-emacs

> True.  Although it's hard to deny that the added value of AUCTeX (as
> opposed to vanilla Emacs latex-mode) is considerable.

I definitely do not want to make it sound like AUCTeX brings nothing to
the table.  I just want to point out that the bundled latex-mode is
a good bit more than just a renamed text-mode.  Some features (e.g.
super/sub-script font-locking) were introduced in plain latex-mode
*before* making their way into AUCTeX.

FWIW, I use plain latex-mode rather than AUCTeX (originally, the purpose
was to "dogfood" it, since it seemed at that time that AUCTeX would
never be able to be anywhere near "builtin".  Nowadays AUCTeX could
actually be built-in (thanks to many people's efforts to collect the
corresponding copyright paperworks), and its availability in GNU ELPA
makes it already very close to built-in, so that's not a good reason any
more, but I just keep using plain latex-mode, because I like its C-c C-c
better).

> Consider also, say, C-c C-r, autocompletion of label/ref labels,

Completion of references should work in plain latex-mode as well
(assuming you enable reftex-mode, which is built-int).

> folding...

Plain latex-mode has outline-minor-mode support.  I don't know how that
compares to AUCTeX's folding support.

> (Disclaimer: I am not involved in AUCTeX development in any way.)

Disclaimer: I'm the primary contributor to plain latex-mode.


        Stefan




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

* Re: latex-mode hook?
       [not found]         ` <mailman.8504.1410249128.1147.help-gnu-emacs@gnu.org>
@ 2014-09-09 19:35           ` Emanuel Berg
  0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2014-09-09 19:35 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:

>>> and LaTeX-mode is the AUCTeX's one > (which is
>>> much, much better think autocompletion
>>  I I think I think not
>
> C-c C-e enum TAB RET
>
> and you get
>
> \begin{enumerate} (point) \end{enumerate}

OK, well, that is more of a snippet expansion feature
than autocompletion to my mind. With autocompletion I
mean, say that you want to search for "injury" - when
you type "inj" "injustice" appears. I can be even worse
with a whole list of suggestions (I take it based on a
word list and/or user behavior/probability theory).
That's just disruptive to me - I know what I want to
type, so let me just type it with no visual noise or
"injustices" ever entering my brain.

> How is that not a win? And it even understands your
> \newcommand and \newenvironment invocations.

No, I can see the benefit of that if you are a LaTeX
professional or do it often. In my case it wouldn't be
such a gain because I seldom use LaTeX and when I do it
is for big, "slow" projects. I don't mind taking the
extra time thinking and typing. For a shell language
like Perl or zsh or Python perhaps something like that
would appeal to me, I don't know. (I'm very fond of
typing.)

> texmathp (as the name implies?) returns t if the
> point is in math mode and nil otherwise. It knows
> about $...$, \(...\), \[...\], \begin{equation} ...
> \end{equation}, it handles $...$ inside \text{...}
> inside \[...\] etc. correctly... See here:
> http://mbork.pl/?search=texmathp for two possible
> applications.
>
> In AUCTeX, if I have \usepackage[cp1250]{inputenc}
> near the beginning, the buffer is automatically put
> in the respective encoding. It's not a big deal in
> English-speaking countries, I guess, but here in
> Poland, where Windoze uses CP-1250, old Linux files
> use ISO-8859-2 and everyone else uses UTF-8, it's
> /very/ convenient.

It is a bit difficult following those scenarios to me
but that sounds useful, yes.

-- 
underground experts united


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

* Re: latex-mode hook?
       [not found]                       ` <mailman.8551.1410283491.1147.help-gnu-emacs@gnu.org>
@ 2014-09-09 19:51                         ` Emanuel Berg
  0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2014-09-09 19:51 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> (Disclaimer: I am not involved in AUCTeX development
>> in any way.)
>
> Disclaimer: I'm the primary contributor to plain
> latex-mode.

:)

I have used that a lot so thank you for that.

The only thing I don't like is the filling that I have
already mentioned that fills between short { ... }
where it would make more sense (to me) to move the
whole thing down a line.

This could be a "best effort"-feature: on the first
M-q, it is filled so to keep together the { ... } if
possible. If there is a second M-q with no point
movement in between, it could fall back to ordinary
filling (as then the user didn't like the first
outcome).

And the .pdf/source-search disparity I already
mentioned. It is common for students to submit a PDF. I
always encourage them to include the LaTeX source, so
the teacher can quote the source rather than writing
illegible little bows and arrows on the printed PDF -
much like how we quote here on Usenet, in fact.
Unfortunately, many (most) teachers aren't that sharp
(at least not in that respect), so the students have to
work not directly on the source to make the
improvements/adjustments, they have to keep one eye on
the printed PDF, and then track the places in the
LaTeX. This is very tedious work compared to the
solution I propose, and for a 30+ pages report with
dozens of fixes and comments on each page it is one of
the least inspiring forms of computer work I can think
of. I don't know if the "hide markup" and/or search
function I describe can help a lot - probably not - but
perhaps alleviate the pain a bit.

Well, there you have a couple of suggestions to
contemplate if you get restless (unless they are
already there).

-- 
underground experts united


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

end of thread, other threads:[~2014-09-09 19:51 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-07  7:43 latex-mode hook? Sharon Kimble
2014-09-07  7:49 ` Teemu Likonen
2014-09-07 13:22   ` Sharon Kimble
     [not found] ` <mailman.8384.1410076210.1147.help-gnu-emacs@gnu.org>
2014-09-07 18:49   ` Emanuel Berg
2014-09-08  9:10     ` Marcin Borkowski
2014-09-08 10:30       ` Thorsten Jolitz
     [not found]       ` <mailman.8449.1410172233.1147.help-gnu-emacs@gnu.org>
2014-09-08 11:46         ` Sebastien Vauban
2014-09-08 12:55           ` Rusi
2014-09-08 22:02             ` Emanuel Berg
2014-09-09  9:17           ` Sebastien Vauban
2014-09-09  9:34             ` Thorsten Jolitz
2014-09-09 12:39               ` Stefan Monnier
2014-09-08 21:57         ` Emanuel Berg
2014-09-09  0:49           ` Thorsten Jolitz
     [not found]           ` <mailman.8489.1410223819.1147.help-gnu-emacs@gnu.org>
2014-09-09  1:09             ` Emanuel Berg
2014-09-09  6:54               ` Thorsten Jolitz
2014-09-09 12:34           ` Stefan Monnier
     [not found]     ` <mailman.8444.1410167430.1147.help-gnu-emacs@gnu.org>
2014-09-08 21:54       ` Emanuel Berg
2014-09-09  7:51         ` Marcin Borkowski
2014-09-09 12:06           ` Stefan Monnier
2014-09-09 12:36             ` Tassilo Horn
2014-09-09 13:21               ` Stefan Monnier
2014-09-09 13:39                 ` Marcin Borkowski
2014-09-09 14:13                   ` Stefan Monnier
2014-09-09 17:00                     ` Marcin Borkowski
2014-09-09 17:24                       ` Stefan Monnier
     [not found]                       ` <mailman.8551.1410283491.1147.help-gnu-emacs@gnu.org>
2014-09-09 19:51                         ` Emanuel Berg
2014-09-09 13:14             ` Thorsten Jolitz
     [not found]         ` <mailman.8504.1410249128.1147.help-gnu-emacs@gnu.org>
2014-09-09 19:35           ` Emanuel Berg

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.