summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2022-04-18 15:16:54 +0000
committerAlan Mackenzie <acm@muc.de>2022-04-18 15:16:54 +0000
commit850074636e73509b09c28e965c1af054a84f4069 (patch)
tree1ffef8827901cfb9d460c02ee673b325c4248372 /lisp/emacs-lisp
parent352fc739a1df259b1d2de6bc442465f344e44fec (diff)
downloademacs-850074636e73509b09c28e965c1af054a84f4069.tar.gz
emacs-850074636e73509b09c28e965c1af054a84f4069.tar.bz2
emacs-850074636e73509b09c28e965c1af054a84f4069.zip
Byte compiler: correct output warning message positions
Correct the algorithm for determining the warning position to get the first symbol-with-position in byte-compile--form-stack. * lisp/emacs-lisp/bytecomp.el (byte-compile--first-symbol-with-pos): Function renamed and amended from byte-compile--first-symbol. (byte-compile--warning-source-offset): Call the new function above rather than the old one.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el14
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 43648fa657b..8128410916a 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1173,16 +1173,16 @@ message buffer `default-directory'."
(f2 (file-relative-name file dir)))
(if (< (length f2) (length f1)) f2 f1)))
-(defun byte-compile--first-symbol (form)
- "Return the \"first\" symbol found in form, or 0 if there is none.
+(defun byte-compile--first-symbol-with-pos (form)
+ "Return the \"first\" symbol with position found in form, or 0 if none.
Here, \"first\" is by a depth first search."
(let (sym)
(cond
- ((symbolp form) form)
+ ((symbol-with-pos-p form) form)
((consp form)
- (or (and (symbolp (setq sym (byte-compile--first-symbol (car form))))
+ (or (and (symbol-with-pos-p (setq sym (byte-compile--first-symbol-with-pos (car form))))
sym)
- (and (symbolp (setq sym (byte-compile--first-symbol (cdr form))))
+ (and (symbolp (setq sym (byte-compile--first-symbol-with-pos (cdr form))))
sym)
0))
((and (vectorp form)
@@ -1193,7 +1193,7 @@ Here, \"first\" is by a depth first search."
(catch 'sym
(while (< i len)
(when (symbolp
- (setq elt (byte-compile--first-symbol (aref form i))))
+ (setq elt (byte-compile--first-symbol-with-pos (aref form i))))
(throw 'sym elt))
(setq i (1+ i)))
0)))
@@ -1204,7 +1204,7 @@ Here, \"first\" is by a depth first search."
Return nil if such is not found."
(catch 'offset
(dolist (form byte-compile-form-stack)
- (let ((s (byte-compile--first-symbol form)))
+ (let ((s (byte-compile--first-symbol-with-pos form)))
(if (symbol-with-pos-p s)
(throw 'offset (symbol-with-pos-pos s)))))))