I tried my first steps with emacs lisp to remove the element "\\.synctex\\.gz"
from LaTeX-clean-intermediate-suffixes
:
(eval-after-load 'latex
'(setq my-LaTeX-clean-intermediate-suffixes (remove '"\\.synctex\\.gz" LaTeX-clean-intermediate-suffixes)); that's not working
'(setq LaTeX-clean-intermediate-suffixes
(append my-LaTeX-clean-intermediate-suffixes (list "-blx\\.bib" "\\.run\\.xml"))))
How can I remove this element here? I found remove
and delete
, tried them both, but I get an wrong-number-of-arguments
-type of error.
Update
I tried this:
(eval-after-load 'latex
(setq LaTeX-clean-intermediate-suffixes (delete "\\.synctex\\.gz" LaTeX-clean-intermediate-suffixes))
'(setq LaTeX-clean-intermediate-suffixes
(append LaTeX-clean-intermediate-suffixes (list "-blx\\.bib" "\\.run\\.xml"))))
but I receive quite a long output in Backtrace :-(
As assem pointed out there seems to be extra whitespace in your code which prevents the otherwise correct invocation of remove
.
Note that both delete
and remove
work for such purposes, as long as the elements of the list can be compared correctly via equal
which is used for both of them. If you want to compare using eq
instead, use the functions delq
or remq
.
The main differences between delete
and remove
(or delq
and remq
respectively) is that delete
removes the given element by side effect, i.e., changes the given list in place, while remove
does not but instead returns a copy of the given list with the element removed.
(setq list1 '("foo" "bar" "baz"))
(setq list2 (remove "bar" list1))
(message "list1: %s" list1)
(message "list2: %s" list2)
(setq list3 (delete "bar" list1))
(message "list1: %s" list1)
(message "list3: %s" list3)
If you evaluate the above code, you'll find the following output in your *Message*
buffer:
list1: (foo bar baz)
list2: (foo baz)
list1: (foo baz)
list3: (foo baz)
As you can see, after calling remove
on list1
, it has not changed. But after you called delete
on it, it has changed.
The error you see is not due to manipulations of the list but caused by a wrong usage of eval-after-load. This function allows only two parameters: (eval-after-load FILE FORM)
. So your snippet should read either
(eval-after-load 'latex
'(setq LaTeX-clean-intermediate-suffixes (delete "\\.synctex\\.gz" LaTeX-clean-intermediate-suffixes)
LaTeX-clean-intermediate-suffixes (append LaTeX-clean-intermediate-suffixes (list "-blx\\.bib" "\\.run\\.xml"))))
(as multiple assignments are allowed in a single setq statement) or the more general variant (subsuming as many forms as you wish within a single progn
):
(eval-after-load 'latex
'(progn
(setq LaTeX-clean-intermediate-suffixes (delete "\\.synctex\\.gz" LaTeX-clean-intermediate-suffixes))
(setq LaTeX-clean-intermediate-suffixes (append LaTeX-clean-intermediate-suffixes (list "-blx\\.bib" "\\.run\\.xml")))))
delete
should work
http://www.gnu.org/software/emacs/manual/html_node/elisp/Sets-And-Lists.html
(setq LaTeX-clean-intermediate-suffixes (delete "\\.synctex\\.gz" LaTeX-clean-intermediate-suffixes))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With