[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] Possible truncation of the value of list variable
From: |
Arash Esbati |
Subject: |
Re: [AUCTeX-devel] Possible truncation of the value of list variable |
Date: |
Sat, 30 Sep 2017 23:06:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 |
Ikumi Keita <address@hidden> writes:
> And I'm afraid that the combination of `delete-dups' and `append' might
> cause similar truncation of list variable in other places, i.e.,
> caption.el, enumitem.el, floatrow.el, mdframed.el and
> menukeys.el. Arash, could you please check these files as the author of
> them?
Hi Keita,
thanks for the heads-up. I checked those styles and they don't produce
unwanted changes to global variables. You can eval these forms to see
the basic operation:
(require 'cl)
(setq my/test '(("align" ("left" "right" "center"))))
(make-variable-buffer-local 'my/test)
(defun my/test ()
(dolist (newalign '(("justified") ("center")))
(let* ((key "align")
(val (car newalign))
(val-match (cdr (assoc key my/test)))
(temp (copy-alist my/test))
(opts (assq-delete-all (car (assoc key temp)) temp)))
(pushnew (list key (delete-dups (apply #'append (list val) val-match)))
opts :test #'equal)
my/test ;; for testing only
(setq my/test (copy-alist opts)))))
(my/test)
The delete-dups/append thing operates only on variables marked with
`make-variable-buffer-local'.
Best, Arash