all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: emacs-devel@gnu.org
Subject: Re: commandp
Date: Fri, 27 Jul 2007 01:04:59 -0400	[thread overview]
Message-ID: <E1IEI0Z-0006RQ-58@fencepost.gnu.org> (raw)
In-Reply-To: <b4md4yfd1v5.fsf@jpl.org> (message from Katsumi Yamaoka on Thu, 26 Jul 2007 17:07:41 +0900)

    In the latest Emacs trunk the built-in function `commandp' returns
    t or nil while it returned an interactive form or nil formerly.
    Because of this, `defadvice' makes interactive Lisp functions non-
    interactive.

I don't think that is entirely accurate.  In Emacs 21.4. (commandp
'forward-char) and (commandp 'next-line) both return t, and they still
do.

I think, rather, that its return value may be t or the interactive
spec, in all Emacs versions.  This is not a bug, since the documentation
says only that the value for a command is non-nil.

It seems a change occurred in its behavior recently, and this caused a
bug in advice.  We need to fix this bug somehow.  Making commandp
return the interactive spec for noncompiled functions written in Lisp
is one way.

But it might be cleaner to make advice.el call `interactive-form'
instead.  Does that work?

Would someone please DTRT, then ack?


Date: Thu, 26 Jul 2007 17:07:41 +0900
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: emacs-pretest-bug@gnu.org
Organization: Emacsen advocacy group
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: commandp

Hi,

In the latest Emacs trunk the built-in function `commandp' returns
t or nil while it returned an interactive form or nil formerly.
Because of this, `defadvice' makes interactive Lisp functions non-
interactive.  See the `ad-interactive-form' function.  Here is
an example of what it causes:

(defun foo ()
  (interactive)
  (message "Hello"))
 => foo

(commandp 'foo)
 => t

(let ((ad-default-compilation-action 'never))
  (defadvice foo (around testing activate)
    "testing"
    (message "Good-bye")))
 => foo

(commandp 'foo)
 => nil

(pp (symbol-function 'foo))
 => (lambda nil
      "$ad-doc: foo$"
      t
      (let (ad-return-value)
	(message "Good-bye")
	ad-return-value))

Regards,


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

       reply	other threads:[~2007-07-27  5:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b4md4yfd1v5.fsf@jpl.org>
2007-07-27  5:04 ` Richard Stallman [this message]
2007-07-27  6:37   ` commandp Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1IEI0Z-0006RQ-58@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=yamaoka@jpl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.