lisp/emacs-lisp/debug.el | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index b0813ae..bda05ac 100644 *** a/lisp/emacs-lisp/debug.el --- b/lisp/emacs-lisp/debug.el *************** *** 333,351 **** (cdr debugger-args) debugger-args) (current-buffer)) (insert ?\n))) ! ;; After any frame that uses eval-buffer, ;; insert a line that states the buffer position it's reading at. (save-excursion ! (let ((tem eval-buffer-list)) (while (and tem (re-search-forward "^ eval-\\(buffer\\|region\\)(" nil t)) (end-of-line) ! (insert (format " ; Reading at buffer position %d" ;; This will get the wrong result ;; if there are two nested eval-region calls ;; for the same buffer. That's not a very useful case. (with-current-buffer (car tem) ! (point)))) (pop tem)))) (debugger-make-xrefs)) --- 333,367 ---- (cdr debugger-args) debugger-args) (current-buffer)) (insert ?\n))) ! ;; After any frame that uses eval-buffer, for `read'-related error, ;; insert a line that states the buffer position it's reading at. + ;; For other errors, state the buffer position of the offending form. (save-excursion ! (let ((tem eval-buffer-list) ! (read-related-error-p ! (and ! ;; A `read'-related error, if any, is always singular and innermost. ! (eq 'error (car debugger-args)) ! (memq (car (cadr debugger-args)) ! ;; This is from grep xsignal1 lread.c -- is that OK? ! '(end-of-file ! invalid-read-syntax ! overflow-error))))) (while (and tem (re-search-forward "^ eval-\\(buffer\\|region\\)(" nil t)) (end-of-line) ! (insert (format " ; Reading%s at buffer position %d" ! (if read-related-error-p "" " form") ;; This will get the wrong result ;; if there are two nested eval-region calls ;; for the same buffer. That's not a very useful case. (with-current-buffer (car tem) ! (if read-related-error-p ! (point) ! (save-excursion ! (forward-sexp -1) ! (point)))))) ! (setq read-related-error-p nil) (pop tem)))) (debugger-make-xrefs))