auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX-devel] Proposed patches for tex.el and latex.el


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] Proposed patches for tex.el and latex.el
Date: Tue, 12 Feb 2013 09:12:35 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Mosè Giordano <address@hidden> writes:

Hi Mosè,

> I'm writing to propose small changes that can open the door to some
> improvement to style files.
>
> 1.  Currently, in LaTeX mode `TeX-auto-parser' has the value
> --------------------------------------------------------------------------------
> ...
> --------------------------------------------------------------------------------
> or something like this.  In this way, automatically parsed files will
> have `TeX-run-style-hooks' stuff at the end, and `(La)TeX-add-*'
> functions before it.  For many (La)TeX packages it would be useful to
> add new type for the parser through `TeX-auto-add-type', but now this
> can't work because when reopening the *.tex file `(La)TeX-add-<new
> type>' is executed before `TeX-run-style-hooks'.  I suggest to reverse
> this behaviour, ie, to make `TeX-run-style-hooks' be written before
> `(La)TeX-add-*'.  This can be achieved using `add-to-list' function
> with `APPEND' argument set to `non-nil', which also prevents from
> multiple inserting types to `TeX-auto-parser'.

Yes, that sounds reasonable.

> 2.  Automatically parsed files currently start with the lines
> --------------------------------------------------------------------------------
> (TeX-add-style-hook "<style>"
>  (lambda ()
> --------------------------------------------------------------------------------
> This is not how Emacs would indent the code and I find it quite
> annoying.  I suggest to use the following style
> --------------------------------------------------------------------------------
> (TeX-add-style-hook
>  "<style>"
>  (lambda ()
> --------------------------------------------------------------------------------
> that is correctly indented and the one used by most of the style files
> provided with AUCTeX.

Well, I think the former looks slightly better, and the proper
indentation could be defined with

  (put 'TeX-add-style-hook 'lisp-indent-function 1)

which would make the indentation look like

--8<---------------cut here---------------start------------->8---
(TeX-add-style-hook "foo"
  (lambda ()
    stuff))
--8<---------------cut here---------------end--------------->8---

i.e., let-like indentation.

However, if you don't place the "foo" on the same line than
TeX-add-style-hook, it'll look like

--8<---------------cut here---------------start------------->8---
(TeX-add-style-hook
    "foo"
  (lambda ()
    stuff))
--8<---------------cut here---------------end--------------->8---

which looks weird.  With

  (put 'TeX-add-style-hook 'lisp-indent-function 2)

(which makes more sense in that the 2 stands for 2 arguments) it would
indent the lambda with 4 spaces, and if the packages was on a separate
line, it would be also indented with 4 spaces.

--8<---------------cut here---------------start------------->8---
(TeX-add-style-hook "foo"
    (lambda ()
      stuff))

(TeX-add-style-hook
    "foo"
    (lambda ()
      stuff))
--8<---------------cut here---------------end--------------->8---

I don't really have a preference here...

> 3.  LaTeX packages may do different things according to options passed
> to them.  Eg, `biblatex' can use `biber' or `bibtex' as backend,
> depending on the value of `backend' option.  AUCTeX prepends options
> to `TeX-auto-file' and then prepends corresponding package name, and
> so `biblatex.el' style file can't check the value of `backend' option.
> I suggest to append options and package names.  I think
> `LaTeX-biblatex-use-Biber' custom variable can be removed since it
> should not be needed anymore.  Now, other style files will be able to
> executed different code depending on the value of options given to the
> package.

Good.

> I believe that change #2 is harmless, changes #1 and #3 may break
> backward compatibility if there is code relying on the current
> behaviour of AUCTeX, but I don't see why one should rely on this weird
> behaviour.

Me neither, but people might still have.  We'll see if anybody
complains.

> Actually, I believe it would be more useful not to store options in
> `TeX-auto-file' variable, this will also prevent clash between options
> or package names.

Indeed.

> I've been thinking to store options given to each package in a
> variable named something like `LaTeX-<package>-used-options'.  What do
> you think about this?

I'd go for `LaTeX-<package>-provided-package-options' to match with
`LaTeX-<package>-package-options'.  Other than that, the idea sounds
good to me.

I've applied you changes.

Bye,
Tassilo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]