aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-11-02 09:22:16 +0000
committerRichard M. Stallman2004-11-02 09:22:16 +0000
commit086af77cf525ef51c8f15ef2b1c3673c86eea5ff (patch)
treeb14be17bb544358ee10575829d2b778e10e1dac7
parentf7ed02acc78d750509dd302014adec42ea8453d1 (diff)
downloademacs-086af77cf525ef51c8f15ef2b1c3673c86eea5ff.tar.gz
emacs-086af77cf525ef51c8f15ef2b1c3673c86eea5ff.zip
(byte-compile-warning-types): Add interactive-only.
(byte-compile-warnings): Add interactive-only as option. (byte-compile-interactive-only-functions): New variable. (byte-compile-form): Warn about calls to functions in byte-compile-interactive-only-functions.
-rw-r--r--lisp/emacs-lisp/bytecomp.el22
1 files changed, 19 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 118352937bd..2116cc33b34 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -98,6 +98,9 @@
98;; `obsolete' (obsolete variables and functions) 98;; `obsolete' (obsolete variables and functions)
99;; `noruntime' (calls to functions only defined 99;; `noruntime' (calls to functions only defined
100;; within `eval-when-compile') 100;; within `eval-when-compile')
101;; `cl-warnings' (calls to CL functions)
102;; `interactive-only' (calls to commands that are
103;; not good to call from Lisp)
101;; byte-compile-compatibility Whether the compiler should 104;; byte-compile-compatibility Whether the compiler should
102;; generate .elc files which can be loaded into 105;; generate .elc files which can be loaded into
103;; generic emacs 18. 106;; generic emacs 18.
@@ -325,7 +328,8 @@ If it is 'byte, then only byte-level optimizations will be logged."
325 :type 'boolean) 328 :type 'boolean)
326 329
327(defconst byte-compile-warning-types 330(defconst byte-compile-warning-types
328 '(redefine callargs free-vars unresolved obsolete noruntime cl-functions) 331 '(redefine callargs free-vars unresolved
332 obsolete noruntime cl-functions interactive-only)
329 "The list of warning types used when `byte-compile-warnings' is t.") 333 "The list of warning types used when `byte-compile-warnings' is t.")
330(defcustom byte-compile-warnings t 334(defcustom byte-compile-warnings t
331 "*List of warnings that the byte-compiler should issue (t for all). 335 "*List of warnings that the byte-compiler should issue (t for all).
@@ -341,13 +345,21 @@ Elements of the list may be be:
341 noruntime functions that may not be defined at runtime (typically 345 noruntime functions that may not be defined at runtime (typically
342 defined only under `eval-when-compile'). 346 defined only under `eval-when-compile').
343 cl-functions calls to runtime functions from the CL package (as 347 cl-functions calls to runtime functions from the CL package (as
344 distinguished from macros and aliases)." 348 distinguished from macros and aliases).
349 interactive-only
350 commands that normally shouldn't be called from Lisp code."
345 :group 'bytecomp 351 :group 'bytecomp
346 :type `(choice (const :tag "All" t) 352 :type `(choice (const :tag "All" t)
347 (set :menu-tag "Some" 353 (set :menu-tag "Some"
348 (const free-vars) (const unresolved) 354 (const free-vars) (const unresolved)
349 (const callargs) (const redefine) 355 (const callargs) (const redefine)
350 (const obsolete) (const noruntime) (const cl-functions)))) 356 (const obsolete) (const noruntime)
357 (const cl-functions) (const interactive-only))))
358
359(defvar byte-compile-interactive-only-functions
360 '(beginning-of-buffer end-of-buffer replace-string replace-regexp
361 insert-file)
362 "List of commands that are not meant to be called from Lisp.")
351 363
352(defvar byte-compile-not-obsolete-var nil 364(defvar byte-compile-not-obsolete-var nil
353 "If non-nil, this is a variable that shouldn't be reported as obsolete.") 365 "If non-nil, this is a variable that shouldn't be reported as obsolete.")
@@ -2710,6 +2722,10 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2710 (byte-compile-set-symbol-position fn) 2722 (byte-compile-set-symbol-position fn)
2711 (when (byte-compile-const-symbol-p fn) 2723 (when (byte-compile-const-symbol-p fn)
2712 (byte-compile-warn "`%s' called as a function" fn)) 2724 (byte-compile-warn "`%s' called as a function" fn))
2725 (and (memq 'interactive-only byte-compile-warnings)
2726 (memq (car form) byte-compile-interactive-only-functions)
2727 (byte-compile-warn "`%s' used from Lisp code\n\
2728That command is designed for interactive use only" fn))
2713 (if (and handler 2729 (if (and handler
2714 (or (not (byte-compile-version-cond 2730 (or (not (byte-compile-version-cond
2715 byte-compile-compatibility)) 2731 byte-compile-compatibility))