From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: defmacro and defface problems Date: Fri, 21 Mar 2008 16:19:26 -0400 Organization: Symantec Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1206132047 12472 80.91.229.12 (21 Mar 2008 20:40:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Mar 2008 20:40:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 21 21:41:17 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jco32-0004vX-GX for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Mar 2008 21:41:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jco2R-0003Eo-IA for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Mar 2008 16:40:31 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Fri, 21 Mar 2008 15:19:26 -0500 Original-Newsgroups: gnu.emacs.help Mail-Copies-To: nobody User-Agent: MT-NewsWatcher/3.5.3b2 (Intel Mac OS X) X-Copies-To: never Original-Lines: 80 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 24.34.108.171 Original-X-Trace: sv3-yDF86VxKKLJ2/TxB80b9wvwAKMeCGVzAkY1iGi96SE2IRUlkibbTV8s91VNS5ubi5L22YX1bRywkmvq!Vk8HUnSni7KohjbdhBLaV/Qrt1h/iYHXAUaVuxDysoCv6FqvC6U+DQl0UJGJZ0dgx++wuPmXPVjY!Dfpm6DpkIce4FOZHLkiRFkof8iQW4oEKXS9U1Ng= Original-X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.37 Original-Xref: shelby.stanford.edu gnu.emacs.help:157245 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:52614 Archived-At: In article , tsgatesv wrote: > 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")) Use intern, not make-symbol. Make-symbol creates uninterned symbols, so when you later type (facep 'git--wow-face), you're not using the same symbol that you defined. > '((((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! -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE don't copy me on replies, I'll read them in the group ***