* lisp/emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions):
[bpt/emacs.git] / lisp / emacs-lisp / bytecomp.el
index e0d474b..faa72e7 100644 (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)