1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00

Make the interactive-only' bytecomp warning like the obsolete' one

* emacs-lisp/bytecomp.el (byte-compile-form):
Make the `interactive-only' warning like the `obsolete' one.

* comint.el (comint-run):
* files.el (insert-file-literally, insert-file):
* replace.el (replace-string, replace-regexp):
* simple.el (beginning-of-buffer, end-of-buffer, delete-backward-char)
(goto-line, insert-buffer, next-line, previous-line):
Tweak `interactive-only' spec.
This commit is contained in:
Glenn Morris 2013-11-30 00:42:28 -08:00
parent 44ad1cf760
commit 3e2fb4db3f
6 changed files with 34 additions and 21 deletions

View file

@ -2930,18 +2930,22 @@ for symbols generated by the byte compiler itself."
((symbolp (car form))
(let* ((fn (car form))
(handler (get fn 'byte-compile))
(interactive-only (or (get fn 'interactive-only)
(memq fn byte-compile-interactive-only-functions))))
(interactive-only
(or (get fn 'interactive-only)
(memq fn byte-compile-interactive-only-functions))))
(when (macroexp--const-symbol-p fn)
(byte-compile-warn "`%s' called as a function" fn))
(when (and (byte-compile-warning-enabled-p 'interactive-only)
interactive-only)
(byte-compile-warn "`%s' used from Lisp code\n\
That command is designed for interactive use only.\n%s"
fn
(if (stringp interactive-only)
interactive-only
"Consult the documentation for an alternative")))
(byte-compile-warn "`%s' is for interactive use only%s"
fn
(cond ((stringp interactive-only)
(format "; %s" interactive-only))
((and (symbolp 'interactive-only)
(not (eq interactive-only t)))
(format "; use `%s' instead."
interactive-only))
(t "."))))
(if (and (fboundp (car form))
(eq (car-safe (symbol-function (car form))) 'macro))
(byte-compile-log-warning