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: Alan Mackenzie
Subject: Re: Old-style backquotes in cc-vars.el
Date: Sat, 6 Oct 2007 20:51:18 +0000
User-agent: Mutt/1.5.9i

Hi, Thi!

On Sat, Oct 06, 2007 at 08:31:57PM +0200, Thien-Thi Nguyen wrote:
> () 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!

Can you explain to me what it is doing?  If so, please do!  :-)

> 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)))))))

It doesn't quite work - (car type) bombs, because type is 'integer, not
a list.  I'll figure out, though.
 
> thi

-- 
Alan.




reply via email to

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