[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] Customizing "%cS" in TeX-expand-list
From: |
jfbu |
Subject: |
Re: [AUCTeX] Customizing "%cS" in TeX-expand-list |
Date: |
Thu, 20 Nov 2014 11:13:19 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
Le 20/11/2014 10:19, Mosè Giordano a écrit :
Hi Jean-Francois,
2014-11-19 19:11 GMT+01:00 jfbu <address@hidden>:
Hi,
I have upgraded to AUCTeX 11.88 via Elpa. Thanks to all who
worked on it, as for the first time since quite a few years
I experience the joy of not having C-c ` open some "TeXLive 20xx"
window or, worse, tell me "Error occured after last TeX file closed"
(the few times I tried an upgrade since 2011, it
made things worse, and I had to revert to an ancient auctex
installation copied-pasted from some other machine).
I was quite elated to see that C-c ` works as expected with 11.88,
(it probably does since a long time, I was just unable to upgrade
earlier)
and there is a very nice Error Overview menu entry which I didn't
know about until now. (or did I just not see it? possible)
The error overview is a new feature in AUCTeX 11.88 ;-)
I see it mentioned in the Releases notes indeed. This is a very nice
feature. I like the colors too ;-)
Thanks to the experts who made this happen: Mosè, Tassilo, ..., sorry
for the people I do not cite but I subscribe to the mailing list
since only very recently. Great job!
Thanks!
This message is about some customizations which I did some years back,
at a time when I very temporarily to some vague elisp understanding,
and that I am re-integrating to my custom-file (the understanding having
vanished)
My question is about how doing the things more effciently than my
current method, which is to customize the full TeX-expand-list variable
for only one change.
The
default definition of %cS as found in TeX-expand-list is
("%cS" TeX-source-specials-view-expand-client)
I replace it by
("%cS" (lambda nil "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient
--no-wait +%%l %%f"))
This is to avoid having to put an alias to emacsclient in /usr/bin (which
would quite possibly be wiped away by system upgrades) or more generally in
$PATH
Also this spares me having to put an editor entry in .xdvirc
(I also configured the program for output-dvi to be, in case source-specials
is on:
open -a XQuartz && %(o?)xdvi -sourceposition \"%n %b\" -editor \"%cS\" [some
paper option] %d
and for output-pdf:
/Applications/Skim.app/Contents/SharedSupport/displayline -b %n %o %b
This is all on Mac OS X, and my Emacs is recently upgraded "Emacs Mac Port":
GNU Emacs 24.4.3 from https://github.com/railwaycat/emacs-mac-port
)
What I do currently is to have the full TeX-expand-list
customized in order to apply this single replacement of "%cS"
Is there a Lisp-way to do this more economically?
Could I just overwrite the TeX-source-specials-view-expand-client function?
You have two options: add
(add-to-list
'TeX-expand-list
'("%cS"
(lambda nil
"/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --no-wait
+%%l %%f")))
(sorry for hard-wrapping of the code above) to your init file. This
will add a new "%cS" entry to `TeX-expand-list' and only the first one
will be actually used. Or, as you suggested, you can redefine the
`TeX-source-specials-view-expand-client' function after loading
tex.el:
(eval-after-load "tex"
'(defun TeX-source-specials-view-expand-client ()
"/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --no-wait
+%%l %%f"))
Thanks Mosè! this is exactly what I was looking for. I opted for
the first method, I added the (add-to-list ...) to TeX-mode-hook
in my init file. And it works as expected, thanks.
I will keep the second option somewhere as a model if I need
a similar thing in the future.
A second question:
I know AUCTeX has many many features, and I am only using a small
fraction. Currently I observe that the first loading when I launch
Emacs and open a first .tex file takes noticeable time (about five seconds).
Is there a "mode-for-the-dumb-guy-who-thinks-he-needs-only-a-few-things"
which would load faster?
What makes AUCTeX slow should be the loading of style files, you can
try disabling file parsing and saving auto/*.el files, but then you'll
lose many features of AUCTeX. This may be ok if you want just to open
a *TeX source and do minimal editing.
It is true I have never learnt to really use AUCTeX's features,
beyond the minimal things such as C-cC-e. I need to improve in
this area.
Yesterday, I tried removing about 80 (el/elc) pairs of files from
style/ (among the 148 such pairs currently there). For example,
style files for languages I do not use on a reguler basis. But
this had nil effect on the 5 seconds loading time. Admittedly now
that I look again at these files, I recall that I had kept all the
"big" ones. I will try again.
No wait, I just now deleted *all* files in
.emacs.d/elpa/auctex-11.88/style apart from .nosearch
and I observe the exact same 5 seconds delay on opening a .tex file
(it does not matter if a latex file or Plain, even only a Hello
world\bye file).
This is a "one-time-only" delay, opening further
.tex files is instantaneous. (perhaps will be less so after I
reinstall all style/* files)
I can surely learn to live with it...
Thanks for the help
Bye,
Jean-François