all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#15296: 24.3.50; A macro object does not necessarily have `lambda' as its cadr
@ 2013-09-07  5:39 Drew Adams
  2013-09-07 11:34 ` Michael Heerdegen
  2013-09-08 18:01 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Drew Adams @ 2013-09-07  5:39 UTC (permalink / raw)
  To: 15296

AFAICT, (elisp) `Defining Macros' is the closest thing we have to doc
telling you how to test whether a Lisp object is a macro.  There is no
`macro-p' predicate or similar in Emacs Lisp, unless I'm missing
something.  (Shouldn't there be?)

Anyway, this Elisp manual node says that a macro is a list whose car is
`macro' and whose `cdr' is a lambda expression.  That's not true if the
`defmacro' was byte-compiled.  The macro is then a list whose car is `macro'
but whose cdr is byte code, AFAICT.  So this will not work, for example:

(defun macro-p (obj)
  (and (fboundp obj)
       (let ((def  (symbol-function obj)))
         (and (consp def)
              (eq (car def) 'macro)
              (eq (cadr def) 'lambda)))))

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-08-23 on ODIEONE
Bzr revision: 113986 rgm@gnu.org-20130823185841-zoy6h1qk433ibrlf
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15296: 24.3.50; A macro object does not necessarily have `lambda' as its cadr
  2013-09-07  5:39 bug#15296: 24.3.50; A macro object does not necessarily have `lambda' as its cadr Drew Adams
@ 2013-09-07 11:34 ` Michael Heerdegen
  2013-09-07 14:23   ` Drew Adams
  2013-09-08 18:01 ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Heerdegen @ 2013-09-07 11:34 UTC (permalink / raw)
  To: Drew Adams; +Cc: 15296

Drew Adams <drew.adams@oracle.com> writes:

> AFAICT, (elisp) `Defining Macros' is the closest thing we have to doc
> telling you how to test whether a Lisp object is a macro.  There is no
> `macro-p' predicate or similar in Emacs Lisp, unless I'm missing
> something.  (Shouldn't there be?)

There is `macrop' in subr.el (since some months ago, I think).

> Anyway, this Elisp manual node says that a macro is a list whose car
> is `macro' and whose `cdr' is a lambda expression.  That's not true if
> the `defmacro' was byte-compiled.

Confusing, indeed.


Michael.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15296: 24.3.50; A macro object does not necessarily have `lambda' as its cadr
  2013-09-07 11:34 ` Michael Heerdegen
@ 2013-09-07 14:23   ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2013-09-07 14:23 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 15296

> > AFAICT, (elisp) `Defining Macros' is the closest thing we have to doc
> > telling you how to test whether a Lisp object is a macro.  There is no
> > `macro-p' predicate or similar in Emacs Lisp, unless I'm missing
> > something.  (Shouldn't there be?)
> 
> There is `macrop' in subr.el (since some months ago, I think).

Wow, that's weird.  And thank you.  That was the first thing I looked for
(the second was `macro-p'), and for some reason I didn't find it (and I'm
using only a recent Emacs 24 build for this testing).

But you are right.  I must have somehow checked for that in a different
Emacs version.  Anyway, that solves my problem wrt testing the type.

> > Anyway, this Elisp manual node says that a macro is a list whose car
> > is `macro' and whose `cdr' is a lambda expression.  That's not true if
> > the `defmacro' was byte-compiled.
> 
> Confusing, indeed.

Not confusing, actually.  It's quite clear.  And wrong, unfortunately.
So AFAICT this should remain open for now, as a doc bug.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15296: 24.3.50; A macro object does not necessarily have `lambda' as its cadr
  2013-09-07  5:39 bug#15296: 24.3.50; A macro object does not necessarily have `lambda' as its cadr Drew Adams
  2013-09-07 11:34 ` Michael Heerdegen
@ 2013-09-08 18:01 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-09-08 18:01 UTC (permalink / raw)
  To: Drew Adams; +Cc: 15296-done

> `macro' and whose `cdr' is a lambda expression.  That's not true if the

I changed it to say "function" instead.


        Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-08 18:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-07  5:39 bug#15296: 24.3.50; A macro object does not necessarily have `lambda' as its cadr Drew Adams
2013-09-07 11:34 ` Michael Heerdegen
2013-09-07 14:23   ` Drew Adams
2013-09-08 18:01 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.