emacs-devel
[Top][All Lists]
Advanced

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

Re: Old-style backquotes in cc-vars.el


From: Thien-Thi Nguyen
Subject: Re: Old-style backquotes in cc-vars.el
Date: Sat, 06 Oct 2007 20:31:57 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

() Alan Mackenzie <address@hidden>
() Sat, 6 Oct 2007 16:31:01 +0000

   ,@(plist-put
      args ':type
      `(` (radio                                <==========================
           (const :tag "Use style settings"
                  set-from-style)
           ,(, (let ((type (eval (plist-get args ':type))))
                 (unless (consp type)
                   (setq type (list type)))
                 (unless (c-safe (plist-get (cdr type) ':value))
                   (setcdr type (append '(:value (, -value-))
                                        (cdr type))))
                 (unless (c-safe (plist-get (cdr type) ':tag))
                   (setcdr type (append '(:tag "Override style settings")
                                        (cdr type))))
                 (bq-process type))))))

wow, funky!  how about this replacement?

(defmacro defcustom-c-stylevar (name val doc &rest args)
  "Defines a style variable."
  (let* ((val (eval val))
         (type (eval (list 'identity (plist-get args :type))))
         (head (car type))
         (tail (cdr type))
         (newt (append (unless (plist-get tail :tag)
                         '(:tag "Override style settings"))
                       (unless (plist-get tail :value)
                         `(:value ,val))
                       tail)))
    `(progn
       (c-set-stylevar-fallback ',name ,val)
       (custom-declare-variable
        ',name ''set-from-style
        ,(concat doc "\n\nZZZ")
        ,@(plist-put 
           args :type `(radio
                        (const :tag "Use style settings" set-from-style)
                        ,(cons head newt)))))))

the ZZZ stands for the original blurb, reinstatable after discussion.
calls to `c-safe' were removed since plist-get never errs.

thi




reply via email to

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