summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/advice.el2
-rw-r--r--lisp/emacs-lisp/autoload.el11
-rw-r--r--lisp/emacs-lisp/bytecomp.el22
-rw-r--r--lisp/emacs-lisp/easy-mmode.el2
-rw-r--r--lisp/emacs-lisp/easymenu.el20
-rw-r--r--lisp/emacs-lisp/elp.el2
-rw-r--r--lisp/emacs-lisp/lselect.el16
7 files changed, 56 insertions, 19 deletions
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 7686722c5be..cfaac96bbb1 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -3106,7 +3106,7 @@ in any of these classes."
(not advised-interactive-form))
;; Check whether we were called interactively
;; in order to do proper prompting:
- `(if (interactive-p)
+ `(if (called-interactively-p)
(call-interactively ',origname)
,(ad-make-mapped-call orig-arglist
advised-arglist
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 5a5eb55a2a2..196786e9179 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -360,11 +360,14 @@ are used."
(message "Generating autoloads for %s...done" file)))
;;;###autoload
-(defun update-file-autoloads (file)
+(defun update-file-autoloads (file &optional save-after)
"Update the autoloads for FILE in `generated-autoload-file'
\(which FILE might bind in its local variables).
-Return FILE if there was no autoload cookie in it."
- (interactive "fUpdate autoloads for file: ")
+If SAVE-AFTER is non-nil (which is always, when called interactively),
+save the buffer too.
+
+Return FILE if there was no autoload cookie in it, else nil."
+ (interactive "fUpdate autoloads for file: \np")
(let ((load-name (let ((name (file-name-nondirectory file)))
(if (string-match "\\.elc?\\(\\.\\|$\\)" name)
(substring name 0 (match-beginning 0))
@@ -464,7 +467,7 @@ Autoload section for %s is up to date."
(or existing-buffer
(kill-buffer (current-buffer))))))))
(generate-file-autoloads file))))
- (and (interactive-p)
+ (and save-after
(buffer-modified-p)
(save-buffer))
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 846f3efd2ee..da1e5fba8b2 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -98,6 +98,9 @@
;; `obsolete' (obsolete variables and functions)
;; `noruntime' (calls to functions only defined
;; within `eval-when-compile')
+;; `cl-warnings' (calls to CL functions)
+;; `interactive-only' (calls to commands that are
+;; not good to call from Lisp)
;; byte-compile-compatibility Whether the compiler should
;; generate .elc files which can be loaded into
;; generic emacs 18.
@@ -325,7 +328,8 @@ If it is 'byte, then only byte-level optimizations will be logged."
:type 'boolean)
(defconst byte-compile-warning-types
- '(redefine callargs free-vars unresolved obsolete noruntime cl-functions)
+ '(redefine callargs free-vars unresolved
+ obsolete noruntime cl-functions interactive-only)
"The list of warning types used when `byte-compile-warnings' is t.")
(defcustom byte-compile-warnings t
"*List of warnings that the byte-compiler should issue (t for all).
@@ -341,13 +345,21 @@ Elements of the list may be be:
noruntime functions that may not be defined at runtime (typically
defined only under `eval-when-compile').
cl-functions calls to runtime functions from the CL package (as
- distinguished from macros and aliases)."
+ distinguished from macros and aliases).
+ interactive-only
+ commands that normally shouldn't be called from Lisp code."
:group 'bytecomp
:type `(choice (const :tag "All" t)
(set :menu-tag "Some"
(const free-vars) (const unresolved)
(const callargs) (const redefine)
- (const obsolete) (const noruntime) (const cl-functions))))
+ (const obsolete) (const noruntime)
+ (const cl-functions) (const interactive-only))))
+
+(defvar byte-compile-interactive-only-functions
+ '(beginning-of-buffer end-of-buffer replace-string replace-regexp
+ insert-file)
+ "List of commands that are not meant to be called from Lisp.")
(defvar byte-compile-not-obsolete-var nil
"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."
(byte-compile-set-symbol-position fn)
(when (byte-compile-const-symbol-p fn)
(byte-compile-warn "`%s' called as a function" fn))
+ (and (memq 'interactive-only byte-compile-warnings)
+ (memq (car form) byte-compile-interactive-only-functions)
+ (byte-compile-warn "`%s' used from Lisp code\n\
+That command is designed for interactive use only" fn))
(if (and handler
(or (not (byte-compile-version-cond
byte-compile-compatibility))
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 2439fdd4de6..b6b91710ed4 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -209,7 +209,7 @@ With zero or negative ARG turn mode off.
,@body
;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,mode ',hook-on ',hook-off))
- (if (interactive-p)
+ (if (called-interactively-p)
(progn
,(if globalp `(customize-mark-as-set ',mode))
(unless (current-message)
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index dbd7194f50a..e039b80aee5 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -42,7 +42,25 @@ menus, turn this variable off, otherwise it is probably better to keep it on."
:version "20.3")
(defsubst easy-menu-intern (s)
- (if (stringp s) (intern (downcase s)) s))
+ (if (stringp s)
+ (let ((copy (copy-sequence s))
+ (pos 0)
+ found)
+ ;; For each letter that starts a word, flip its case.
+ ;; This way, the usual convention for menu strings (capitalized)
+ ;; corresponds to the usual convention for menu item event types
+ ;; (all lower case). It's a 1-1 mapping so causes no conflicts.
+ (while (setq found (string-match "\\<\\sw" copy pos))
+ (setq pos (match-end 0))
+ (unless (= (upcase (aref copy found))
+ (downcase (aref copy found)))
+ (aset copy found
+ (if (= (upcase (aref copy found))
+ (aref copy found))
+ (downcase (aref copy found))
+ (upcase (aref copy found))))))
+ (intern copy))
+ s))
;;;###autoload
(put 'easy-menu-define 'lisp-indent-function 'defun)
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index 17991067fab..d701db9e9b6 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -257,7 +257,7 @@ FUNSYM must be a symbol of a defined function."
(setq newguts (append newguts `((elp-wrapper
(quote ,funsym)
,(when (commandp funsym)
- '(interactive-p))
+ '(called-interactively-p))
args))))
;; to record profiling times, we set the symbol's function
;; definition so that it runs the elp-wrapper function with the
diff --git a/lisp/emacs-lisp/lselect.el b/lisp/emacs-lisp/lselect.el
index b292eefbaec..42dad0c48d8 100644
--- a/lisp/emacs-lisp/lselect.el
+++ b/lisp/emacs-lisp/lselect.el
@@ -1,6 +1,6 @@
;;; lselect.el --- Lucid interface to X Selections
-;; Copyright (C) 1990, 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1993, 2004 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: emulations
@@ -146,7 +146,7 @@ secondary selection instead of the primary selection."
(x-disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY)))
(defun x-dehilight-selection (selection)
- "for use as a value of x-lost-selection-hooks."
+ "for use as a value of `x-lost-selection-functions'."
(cond ((eq selection 'PRIMARY)
(if primary-selection-extent
(let ((inhibit-quit t))
@@ -160,23 +160,23 @@ secondary selection instead of the primary selection."
(setq secondary-selection-extent nil)))))
nil)
-(setq x-lost-selection-hooks 'x-dehilight-selection)
+(setq x-lost-selection-functions 'x-dehilight-selection)
(defun x-notice-selection-requests (selection type successful)
- "for possible use as the value of x-sent-selection-hooks."
+ "for possible use as the value of `x-sent-selection-functions'."
(if (not successful)
(message "Selection request failed to convert %s to %s"
selection type)
(message "Sent selection %s as %s" selection type)))
(defun x-notice-selection-failures (selection type successful)
- "for possible use as the value of x-sent-selection-hooks."
+ "for possible use as the value of `x-sent-selection-functions'."
(or successful
(message "Selection request failed to convert %s to %s"
selection type)))
-;(setq x-sent-selection-hooks 'x-notice-selection-requests)
-;(setq x-sent-selection-hooks 'x-notice-selection-failures)
+;(setq x-sent-selection-functions 'x-notice-selection-requests)
+;(setq x-sent-selection-functions 'x-notice-selection-failures)
;; Random utility functions
@@ -232,5 +232,5 @@ the kill ring or the Clipboard."
(provide 'lselect)
-;;; arch-tag: 92fa54d4-c5d1-4e9b-ad58-cf1e13930556
+;; arch-tag: 92fa54d4-c5d1-4e9b-ad58-cf1e13930556
;;; lselect.el ends here