auctex
[Top][All Lists]
Advanced

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

[AUCTeX] Defining env with key-val in opt. argument


From: Arash Esbati
Subject: [AUCTeX] Defining env with key-val in opt. argument
Date: Sat, 4 Oct 2014 19:29:24 +0200

Hi,

I am trying to write a style file for `enumitem.sty' where you can have key-val 
in opt. arguments of environments.  My borrowed approach from `paralist.el' was:

====================================

(defvar LaTeX-enumitem-key-val-options
  '(;;
    ("topsep")
    ("partopsep")
    ("label")
    ("label*")
    ("align" ("left" "right" "parleft")))
  "Key=value options for enumitem macros and environments.")


(defun LaTeX-enumitem-env-item-opt-label (env)
  "Insert ENV, an optional label and the first item."
  (LaTeX-insert-environment
   env
   (let ((label (TeX-arg-key-val LaTeX-enumitem-key-val-options)))
     (concat (unless (zerop (length label))
               (format "[%s]" label)))))
  (LaTeX-find-matching-begin)
  (end-of-line 1)
  (delete-char 1)
  (delete-horizontal-space)
  (LaTeX-insert-item))


(TeX-add-style-hook
 "enumitem"
 (lambda ()
   ;; New environments
   (LaTeX-add-environments
    '("itemize" LaTeX-enumitem-env-item-opt-label)
    '("enumerate" LaTeX-enumitem-env-item-opt-label)
    '("itemize*" LaTeX-enumitem-env-item-opt-label)
    '("enumerate*" LaTeX-enumitem-env-item-opt-label))))

====================================

emacs ist not happy and exits with:

let: Wrong number of arguments: #[(optional key-val-alist) ...

Any idea what is going wrong here?  TIA.

(My lisp knowledge is very limited, so please bear with me.)




reply via email to

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