mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
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.
19 lines
378 B
EmacsLisp
19 lines
378 B
EmacsLisp
;; -*- 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))))
|
|
|