unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Suggest: dont declare interactive-p obsolete
@ 2015-11-19  1:57 raman
  2015-11-19  4:16 ` John Wiegley
  0 siblings, 1 reply; 11+ messages in thread
From: raman @ 2015-11-19  1:57 UTC (permalink / raw)
  To: emacs-devel

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))
-- 



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

end of thread, other threads:[~2015-11-20  7:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19  1:57 Suggest: dont declare interactive-p obsolete raman
2015-11-19  4:16 ` 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).