|
From: | Mosè Giordano |
Subject: | [AUCTeX-devel] Proposed patches for tex.el and latex.el |
Date: | Fri, 8 Feb 2013 20:05:27 +0100 |
Hi all, 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 -------------------------------------------------------------------------------- ("savebox" LaTeX-auto-savebox LaTeX-add-saveboxes LaTeX-savebox-list LaTeX-savebox-changed) ("length" LaTeX-auto-length LaTeX-add-lengths LaTeX-length-list LaTeX-length-changed) ("counter" LaTeX-auto-counter LaTeX-add-counters LaTeX-counter-list LaTeX-counter-changed) ("pagestyle" LaTeX-auto-pagestyle LaTeX-add-pagestyles LaTeX-pagestyle-list LaTeX-pagestyle-changed) ("index-entry" LaTeX-auto-index-entry LaTeX-add-index-entries LaTeX-index-entry-list LaTeX-index-entry-changed) ("bibliography" LaTeX-auto-bibliography LaTeX-add-bibliographies LaTeX-bibliography-list LaTeX-bibliography-changed) ("environment" LaTeX-auto-environment LaTeX-add-environments LaTeX-environment-list LaTeX-environment-changed) ("bibitem" LaTeX-auto-bibitem LaTeX-add-bibitems LaTeX-bibitem-list LaTeX-bibitem-changed) ("label" LaTeX-auto-label LaTeX-add-labels LaTeX-label-list LaTeX-label-changed) ("symbol" TeX-auto-symbol TeX-add-symbols TeX-symbol-list TeX-symbol-changed) (styles TeX-auto-file TeX-run-style-hooks) -------------------------------------------------------------------------------- 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'. 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. 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. 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. 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. 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'm attaching patches to implement previous changes, here is the corresponding ChangeLog entry: 2013-02-08 Mosè Giordano <address@hidden> * style/biblatex.el: Update copyright range. ("biblatex"): Check `backend' option value in `TeX-active-styles'. * tex-style.el: Upadte copyright years. Remove `LaTeX-biblatex-use-Biber'. * tex.el: Update copyright range. (TeX-auto-add-type): Append new type to `TeX-auto-parser' instead of prepending it. (TeX-auto-store): Fix indentation of first lines of parsed file. * latex.el (LaTeX-auto-cleanup): Append options and styles to `TeX-auto-file' instead of prepending them. Bye, Mosè Giordano
latex.el.patch
Description: Binary data
tex.el.patch
Description: Binary data
biblatex.el.patch
Description: Binary data
tex-style.el.patch
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |