[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] How to apply different 'style-hook' for a document dependin
From: |
Vladimir Lomov |
Subject: |
Re: [AUCTeX] How to apply different 'style-hook' for a document depending on option passed to a package? |
Date: |
Thu, 31 Oct 2013 22:30:59 +0900 |
User-agent: |
Mutt/1.5.22 (2013-10-16) |
Hello
** Tassilo Horn [2013-10-31 14:16:14 +0100]:
> Vladimir Lomov <address@hidden> writes:
> Hi Vladimir,
>> I don't know Emacs Lisp well enough, so I tried following: I added
>> construction
>> (lambda () (nth 1 (split-string (nth 1 (assoc "isu-th3"
>> LaTeX-provided-package-options)) "=")))
>> into function 'TeX-run-style-hooks' of my 'isu-th3.el' (that's the real
>> name of my package) and tried to run emacs on sample document. It fails
>> with message:
>> TeX-member: Wrong type argument: stringp, (lambda nil (nth 1 (split-string
>> (nth
>> 1 (assoc "isu-th3" LaTeX-provided-package-options)) "=")))
>> As I understand from definition of 'TeX-run-style-hooks', the function
>> expects string not a function. Of course if I run the construction in
>> *scratch* (defining LaTeX-provided-package-options by hand) to test
>> it, all works fine.
>> Is it possible to 'evaluate' lambda function, so it returns the string
>> and that string will be used as hooks-name?
> Sure, you add parentheses around it. E.g., if you now have
> (TeX-run-style-hooks (lambda () ...))
> you'd have
> (TeX-run-style-hooks ((lambda () ...)))
Thank you Tassilo, that did the trick!
> But then you don't need a lambda, but you'd rather use something like:
> (let ((conf (nth 1 (split-string (nth 1 (assoc "isu-th3"
>
> LaTeX-provided-package-options))
> "="))))
> (TeX-run-style-hooks conf))
I'll try to test this variant laterly.
> BTW, your code just takes the value of the first option as the style to
> load. I don't know if there could also be
> \usepackage[x=y,conf=set1]{isu-th3}
> then your code would try to load y.
This is not my case, but I'll think about it definitely.
> Bye,
> Tassilo
---
WBR, Vladimir Lomov
--
QOTD:
"I ain't broke, but I'm badly bent."