all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: raman <raman@google.com>
To: emacs-devel@gnu.org
Subject: Suggest: dont declare interactive-p obsolete
Date: Wed, 18 Nov 2015 17:57:49 -0800	[thread overview]
Message-ID: <p91a8qasqci.fsf@google.com> (raw)

This is a minor change -- that will let existing code run without
warnings.
If we turned the defun in subr.el to  a defsubst and dropped the 
(declare (obsolete called-interactively-p "23.2"))
  (called-interactively-p 'interactive))
-- 
we'd lose nothing as far as I can tell, but eliminate  the warning ---
and keep code more readable --
(when  (interactive-p)...)
is arguably more readable than 
(when (called-interactively-p 'interactive) ...)

At present   subr.el defines:

(defun interactive-p ()
  "Return t if the containing function was run directly by user input.
This means that the function was called with `call-interactively'
\(which includes being called as the binding of a key)
and input is currently coming from the keyboard (not a keyboard macro),
and Emacs is not running in batch mode (`noninteractive' is nil).

The only known proper use of `interactive-p' is in deciding whether to
display a helpful message, or how to display it.  If you're thinking
of using it for any other purpose, it is quite likely that you're
making a mistake.  Think: what do you want to do when the command is
called from a keyboard macro or in batch mode?

To test whether your function was called with `call-interactively',
either (i) add an extra optional argument and give it an `interactive'
spec that specifies non-nil unconditionally (such as \"p\"); or (ii)
use `called-interactively-p'."
  (declare (obsolete called-interactively-p "23.2"))
  (called-interactively-p 'interactive))
-- 



             reply	other threads:[~2015-11-19  1:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19  1:57 raman [this message]
2015-11-19  4:16 ` Suggest: dont declare interactive-p obsolete John Wiegley
2015-11-19  8:39   ` Artur Malabarba
2015-11-19 13:06     ` Andreas Röhler
2015-11-19 13:46       ` Dmitry Gutov
2015-11-20  7:29         ` Andreas Röhler
2015-11-19 13:44     ` Dmitry Gutov
2015-11-19 15:29   ` Eli Zaretskii
2015-11-19 16:25     ` John Wiegley
2015-11-19 17:32       ` raman
2015-11-19 17:47         ` Eli Zaretskii

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=p91a8qasqci.fsf@google.com \
    --to=raman@google.com \
    --cc=emacs-devel@gnu.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.