[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
add-to-list: factorization?
From: |
Denis Bitouzé |
Subject: |
add-to-list: factorization? |
Date: |
Wed, 20 May 2020 10:47:06 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hi,
in my `.emacs`, I have something like the following:
┌────
│ (setq TeX-auto-save t)
│ (setq TeX-parse-self t)
│ (setq-default TeX-master nil)
│
│ (setq LaTeX-verbatim-environments-local '("foo"
│ "bar"
│ "baz"
│ ))
│ (with-eval-after-load "latex"
│ (add-to-list 'LaTeX-indent-environment-list '("foo" current-indentation))
│ (add-to-list 'LaTeX-indent-environment-list '("bar" current-indentation))
│ (add-to-list 'LaTeX-indent-environment-list '("baz" current-indentation)))
└────
but with a much longer list than only:
┌────
│ "foo"
│ "bar"
│ "baz"
└────
About `add-to-list`, would it be possible to make a factorization in
order to not repeat :
1. neither `'LaTeX-indent-environment-list '` ;
2. nor ` current-indentation` ?
The ultimate ideal goal would be to not have to maintain in two
different places the list:
┌────
│ "foo"
│ "bar"
│ "baz"
└────
On a French forum where I asked this question, I got the answer.
┌────
│ (setq LaTeX-verbatim-environments-local '("foo"
│ "bar"
│ "baz"
│ ))
│ (dolist (env LaTeX-verbatim-environments-local)
│ (add-to-list 'LaTeX-indent-environment-list (list env
#'current-indentation)))
└────
If used in my `.emacs`, I get the following error at restart:
Debugger entered--Lisp error: (void-variable LaTeX-indent-environment-list)
(member x LaTeX-indent-environment-list)
(if (member x LaTeX-indent-environment-list) LaTeX-indent-environment-list
(setq LaTeX-indent-environment-list (cons x LaTeX-indent-environment-list)))
(let* ((x (list env (function current-indentation)))) (if (member x
LaTeX-indent-environment-list) LaTeX-indent-environment-list (setq
LaTeX-indent-environment-list (cons x LaTeX-indent-environment-list))))
(while --dolist-tail-- (setq env (car --dolist-tail--)) (let* ((x (list env
(function current-indentation)))) (if (member x LaTeX-indent-environment-list)
LaTeX-indent-environment-list (setq LaTeX-indent-environment-list (cons x
LaTeX-indent-environment-list)))) (setq --dolist-tail-- (cdr --dolist-tail--)))
(let ((--dolist-tail-- LaTeX-verbatim-environments-local) env) (while
--dolist-tail-- (setq env (car --dolist-tail--)) (let* ((x (list env (function
current-indentation)))) (if (member x LaTeX-indent-environment-list)
LaTeX-indent-environment-list (setq LaTeX-indent-environment-list (cons x
LaTeX-indent-environment-list)))) (setq --dolist-tail-- (cdr --dolist-tail--))))
eval-buffer(#<buffer *load*> nil "/home/bitouze/.emacs" nil t) ; Reading at
buffer position 397
load-with-code-conversion("/home/bitouze/.emacs" "/home/bitouze/.emacs" t t)
load("~/.emacs" t t)
#f(compiled-function () #<bytecode 0x1d8f61>)()
command-line()
normal-top-level()
Do you understand what's going on and how I can make a factorization on
`add-to-list`?
Thanks!
--
Denis
- add-to-list: factorization?,
Denis Bitouzé <=