[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro Expansion Inconsistency
From: |
Alexander Shukaev |
Subject: |
Re: Macro Expansion Inconsistency |
Date: |
Wed, 17 Dec 2014 03:19:14 +0100 |
I currently have the following macro baked:
(defmacro bm-define-flag
(name index character foreground)
(let* ((symbol (intern (format "bm-%s-flag"
(symbol-name name))))
(character-symbol (intern (format "%s-character"
(symbol-name symbol)))))
(put symbol 'index index)
(put symbol 'character character-symbol)
(eval `(defcustom ,character-symbol
,character
"Character for flag."
:tag "BM Flag Character"
:group 'buffer-manager
:type 'character))
(eval `(defface ,symbol
`((t :foreground ,foreground
:weight bold))
"Face for flag."
:tag "BM Flag Face"
:group 'buffer-manager-faces))))
and running
(bm-define-flag xxx 777 ?$ "yellow")
gives the expected results, i.e. all the data structures are populated
properly. The only problem is that `defface' seems to be returning
`,symbol' itself (would be `bm-xxx-flag' in the above test case) and that
causes the error: (void-variable bm-xxx-flag) in `eval', i.e. in
eval(bm-xxx-flag nil)
How to overcome it? Do you have any further recommendations on this macro?
P.S. It's my first somewhat serious macro in Emacs Lisp ever, so I'd love
to learn more from pros until I do something dumb.
- Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, Joost Kremers, 2014/12/16
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, John Mastro, 2014/12/16
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency,
Alexander Shukaev <=
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Stefan Monnier, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Message not available
- Re: Macro Expansion Inconsistency, Barry Margolin, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17