From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: harven Newsgroups: gmane.emacs.help Subject: Re: intern and faces Date: Wed, 02 Dec 2009 21:22:00 +0100 Organization: http://groups.google.com Message-ID: References: <87r5rdbnqq.fsf@ergodik.univ-brest.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259794977 678 80.91.229.12 (2 Dec 2009 23:02:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Dec 2009 23:02:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 03 00:02:50 2009 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 1NFyDe-0005Zp-42 for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Dec 2009 00:02:46 +0100 Original-Received: from localhost ([127.0.0.1]:60698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFyDd-0007AE-Tm for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Dec 2009 18:02:45 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!feeder1-2.proxad.net!cleanfeed3-a.proxad.net!nnrp5-1.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin) Cancel-Lock: sha1:ylWpyw8MU6/kCirx3xYjL1Ac9uo= Original-Lines: 40 Original-NNTP-Posting-Date: 02 Dec 2009 21:22:00 MET Original-NNTP-Posting-Host: 78.233.232.132 Original-X-Trace: 1259785320 news-1.free.fr 31708 78.233.232.132:50111 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:175262 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:70339 Archived-At: "Drew Adams" writes: >> I have built a small command to colorize a region >> >> (defun put-color (start end color-name) >> (interactive "r\nsColor ? ") >> (let ((my-color (concat "color-" color-name))) >> (unless (facep my-color) >> (set-face-foreground >> (make-face (intern my-color)) >> color-name)) >> (facemenu-set-face my-color start end))) >> >> But I encounter a problem when trying to spool the result. >> >> Starting with emacs -Q and executing the code above, I switch >> to another buffer, type some text and colorize it with >> M-x put-color RET brown RET The result looks fine in the >> buffer, but when I try to execute >> M-x ps-spool-buffer-with-faces, I get the error >> >> Wrong type argument: listp, "color-brown" > > I think the problem is (facemenu-set-face my-color start end). Use `intern' here > also, so that you pass the symbol, not the string. > > Emacs used to always require (an internal face structure or) a symbol for its > face operations. Now, some operations let you use the name of that symbol (a > string) instead. Both `facep' and `facemenu-set-face' now respect a string, but > `ps-*' apparently does not. In general, I'd advise using a symbol. > > You can see the difference by using `C-u C-x =' with the cursor on your colored > text. It will tell you that the face is "color-brown", not `color-brown' > (symbol). If you use instead (facemenu-set-face (intern my-color) start end), it > will show you the symbol. And I'm guessing that `ps-*' will act OK if it's a > symbol. Yes, you guessed right, that works if I replace my-color by (intern my-color) in the function facemenu-set-face. I will report it. Thanks a lot.