mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -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 (sub-macroexp--posify-form) (macroexp--posify-form): New functions. (macroexp-preserve-posification): New macro. (macroexp-macroexpand): Use the new macro to preserve a calling form's position. (macroexpand-all): Add a new parameter `keep-pos' which instructs the function to preserve an invoking form's position. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form): Use the new macro to preserve source positions. * lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): Call macroexpand-all with the new argument `keep-pos' non-nil.
This commit is contained in:
parent
6c928e490d
commit
2114a955c2
3 changed files with 94 additions and 21 deletions
|
|
@ -2582,7 +2582,7 @@ Call from the source buffer."
|
|||
byte-compile-jump-tables nil))))
|
||||
|
||||
(defun byte-compile-preprocess (form &optional _for-effect)
|
||||
(setq form (macroexpand-all form byte-compile-macro-environment))
|
||||
(setq form (macroexpand-all form byte-compile-macro-environment t))
|
||||
;; FIXME: We should run byte-optimize-form here, but it currently does not
|
||||
;; recurse through all the code, so we'd have to fix this first.
|
||||
;; Maybe a good fix would be to merge byte-optimize-form into
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue