summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/byte-opt.el16
-rw-r--r--lisp/emacs-lisp/debug.el24
-rw-r--r--lisp/emacs-lisp/derived.el2
-rw-r--r--lisp/emacs-lisp/edebug.el13
-rw-r--r--lisp/emacs-lisp/elint.el4
-rw-r--r--lisp/emacs-lisp/lisp-mode.el17
-rw-r--r--lisp/emacs-lisp/lisp.el2
-rw-r--r--lisp/emacs-lisp/regexp-opt.el2
-rw-r--r--lisp/emacs-lisp/ring.el9
-rw-r--r--lisp/emacs-lisp/warnings.el23
10 files changed, 82 insertions, 30 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index be496585f71..b8c2499c6c4 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -152,11 +152,11 @@
;; ;; Associative math should recognize subcalls to identical function:
;; (disassemble (lambda (x) (+ (+ (foo) 1) (+ (bar) 2))))
;; ;; This should generate the same as (1+ x) and (1- x)
-
+
;; (disassemble (lambda (x) (cons (+ x 1) (- x 1))))
;; ;; An awful lot of functions always return a non-nil value. If they're
;; ;; error free also they may act as true-constants.
-
+
;; (disassemble (lambda (x) (and (point) (foo))))
;; ;; When
;; ;; - all but one arguments to a function are constant
@@ -165,19 +165,19 @@
;; ;; condition is side-effect-free [assignment-free] then the other
;; ;; arguments may be any expressions. Since, however, the code size
;; ;; can increase this way they should be "simple". Compare:
-
+
;; (disassemble (lambda (x) (eq (if (point) 'a 'b) 'c)))
;; (disassemble (lambda (x) (if (point) (eq 'a 'c) (eq 'b 'c))))
-
+
;; ;; (car (cons A B)) -> (prog1 A B)
;; (disassemble (lambda (x) (car (cons (foo) 42))))
-
+
;; ;; (cdr (cons A B)) -> (progn A B)
;; (disassemble (lambda (x) (cdr (cons 42 (foo)))))
-
+
;; ;; (car (list A B ...)) -> (prog1 A B ...)
;; (disassemble (lambda (x) (car (list (foo) 42 (bar)))))
-
+
;; ;; (cdr (list A B ...)) -> (progn A (list B ...))
;; (disassemble (lambda (x) (cdr (list 42 (foo) (bar)))))
@@ -1126,7 +1126,7 @@
This assumes that the function will not have any side-effects and that
its return value depends solely on its arguments.
If the function can signal an error, this might change the semantics
-of FORM by signalling the error at compile-time."
+of FORM by signaling the error at compile-time."
(let ((args (cdr form))
(constant t))
(while (and args constant)
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 0ee67355bf4..e543932d8b4 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -653,6 +653,12 @@ functions to break on entry."
nil
(funcall debugger 'debug)))
+(defun debugger-special-form-p (symbol)
+ "Return whether SYMBOL is a special form."
+ (and (fboundp symbol)
+ (subrp (symbol-function symbol))
+ (eq (cdr (subr-arity (symbol-function symbol))) 'unevalled)))
+
;;;###autoload
(defun debug-on-entry (function)
"Request FUNCTION to invoke debugger each time it is called.
@@ -668,9 +674,21 @@ primitive functions only works when that function is called from Lisp.
Use \\[cancel-debug-on-entry] to cancel the effect of this command.
Redefining FUNCTION also cancels it."
- (interactive "aDebug on entry (to function): ")
- (when (and (subrp (symbol-function function))
- (eq (cdr (subr-arity (symbol-function function))) 'unevalled))
+ (interactive
+ (let ((fn (function-called-at-point)) val)
+ (when (debugger-special-form-p fn)
+ (setq fn nil))
+ (setq val (completing-read
+ (if fn
+ (format "Debug on entry to function (default %s): " fn)
+ "Debug on entry to function: ")
+ obarray
+ #'(lambda (symbol)
+ (and (fboundp symbol)
+ (not (debugger-special-form-p symbol))))
+ t nil nil (symbol-name fn)))
+ (list (if (equal val "") fn (intern val)))))
+ (when (debugger-special-form-p function)
(error "Function %s is a special form" function))
(if (or (symbolp (symbol-function function))
(subrp (symbol-function function)))
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 943f052fc6d..006b6f2c588 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -320,7 +320,7 @@ which more-or-less shadow %s's corresponding tables."
;;;###autoload
(defun derived-mode-init-mode-variables (mode)
- "Initialise variables for a new MODE.
+ "Initialize variables for a new MODE.
Right now, if they don't already exist, set up a blank keymap, an
empty syntax table, and an empty abbrev table -- these will be merged
the first time the mode is used."
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 54325c87b6d..ebe375088a3 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -511,9 +511,16 @@ the minibuffer."
(set-default (nth 1 form) (eval (nth 2 form))))
((eq (car form) 'defface)
;; Reset the face.
- (put (nth 1 form) 'face-defface-spec nil)
(setq face-new-frame-defaults
- (assq-delete-all (nth 1 form) face-new-frame-defaults))))
+ (assq-delete-all (nth 1 form) face-new-frame-defaults))
+ (put (nth 1 form) 'face-defface-spec nil)
+ ;; See comments in `eval-defun-1' for purpose of code below
+ (setq form (prog1 `(prog1 ,form
+ (put ',(nth 1 form) 'saved-face
+ ',(get (nth 1 form) 'saved-face))
+ (put ',(nth 1 form) 'customized-face
+ ',(nth 2 form)))
+ (put (nth 1 form) 'saved-face nil)))))
(setq edebug-result (eval form))
(if (not edebugging)
(princ edebug-result)
@@ -3323,7 +3330,7 @@ With prefix ARG, set temporary break at current point and go."
(defun edebug-goto-here ()
- "Proceed to this stop point."
+ "Proceed to first stop-point at or after current position of point."
(interactive)
(edebug-go-mode t))
diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el
index d4967a7cd06..806fa8e6854 100644
--- a/lisp/emacs-lisp/elint.el
+++ b/lisp/emacs-lisp/elint.el
@@ -66,7 +66,7 @@
left-margin left-margin-width line-spacing local-abbrev-table local-write-file-hooks major-mode
mark-active mark-ring mode-line-buffer-identification
mode-line-format mode-line-modified mode-line-process mode-name
- overwrite-mode
+ overwrite-mode
point-before-scroll right-fringe-width right-margin-width
scroll-bar-width scroll-down-aggressively scroll-up-aggressively selective-display
selective-display-ellipses tab-width truncate-lines vc-mode vertical-scroll-bar)
@@ -298,7 +298,7 @@ Return nil if there are no more forms, t otherwise."
(not (eobp)))
(defun elint-init-env (forms)
- "Initialise the environment from FORMS."
+ "Initialize the environment from FORMS."
(let ((env (elint-make-env))
form)
(while forms
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 72924417109..1ffc33835e9 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -617,10 +617,23 @@ Reinitialize the face according to the `defface' specification."
;; `defface' is macroexpanded to `custom-declare-face'.
((eq (car form) 'custom-declare-face)
;; Reset the face.
- (put (eval (nth 1 form)) 'face-defface-spec nil)
(setq face-new-frame-defaults
(assq-delete-all (eval (nth 1 form)) face-new-frame-defaults))
- form)
+ (put (eval (nth 1 form)) 'face-defface-spec nil)
+ ;; Setting `customized-face' to the new spec after calling
+ ;; the form, but preserving the old saved spec in `saved-face',
+ ;; imitates the situation when the new face spec is set
+ ;; temporarily for the current session in the customize
+ ;; buffer, thus allowing `face-user-default-spec' to use the
+ ;; new customized spec instead of the saved spec.
+ ;; Resetting `saved-face' temporarily to nil is needed to let
+ ;; `defface' change the spec, regardless of a saved spec.
+ (prog1 `(prog1 ,form
+ (put ',(eval (nth 1 form)) 'saved-face
+ ',(get (eval (nth 1 form)) 'saved-face))
+ (put ',(eval (nth 1 form)) 'customized-face
+ ',(eval (nth 2 form))))
+ (put (eval (nth 1 form)) 'saved-face nil)))
((eq (car form) 'progn)
(cons 'progn (mapcar 'eval-defun-1 (cdr form))))
(t form)))
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 955bc4499bc..a14c4815374 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -489,7 +489,7 @@ More accurately, check the narrowed part of the buffer for unbalanced
expressions (\"sexps\") in general. This is done according to the
current syntax table and will find unbalanced brackets or quotes as
appropriate. (See Info node `(emacs)Parentheses'.) If imbalance is
-found, an error is signalled and point is left at the first unbalanced
+found, an error is signaled and point is left at the first unbalanced
character."
(interactive)
(condition-case data
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index ef6efdcc8ca..a5293f2684c 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -116,7 +116,7 @@ by \\=\\< and \\>."
(defun regexp-opt-depth (regexp)
"Return the depth of REGEXP.
This means the number of non-shy regexp grouping constructs
-\(parenthesised expressions) in REGEXP."
+\(parenthesized expressions) in REGEXP."
(save-match-data
;; Hack to signal an error if REGEXP does not have balanced parentheses.
(string-match regexp "")
diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el
index fce07953ba9..6e0f9cd70b4 100644
--- a/lisp/emacs-lisp/ring.el
+++ b/lisp/emacs-lisp/ring.el
@@ -155,8 +155,13 @@ will be performed."
(aref vec (ring-index index hd ln (length vec))))))
(defun ring-elements (ring)
- "Return a list of the elements of RING."
- (mapcar #'identity (cddr ring)))
+ "Return a list of the elements of RING, in order, newest first."
+ (let ((start (car ring))
+ (size (ring-size ring))
+ (vect (cddr ring))
+ lst)
+ (dotimes (var (cadr ring) lst)
+ (push (aref vect (mod (+ start var) size)) lst))))
;;; provide ourself:
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 343eda970ce..e6c3447331e 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -76,16 +76,20 @@ If a warning's severity level is lower than this,
the warning is logged in the warnings buffer, but the buffer
is not immediately displayed. See also `warning-minimum-log-level'."
:group 'warnings
- :type '(choice (const :emergency) (const :error) (const :warning))
+ :type '(choice (const :emergency) (const :error)
+ (const :warning) (const :debug))
:version "22.1")
(defvaralias 'display-warning-minimum-level 'warning-minimum-level)
(defcustom warning-minimum-log-level :warning
"Minimum severity level for logging a warning.
If a warning severity level is lower than this,
-the warning is completely ignored."
+the warning is completely ignored.
+Value must be lower or equal than `warning-minimum-level',
+because warnings not logged aren't displayed either."
:group 'warnings
- :type '(choice (const :emergency) (const :error) (const :warning))
+ :type '(choice (const :emergency) (const :error)
+ (const :warning) (const :debug))
:version "22.1")
(defvaralias 'log-warning-minimum-level 'warning-minimum-log-level)
@@ -203,7 +207,9 @@ or a list of symbols whose first element is a custom group name.
\(The rest of the symbols represent subcategories, for warning purposes
only, and you can use whatever symbols you like.)
-LEVEL should be either :warning, :error, or :emergency.
+LEVEL should be either :debug, :warning, :error, or :emergency
+\(but see `warning-minimum-level' and `warning-minimum-log-level').
+
:emergency -- a problem that will seriously impair Emacs operation soon
if you do not attend to it promptly.
:error -- data or circumstances that are inherently wrong.
@@ -223,7 +229,7 @@ See also `warning-series', `warning-prefix-function' and
(if (assq level warning-level-aliases)
(setq level (cdr (assq level warning-level-aliases))))
(or (< (warning-numeric-level level)
- (warning-numeric-level warning-minimum-log-level))
+ (warning-numeric-level warning-minimum-log-level))
(warning-suppress-p type warning-suppress-log-types)
(let* ((typename (if (consp type) (car type) type))
(buffer (get-buffer-create (or buffer-name "*Warnings*")))
@@ -291,11 +297,14 @@ or a list of symbols whose first element is a custom group name.
\(The rest of the symbols represent subcategories and
can be whatever you like.)
-LEVEL should be either :warning, :error, or :emergency.
+LEVEL should be either :debug, :warning, :error, or :emergency
+\(but see `warning-minimum-level' and `warning-minimum-log-level').
+
:emergency -- a problem that will seriously impair Emacs operation soon
if you do not attend to it promptly.
:error -- invalid data or circumstances.
-:warning -- suspicious data or circumstances."
+:warning -- suspicious data or circumstances.
+:debug -- info for debugging only."
(display-warning type (apply 'format message args) level))
;;;###autoload