From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Nordl=F6w?= Newsgroups: gmane.emacs.help Subject: Re: Check if a symbol is bound to a macro Date: Tue, 8 Dec 2009 14:17:15 -0800 (PST) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1260312046 22036 80.91.229.12 (8 Dec 2009 22:40:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Dec 2009 22:40:46 +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 23:40:40 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 1NI8jX-0000jn-1J for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Dec 2009 23:40:39 +0100 Original-Received: from localhost ([127.0.0.1]:33062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NI8jW-0005y9-Pm for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Dec 2009 17:40:38 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!b2g2000yqi.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-NNTP-Posting-Host: 81.170.219.22 Original-X-Trace: posting.google.com 1260310635 20225 127.0.0.1 (8 Dec 2009 22:17:15 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 8 Dec 2009 22:17:15 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b2g2000yqi.googlegroups.com; posting-host=81.170.219.22; posting-account=ytJKAgoAAAA1tg4ScoRszebXiIldA5vg User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.6 (KHTML, like Gecko) Chrome/4.0.261.0 Safari/532.6,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:175437 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:70511 Archived-At: On Dec 8, 9:52=A0pm, Barry Margolin wrote: > In article > , > > > > > > =A0Nordl=F6w 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) > > =A0 "Return `t' if X is a macro, `nil' otherwise. > > X may be a raw or byte-compiled macro. =A0No attempt is made to > > determine if > > the macro is actually well-formed (i.e. syntactically valid)." > > =A0 (cond ((not (consp x)) > > =A0 =A0 =A0 =A0 =A0nil) > > =A0 =A0 =A0 =A0 ((eq (car x) 'macro) > > =A0 =A0 =A0 =A0 =A0(functionp (cdr x))))) > > > but it doesn't work for me. > > =A0 (macrop 'case) > > returns nil. > > > Thanks, > > Nordl=F6w > > macrop expects the function, not the function name, as its argument. =A0S= o > you need to do: > > (defun named-macrop (symbol) > =A0 (and (fboundp symbol) > =A0 =A0 =A0 =A0(macrop (symbol-function symbol)))) > > -- > Barry Margolin, bar...@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 *** Thanks! /Per Nordl=F6w