From: Bozhidar Batsov Date: Mon, 25 Nov 2013 17:16:32 +0000 (+0200) Subject: * lisp/emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions): X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~701 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2bb3a748b362f9635bd406b151b89d7981a0bdaa;p=emacs.git * 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. --- diff --git a/etc/NEWS b/etc/NEWS index 6cff14d2742..e46d0fdc61a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -795,6 +795,9 @@ The few hooks that used with-wrapper-hook are replaced as follows: *** `completion-in-region-function' obsoletes `completion-in-region-functions'. *** `filter-buffer-substring-function' obsoletes `filter-buffer-substring-functions'. +** `byte-compile-interactive-only-functions' is now obsolete. +It has been replaced by the symbol property 'interactive-only. + ** `split-string' now takes an optional argument TRIM. The value, if non-nil, is a regexp that specifies what to trim from the start and end of each substring. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3955784c03b..3622b1563ba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2013-11-25 Sebastian Wiesner (lunaryorn@gmail.com) + + * 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. + * comint.el, files.el, replace.el, simple.el: + Apply new 'interactive-only properly. + 2013-11-25 Martin Rudalics * window.el (display-buffer-at-bottom): Make sure that diff --git a/lisp/comint.el b/lisp/comint.el index 8e1b2105de3..3aff3137d74 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -752,6 +752,7 @@ See `make-comint' and `comint-exec'." (let ((name (file-name-nondirectory program))) (switch-to-buffer (make-comint name program)) (run-hooks (intern-soft (concat "comint-" name "-hook"))))) +(put 'comint-run 'interactive-only "Use `make-comint' instead") (defun comint-exec (buffer name command startfile switches) "Start up a process named NAME in buffer BUFFER for Comint modes. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e0d474bbb9f..faa72e73959 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -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) diff --git a/lisp/files.el b/lisp/files.el index d44401b4302..1fb253a893a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2085,6 +2085,8 @@ Don't call it from programs! Use `insert-file-contents-literally' instead. \(Its calling sequence is different; see its documentation)." (interactive "*fInsert file literally: ") (insert-file-1 filename #'insert-file-contents-literally)) +(put 'insert-file-literally 'interactive-only + "Use `insert-file-contents-literally' instead") (defvar find-file-literally nil "Non-nil if this buffer was made by `find-file-literally' or equivalent. @@ -5007,6 +5009,7 @@ Don't call it from programs! Use `insert-file-contents' instead. \(Its calling sequence is different; see its documentation)." (interactive "*fInsert file: ") (insert-file-1 filename #'insert-file-contents)) +(put 'insert-file 'interactive-only "Use `insert-file-contents' instead.") (defun append-to-file (start end filename) "Append the contents of the region to the end of file FILENAME. diff --git a/lisp/replace.el b/lisp/replace.el index 9d7aba333c4..0490af71358 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -523,6 +523,8 @@ and TO-STRING is also null.)" (if (and transient-mark-mode mark-active) (region-end))))) (perform-replace from-string to-string nil nil delimited nil nil start end)) +(put 'replace-string 'interactive-only + "Use `search-forward' and `replace-match' instead.") (defun replace-regexp (regexp to-string &optional delimited start end) "Replace things after point matching REGEXP with TO-STRING. @@ -590,6 +592,8 @@ which will run faster and will not set the mark or print anything." (if (and transient-mark-mode mark-active) (region-end))))) (perform-replace regexp to-string nil t delimited nil nil start end)) +(put 'replace-regexp 'interactive-only + "Use `re-search-forward' and `replace-match' instead.") (defvar regexp-history nil diff --git a/lisp/simple.el b/lisp/simple.el index ca2088eeb24..21ef9d2577e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -888,6 +888,7 @@ Don't use this command in Lisp programs! (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) (point-min)))) (if (and arg (not (consp arg))) (forward-line 1))) +(put 'beginning-of-buffer 'interactive-only "Use (goto-char (point-min)) instead") (defun end-of-buffer (&optional arg) "Move point to the end of the buffer. @@ -920,6 +921,7 @@ Don't use this command in Lisp programs! ;; then scroll specially to put it near, but not at, the bottom. (overlay-recenter (point)) (recenter -3)))) +(put 'end-of-buffer 'interactive-only "Use (goto-char (point-max)) instead") (defcustom delete-active-region t "Whether single-char deletion commands delete an active region. @@ -982,6 +984,7 @@ the end of the line." (insert-char ?\s (- ocol (current-column)) nil)))) ;; Otherwise, do simple deletion. (t (delete-char (- n) killflag)))) +(put 'delete-backward-char 'interactive-only "Use `delete-char' instead") (defun delete-forward-char (n &optional killflag) "Delete the following N characters (previous if N is negative). @@ -1079,6 +1082,7 @@ rather than line counts." (if (eq selective-display t) (re-search-forward "[\n\C-m]" nil 'end (1- line)) (forward-line (1- line))))) +(put 'goto-line 'interactive-only "Use `forward-line' instead") (defun count-words-region (start end &optional arg) "Count the number of words in the region. @@ -4165,6 +4169,7 @@ Don't call it from programs: use `insert-buffer-substring' instead!" (insert-buffer-substring (get-buffer buffer)) (point))) nil) +(put 'insert-buffer 'interactive-only "Use `insert-buffer-substring' instead") (defun append-to-buffer (buffer start end) "Append to specified buffer the text of the region. @@ -4763,6 +4768,7 @@ and more reliable (no dependence on goal column, etc.)." (signal (car err) (cdr err)))) (line-move arg nil nil try-vscroll))) nil) +(put 'next-line 'interactive-only "Use `forward-line' instead") (defun previous-line (&optional arg try-vscroll) "Move cursor vertically up ARG lines. @@ -4802,6 +4808,8 @@ to use and more reliable (no dependence on goal column, etc.)." (signal (car err) (cdr err)))) (line-move (- arg) nil nil try-vscroll)) nil) +(put 'previous-line 'interactive-only + "Use `forward-line' with negative argument instead") (defcustom track-eol nil "Non-nil means vertical motion starting at end of line keeps to ends of lines.