help-gnu-emacs
[Top][All Lists]
Advanced

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

defmacro and defface problems


From: tsgatesv
Subject: defmacro and defface problems
Date: Fri, 21 Mar 2008 09:26:43 +0900

hi, all!

I met a problem about defining macro with defface!

It looks extremely strange to me, help! 

1. define macro "git--face" in order to short my codes
--------------------------------------------------------------------------
(defmacro git--face (name fore1 prop1 fore2 prop2)
  `(defface ,(make-symbol (concat "git--" (symbol-name name) "-face"))
     '((((class color) (background light)) (:foreground ,fore1 ,@prop1))
       (((class color) (background dark)) (:foreground ,fore2 ,@prop2)))
    ,(concat "git " (symbol-name name) " face in status buffer mode")
    :group 'git))
--------------------------------------------------------------------------

2. seems like work,
--------------------------------------------------------------------------
(git--face wow       "red"    (:bold t) "tomato" (:bold t))
git--wow-face
--------------------------------------------------------------------------

3. but not defined (but, there is 'git--wow-face in "list-faces-display)
--------------------------------------------------------------------------
(facep 'git--wow-face)
nil
--------------------------------------------------------------------------

4. this is what I want to eval
--------------------------------------------------------------------------
(defface git--wow-face
  '((((class color) (background light)) (:foreground "gray" :bold
t :italic t))
    (((class color) (background dark)) (:foreground "gray" :bold
t :italic t)))
  "git wow face in status buffer mode"
  :group 'git)
git--wow-face


(facep 'git--wow-face)
[face unspecified unspecified unspecified unspecified unspecified
unspecified unspecified unspecified unspecified unspecified
unspecified ...]
--------------------------------------------------------------------------

5. Actually, the expanded macro of 1 and 4 is exactly same like under
--------------------------------------------------------------------------

(macroexpand '(git--face wow       "red"    (:bold t) "tomato" (:bold
t)))
(custom-declare-face (quote git--wow-face) (quote ((... ...) (... ...)))
"git wow face in status buffer mode" :group (quote git))

(macroexpand
'(defface git--wow-face
  '((((class color) (background light)) (:foreground "gray" :bold
t :italic t))
    (((class color) (background dark)) (:foreground "gray" :bold
t :italic t)))
  "git wow face in status buffer mode"
  :group 'git))
(custom-declare-face (quote git--wow-face) (quote ((... ...) (... ...)))
"git wow face in status buffer mode" :group (quote git))
--------------------------------------------------------------------------

Thank you for reading and please help me!






reply via email to

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