1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-07 15:00:34 -08:00

* lisp/emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions):

Mark as obsolete and replace it with a symbol property.
(byte-compile-form): Use new 'interactive-only property.
* lisp/comint.el, lisp/files.el, lisp/replace.el, lisp/simple.el:
Apply new 'interactive-only properly.
This commit is contained in:
Bozhidar Batsov 2013-11-25 19:16:32 +02:00
parent 0013943516
commit 2bb3a748b3
7 changed files with 43 additions and 10 deletions

View file

@ -353,11 +353,11 @@ else the global value will be modified."
(t
(append byte-compile-warnings (list warning)))))))
(defvar byte-compile-interactive-only-functions
'(beginning-of-buffer end-of-buffer replace-string replace-regexp
insert-file insert-buffer insert-file-literally previous-line next-line
goto-line comint-run delete-backward-char)
(defvar byte-compile-interactive-only-functions nil
"List of commands that are not meant to be called from Lisp.")
(make-obsolete-variable 'byte-compile-interactive-only-functions
"use the `interactive-only' symbol property instead"
"24.4")
(defvar byte-compile-not-obsolete-vars nil
"List of variables that shouldn't be reported as obsolete.")
@ -2929,13 +2929,19 @@ for symbols generated by the byte compiler itself."
(byte-compile-variable-ref form))))
((symbolp (car form))
(let* ((fn (car form))
(handler (get fn 'byte-compile)))
(handler (get fn 'byte-compile))
(interactive-onaly (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))
(and (byte-compile-warning-enabled-p 'interactive-only)
(memq fn byte-compile-interactive-only-functions)
(byte-compile-warn "`%s' used from Lisp code\n\
That command is designed for interactive use only" 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")))
(if (and (fboundp (car form))
(eq (car-safe (symbol-function (car form))) 'macro))
(byte-compile-log-warning
@ -3598,7 +3604,7 @@ discarding."
(byte-compile-constant (if (eq 'lambda (car-safe f))
(byte-compile-lambda f)
f))))
(defun byte-compile-indent-to (form)
(let ((len (length form)))
(cond ((= len 2)