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: Check if a symbol is bound to a macro Date: Tue, 08 Dec 2009 15:52:54 -0500 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1260308595 9432 80.91.229.12 (8 Dec 2009 21:43:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Dec 2009 21:43:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 08 22:43:08 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 1NI7pr-0005PF-6g for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Dec 2009 22:43:07 +0100 Original-Received: from localhost ([127.0.0.1]:36463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NI7pq-0001R5-V2 for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Dec 2009 16:43:06 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.glorb.com!news2.glorb.com!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!barmar.motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-X-Trace: news.eternal-september.org U2FsdGVkX1+I0L6zOcDFagSu6+7zXK6dxzhuQJOkjeCZ/lyfnhOnGbv4uSC4NBmCDGCml9pJJkQedyB0ANhQQTP1C1S3vmK4UqjkalNWZJqF09897Dc+LfCnYndLDQBa9eN3cjm8/6s= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Tue, 8 Dec 2009 20:52:54 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Auth-Sender: U2FsdGVkX194HbcSkrC7I8GCRfUVaGCyE0To/81tjuI= Cancel-Lock: sha1:KTx/J9qTY1vrTRmp3PzDuECxxTU= Original-Xref: news.stanford.edu gnu.emacs.help:175433 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:70508 Archived-At: In article , Nordlöw wrote: > Is there a way to query if a symbol is bound to a macro? > > list-fns.el written by Noah Friedman provides the function > > (defun macrop (x) > "Return `t' if X is a macro, `nil' otherwise. > X may be a raw or byte-compiled macro. No attempt is made to > determine if > the macro is actually well-formed (i.e. syntactically valid)." > (cond ((not (consp x)) > nil) > ((eq (car x) 'macro) > (functionp (cdr x))))) > > but it doesn't work for me. > (macrop 'case) > returns nil. > > Thanks, > Nordlöw macrop expects the function, not the function name, as its argument. So you need to do: (defun named-macrop (symbol) (and (fboundp symbol) (macrop (symbol-function symbol)))) -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***