From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: Macro Expansion Inconsistency Date: Tue, 16 Dec 2014 19:34:18 -0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1418787307 2246 80.91.229.3 (17 Dec 2014 03:35:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2014 03:35:07 +0000 (UTC) Cc: Alexander Shukaev To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 17 04:35:00 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y15O0-0003JP-ET for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2014 04:34:52 +0100 Original-Received: from localhost ([::1]:47769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y15Nz-0001yc-W5 for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 22:34:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y15Nn-0001xg-TY for help-gnu-emacs@gnu.org; Tue, 16 Dec 2014 22:34:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y15Nm-0002gR-St for help-gnu-emacs@gnu.org; Tue, 16 Dec 2014 22:34:39 -0500 Original-Received: from mail-oi0-x22b.google.com ([2607:f8b0:4003:c06::22b]:45415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y15Nm-0002fu-O7 for help-gnu-emacs@gnu.org; Tue, 16 Dec 2014 22:34:38 -0500 Original-Received: by mail-oi0-f43.google.com with SMTP id a3so10636125oib.16 for ; Tue, 16 Dec 2014 19:34:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=d/HDvZOxA290/tW064G/Sn/p0DR4jWb6Rwlp+6lOvIo=; b=mMgUKq/HkwChwxpgIcuBlzEJqOcpoGuip/woGV+Z3nL8J6b0ntY2KWfVt2DY1JllUy Ai7lPB5qvxItLhaBZx4cdac7YDhXvcUGayasenShGWCeGLZ8IXhKXR9ebLPCPPkb4y6f XO9FYaM3pZw3O2zj6l7I6nK0mxH07UCQP+zZuP5Ej1JUb9PcJSpLGVwfzlwBYKMu3yv6 zu5vLIHBiuqKjWPJY8KXg0OGAiHEMe0hSFc3g+DC5Y5RROSPyFJZNy1b+6iyOi759OHK n98axhqChmcd1/DFxi090/60Ydm37pH8IpTFAQKwndJ7dcj3Bgw+L4CNzI+jbt1odjk3 gZAw== X-Received: by 10.60.36.200 with SMTP id s8mr24430981oej.25.1418787278201; Tue, 16 Dec 2014 19:34:38 -0800 (PST) Original-Received: by 10.76.12.162 with HTTP; Tue, 16 Dec 2014 19:34:18 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::22b X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101623 Archived-At: Hi Alexander, Alexander Shukaev wrote: > John, please, have a look at my latest post. It will give you the whole idea > of what's going on. Thanks for your time. You're very close. I think the below will do what you're looking for, without using `eval'. The problem you were having with `foreground' is because it's within two backquotes. You can think of each unquote as peeling away a single level of quoting. The `progn' is necessary because the macro, like other functions, can only return a single value. Since we need to emit seval forms, we wrap them up in a single `progn'. This wasn't necessary in yours since you weren't actually emitting any forms from the macro, but it is necessary in this way of doing it. I moved the calls to `put' within the backquote just for the example of how it's sometimes necessary to quote the result of what you've just unquoted. Let me know if anything's unclear or if I missed something. (defmacro bm-define-flag2 (name index character foreground) (let* ((symbol (intern (format "bm-%s-flag" (symbol-name name)))) (character-symbol (intern (format "%s-character" (symbol-name symbol))))) `(progn (put ',symbol 'index ,index) (put ',symbol 'character ',character-symbol) (defcustom ,character-symbol ,character :tag "BM Flag Character" :group 'buffer-manager :type 'character) (defface ,symbol `((t :foreground ,,foreground :weight bold)) "Face for flag." :tag "BM Flag Face" :group 'buffer-manager-faces)))) -- john