Subject: Go to eval-buffer: Reading at buffer position

From: Lennart Borgman <[email-masked]>
Date: Wed, 16 Jun 2010 04:49:21 +0200

A small patch I have forgotten that lets you more conveniently go to
the position where eval-buffer finds an error.
=== modified file 'lisp/emacs-lisp/debug.el'
--- trunk/lisp/emacs-lisp/debug.el	2010-01-13 08:35:10 +0000
+++ patched/lisp/emacs-lisp/debug.el	2010-06-16 02:44:54 +0000
@@ -317,12 +317,21 @@
       (while (and tem
 		  (re-search-forward "^  eval-\\(buffer\\|region\\)(" nil t))
 	(end-of-line)
-	(insert (format "  ; Reading at buffer position %d"
+	(insert "  ; Reading at buffer position ")
+        (let* ((buf (car tem))
 			;; 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))))
+               (pos (with-current-buffer buf (point))))
+          (insert-text-button (format "%d" pos)
+                              'buf buf
+                              'pos pos
+                              'action (lambda (btn)
+                                        (interactive)
+                                        (let ((buf (button-get btn 'buf))
+                                              (pos (button-get btn 'pos)))
+                                          (switch-to-buffer-other-window buf)
+                                          (goto-char pos)))))
 	(pop tem))))
   (debugger-make-xrefs))