summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/advice.el7
-rw-r--r--lisp/emacs-lisp/byte-run.el28
-rw-r--r--lisp/emacs-lisp/bytecomp.el34
-rw-r--r--lisp/emacs-lisp/debug.el13
-rw-r--r--lisp/emacs-lisp/find-func.el6
-rw-r--r--lisp/emacs-lisp/lisp-mode.el5
6 files changed, 56 insertions, 37 deletions
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index ce727c30d14..dc285a717af 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -3109,8 +3109,8 @@ in any of these classes."
;; in order to do proper prompting:
`(if (called-interactively-p)
(call-interactively ',origname)
- ,(ad-make-mapped-call orig-arglist
- advised-arglist
+ ,(ad-make-mapped-call advised-arglist
+ orig-arglist
origname)))
;; And now for normal functions and non-interactive subrs
;; (or subrs whose interactive behavior was advised):
@@ -3812,6 +3812,7 @@ documentation of the advised function can be dumped onto the `DOC' file
during preloading.
See Info node `(elisp)Advising Functions' for comprehensive documentation."
+ (declare (doc-string 3))
(if (not (ad-name-p function))
(error "defadvice: Invalid function name: %s" function))
(let* ((class (car args))
@@ -3986,5 +3987,5 @@ Use only in REAL emergencies."
(provide 'advice)
-;;; arch-tag: 29f8c9a1-8c88-471f-95d7-e28541c6b7c0
+;; arch-tag: 29f8c9a1-8c88-471f-95d7-e28541c6b7c0
;;; advice.el ends here
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index c31036f02ed..1ebc8f765fa 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -50,6 +50,8 @@ The return value of this function is not used."
(put macro 'lisp-indent-function (car (cdr d))))
((and (consp d) (eq (car d) 'debug))
(put macro 'edebug-form-spec (car (cdr d))))
+ ((and (consp d) (eq (car d) 'doc-string))
+ (put macro 'doc-string-elt (car (cdr d))))
(t
(message "Unknown declaration %s" d))))))
@@ -126,6 +128,7 @@ is equivalent to the following two lines of code:
\(make-obsolete 'old-fun 'new-fun \"22.1\")
See the docstrings of `defalias' and `make-obsolete' for more details."
+ (declare (doc-string 4))
`(progn
(defalias ,obsolete-name ,current-name ,docstring)
(make-obsolete ,obsolete-name ,current-name ,when)))
@@ -158,9 +161,10 @@ is equivalent to the following two lines of code:
See the docstrings of `defvaralias' and `make-obsolete-variable' or
Info node `(elisp)Variable Aliases' for more details."
+ (declare (doc-string 4))
`(progn
(defvaralias ,obsolete-name ,current-name ,docstring)
- (make-obsolete-variable ,obsolete-name ,current-name ,when)))
+ (make-obsolete-variable ,obsolete-name ,current-name ,when)))
(defmacro dont-compile (&rest body)
"Like `progn', but the body always runs interpreted (not compiled).
@@ -169,10 +173,10 @@ If you think you need this, you're probably making a mistake somewhere."
(list 'eval (list 'quote (if (cdr body) (cons 'progn body) (car body)))))
-;;; interface to evaluating things at compile time and/or load time
-;;; these macro must come after any uses of them in this file, as their
-;;; definition in the file overrides the magic definitions on the
-;;; byte-compile-macro-environment.
+;; interface to evaluating things at compile time and/or load time
+;; these macro must come after any uses of them in this file, as their
+;; definition in the file overrides the magic definitions on the
+;; byte-compile-macro-environment.
(defmacro eval-when-compile (&rest body)
"Like `progn', but evaluates the body at compile time if you're compiling.
@@ -196,12 +200,12 @@ In interpreted code, this is entirely equivalent to `progn'."
(car (last body)))
-;;; I nuked this because it's not a good idea for users to think of using it.
-;;; These options are a matter of installation preference, and have nothing to
-;;; with particular source files; it's a mistake to suggest to users
-;;; they should associate these with particular source files.
-;;; There is hardly any reason to change these parameters, anyway.
-;;; --rms.
+;; I nuked this because it's not a good idea for users to think of using it.
+;; These options are a matter of installation preference, and have nothing to
+;; with particular source files; it's a mistake to suggest to users
+;; they should associate these with particular source files.
+;; There is hardly any reason to change these parameters, anyway.
+;; --rms.
;; (put 'byte-compiler-options 'lisp-indent-function 0)
;; (defmacro byte-compiler-options (&rest args)
@@ -227,5 +231,5 @@ In interpreted code, this is entirely equivalent to `progn'."
;; (file-format emacs19))"
;; nil)
-;;; arch-tag: 76f8328a-1f66-4df2-9b6d-5c3666dc05e9
+;; arch-tag: 76f8328a-1f66-4df2-9b6d-5c3666dc05e9
;;; byte-run.el ends here
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 559d2bd86c6..47bcbbcae6c 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -908,6 +908,13 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
;; list. If our current position is after the symbol's position, we
;; assume we've already passed that point, and look for the next
;; occurrence of the symbol.
+;;
+;; This function should not be called twice for the same occurrence of
+;; a symbol, and it should not be called for symbols generated by the
+;; byte compiler itself; because rather than just fail looking up the
+;; symbol, we may find an occurrence of the symbol further ahead, and
+;; then `byte-compile-last-position' as advanced too far.
+;;
;; So your're probably asking yourself: Isn't this function a
;; gross hack? And the answer, of course, would be yes.
(defun byte-compile-set-symbol-position (sym &optional allow-previous)
@@ -2304,7 +2311,7 @@ list that represents a doc string reference.
',name ',declaration))
outbuffer)))))
- (let* ((new-one (byte-compile-lambda (cons 'lambda (nthcdr 2 form))))
+ (let* ((new-one (byte-compile-lambda (nthcdr 2 form) t))
(code (byte-compile-byte-code-maker new-one)))
(if this-one
(setcdr this-one new-one)
@@ -2500,10 +2507,16 @@ If FORM is a lambda or a macro, byte-compile it as a function."
;; Byte-compile a lambda-expression and return a valid function.
;; The value is usually a compiled function but may be the original
;; lambda-expression.
-(defun byte-compile-lambda (fun)
- (unless (eq 'lambda (car-safe fun))
- (error "Not a lambda list: %S" fun))
- (byte-compile-set-symbol-position 'lambda)
+;; When ADD-LAMBDA is non-nil, the symbol `lambda' is added as head
+;; of the list FUN and `byte-compile-set-symbol-position' is not called.
+;; Use this feature to avoid calling `byte-compile-set-symbol-position'
+;; for symbols generated by the byte compiler itself.
+(defun byte-compile-lambda (fun &optional add-lambda)
+ (if add-lambda
+ (setq fun (cons 'lambda fun))
+ (unless (eq 'lambda (car-safe fun))
+ (error "Not a lambda list: %S" fun))
+ (byte-compile-set-symbol-position 'lambda))
(byte-compile-check-lambda-list (nth 1 fun))
(let* ((arglist (nth 1 fun))
(byte-compile-bound-variables
@@ -2755,9 +2768,7 @@ That command is designed for interactive use only" fn))
(or (not (byte-compile-version-cond
byte-compile-compatibility))
(not (get (get fn 'byte-opcode) 'emacs19-opcode))))
- (progn
- (byte-compile-set-symbol-position fn)
- (funcall handler form))
+ (funcall handler form)
(when (memq 'callargs byte-compile-warnings)
(if (memq fn '(custom-declare-group custom-declare-variable custom-declare-face))
(byte-compile-nogroup-warn form))
@@ -3671,7 +3682,7 @@ that suppresses all warnings during execution of BODY."
(list 'fset
(list 'quote (nth 1 form))
(byte-compile-byte-code-maker
- (byte-compile-lambda (cons 'lambda (cdr (cdr form)))))))
+ (byte-compile-lambda (cdr (cdr form)) t))))
(byte-compile-discard))
;; We prefer to generate a defalias form so it will record the function
;; definition just like interpreting a defun.
@@ -3679,7 +3690,7 @@ that suppresses all warnings during execution of BODY."
(list 'defalias
(list 'quote (nth 1 form))
(byte-compile-byte-code-maker
- (byte-compile-lambda (cons 'lambda (cdr (cdr form))))))
+ (byte-compile-lambda (cdr (cdr form)) t)))
t))
(byte-compile-constant (nth 1 form)))
@@ -3688,8 +3699,7 @@ that suppresses all warnings during execution of BODY."
(byte-compile-body-do-effect
(list (list 'fset (list 'quote (nth 1 form))
(let ((code (byte-compile-byte-code-maker
- (byte-compile-lambda
- (cons 'lambda (cdr (cdr form)))))))
+ (byte-compile-lambda (cdr (cdr form)) t))))
(if (eq (car-safe code) 'make-byte-code)
(list 'cons ''macro code)
(list 'quote (cons 'macro (eval code))))))
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 2b47b139759..612abaf7091 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -353,9 +353,10 @@ That buffer should be current already."
(forward-line -1)
(setq new-start (point)))
(if (not (zerop
- (compare-buffer-substrings
- (current-buffer) old-start old-end
- buffer new-start new-end)))
+ (let ((case-fold-search nil))
+ (compare-buffer-substrings
+ (current-buffer) old-start old-end
+ buffer new-start new-end))))
(setq all-match nil))))
;; Now new-end is the position of the start of the
;; unchanged part in the current buffer, and old-end is
@@ -659,6 +660,9 @@ Complete list of commands:
For the cross-reference format, see `help-make-xrefs'."
(interactive "d")
(require 'help-mode)
+ ;; Ideally we'd just do (call-interactively 'help-follow) except that this
+ ;; assumes we're already in a *Help* buffer and reuses it, so it ends up
+ ;; incorrectly "reusing" the *Backtrace* buffer to show the help info.
(unless pos
(setq pos (point)))
(unless (push-button pos)
@@ -671,8 +675,7 @@ For the cross-reference format, see `help-make-xrefs'."
(progn (skip-syntax-forward "w_")
(point)))))))
(when (or (boundp sym) (fboundp sym) (facep sym))
- (switch-to-buffer-other-window (generate-new-buffer "*Help*"))
- (help-do-xref pos #'help-xref-interned (list sym))))))
+ (help-xref-interned sym)))))
;; When you change this, you may also need to change the number of
;; frames that the debugger skips.
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 0cebeeb6f7f..2f394c2c470 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -142,9 +142,9 @@ See the functions `find-function' and `find-variable'."
(defun find-library-name (library)
"Return the absolute file name of the Lisp source of LIBRARY."
- ;; If the library is byte-compiled, try to find a source library by
- ;; the same name.
- (if (string-match "\\.el\\(c\\(\\..*\\)?\\)\\'" library)
+ ;; Strip off the extension to take advantage of library suffixes in
+ ;; the call to `locate-file'.
+ (if (string-match "\\.el\\(c\\(\\..*\\)?\\)?\\'" library)
(setq library (replace-match "" t t library)))
(or (locate-file library
(or find-function-source-path load-path)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index c93eb0e62c4..b9a73218322 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -142,12 +142,13 @@
(put 'easy-mmode-define-minor-mode 'doc-string-elt 2)
(put 'define-minor-mode 'doc-string-elt 2)
(put 'define-generic-mode 'doc-string-elt 7)
-;; define-global-mode has no explicit docstring.
-(put 'easy-mmode-define-global-mode 'doc-string-elt 0)
(put 'define-ibuffer-filter 'doc-string-elt 2)
(put 'define-ibuffer-op 'doc-string-elt 3)
(put 'define-ibuffer-sorter 'doc-string-elt 2)
(put 'lambda 'doc-string-elt 2)
+(put 'defalias 'doc-string-elt 3)
+(put 'defvaralias 'doc-string-elt 3)
+(put 'define-category 'doc-string-elt 2)
(defvar lisp-doc-string-elt-property 'doc-string-elt
"The symbol property that holds the docstring position info.")