mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-23 22:20:24 -08:00
Preserve source position of macro calls in macro expansions
This allows the byte compiler to give correct positions, those of the invoking forms, when an error or warning is caused by the innards of the invoked macros. This fixes bug#73725 and bug#73746. * lisp/emacs-lisp/macroexp.el (macroexp--posify-form-1) (macroexp--posify-form): New functions. (macroexp-preserve-posification): New macro. (macroexp--compiler-macro, macroexp-macroexpand): Use the new macro to preserve a calling form's position. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form): Use the new macro to preserve source positions. * test/lisp/emacs-lisp/bytecomp-resources/bad-error-position.el * test/lisp/emacs-lisp/bytecomp-resources/bad-error-position-2.el: New test files. * test/lisp/emacs-lisp/bytecomp-tests.el: Two new tests using the new test files.
This commit is contained in:
parent
1e3d76af5a
commit
c44903b011
5 changed files with 148 additions and 15 deletions
|
|
@ -0,0 +1,19 @@
|
|||
;; -*- lexical-binding:t -*-
|
||||
(eval-and-compile
|
||||
(defmacro increase ()
|
||||
`(let ((foo (point-max)))
|
||||
(cond
|
||||
((consp foo)
|
||||
(message "consp %s" foo)
|
||||
foo)
|
||||
((numberp foo)
|
||||
(1+ fooo)) ; Note the misspelling.
|
||||
(t (message "Something else: %s" foo))))))
|
||||
|
||||
(defun call-increase (bar)
|
||||
(cond
|
||||
((not (or (consp bar)
|
||||
(numberp bar)))
|
||||
bar)
|
||||
(t (increase))))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue