auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX-devel] New style enumitem.el


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] New style enumitem.el
Date: Mon, 09 Mar 2015 08:58:01 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Arash Esbati <address@hidden> writes:

Hi Arash,

> this patch adds support for `enumitem.sty'.  Any comments welcome.

Also applied.  Thanks!  Just a nitpick below.

> +;; In `LaTeX-enumitem-SetEnumitemValue-regexp', we match (0 1 2).
> +;; When adding a new `key=val', we need something unique for `0'-match
> +;; until the next `C-c C-n'.  We use a random number for this purpose
> +;; which will then disappear.
> +(defun LaTeX-arg-SetEnumitemValue (optional &optional prompt)
> +  "Ask for a new value added to an existing key incl. the final
> +replacement of the value."
> +  (LaTeX-enumitem-update-key-val-options)
> +  (let* ((key (TeX-read-key-val optional 
> LaTeX-enumitem-key-val-options-local "Key"))
> +      (val (TeX-read-string "String value: "))
> +      ;; (key-match (car (assoc key LaTeX-enumitem-key-val-options-local)))
> +      (val-match (cdr (assoc key LaTeX-enumitem-key-val-options-local)))
> +      (temp (copy-alist LaTeX-enumitem-key-val-options-local))
> +      (opts (assq-delete-all (car (assoc key temp)) temp)))
> +    (if val-match
> +     (pushnew (list key (delete-dups (apply 'append (list val) val-match)))
> +              opts :test #'equal)
> +      (pushnew (list key (list val)) opts :test #'equal))
> +    (setq LaTeX-enumitem-key-val-options-local (copy-alist opts))
> +    (TeX-argument-insert key optional)
> +    (TeX-argument-insert val optional)
> +    (LaTeX-add-enumitem-SetEnumitemValues
> +     `(,(number-to-string (random)) ,key ,val))))

Instead of adding some random number, you could instead add here what
the original match would have been if the \SetEnumitemValue would have
been parsed in the file, i.e.,

  (list (concat "\\SetEnumitemValue{" key "}{" val "}")
        key val)

I think with your current approach, you'll get duplicate entries for the
same key-value options, one being

  (<random-number> "key" "val")

and one being

  ("\\SetEnumitemValue{key}{val}" "key" "val")

I don't think that this causes any trouble per se, but there's also no
good reason for doing it this way.

Bye,
Tassilo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]