Consider the variable TeX-current-macro
raised in the recent question detect if inside a LaTeX footnote and get its bounds? also in https://emacs.stackexchange.com/a/7634/2690.
I would like to determine if I am inside the macros chapter
or section
in a latex file, I can write define a function which shows yes
if it is the case, otherwise no
.
Of course I can use the following which does the job.
(defun foo-test () (interactive)
(if (or (equal (TeX-current-macro) "chapter")
(equal (TeX-current-macro) "section"))
(message "yes") (message "no"))
)
But it is long. Like in my previous question What is the easiest way to check if a character belongs to a particular set of characters?, I am wondering if there is a better way to do it.
Inspired by the answer https://emacs.stackexchange.com/a/7880/2609, I tried the below code, but unfortunately it doesn't work.
I also tried with memq
instead of member
but it doesn't work either.
(defun foo-test () (interactive)
(if (member (TeX-current-macro) '(chapter section))
(message "yes") (message "no"))
)
Any solution about checking if the value of a variable belong to a list of elements is welcomed.