[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: |
Tassilo Horn |
Subject: |
Re: [AUCTeX] How to apply different 'style-hook' for a document depending on option passed to a package? |
Date: |
Thu, 31 Oct 2013 14:16:14 +0100 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) |
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 () ...)))
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))
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.
Bye,
Tassilo