changeset 64206:4900890ed6a6

(debug-help-follow): New function. (debugger-mode-map): Use that instead of help-follow. (debugger-setup-buffer): Use eval-buffer-list to handle eval-buffer frames.
author Richard M. Stallman <rms@gnu.org>
date Sun, 10 Jul 2005 17:06:33 +0000
parents 05b076cad2f4
children c08c2bf5cec8
files lisp/emacs-lisp/debug.el
diffstat 1 files changed, 34 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/debug.el	Sun Jul 10 17:02:49 2005 +0000
+++ b/lisp/emacs-lisp/debug.el	Sun Jul 10 17:06:33 2005 +0000
@@ -312,18 +312,17 @@
   ;; After any frame that uses eval-buffer,
   ;; insert a line that states the buffer position it's reading at.
   (save-excursion
-    (while (re-search-forward "^  eval-buffer(" nil t)
-      (end-of-line)
-      (insert (format "  ; Reading at buffer position %d"
-		      (with-current-buffer
-			  (or (nth 2 (backtrace-frame (debugger-frame-number)))
-			      debugger-old-buffer)
-			(point)))))
-    (while (re-search-forward "^  eval-region(" nil t)
-      (end-of-line)
-      (insert (format "  ; Reading at buffer position %d"
-		      (with-current-buffer debugger-old-buffer
-			(point))))))
+    (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))
 
 (defun debugger-make-xrefs (&optional buffer)
@@ -598,10 +597,10 @@
     (define-key map "e" 'debugger-eval-expression)
     (define-key map " " 'next-line)
     (define-key map "R" 'debugger-record-expression)
-    (define-key map "\C-m" 'help-follow)
+    (define-key map "\C-m" 'debug-help-follow)
     (define-key map [mouse-2] 'push-button)
     map))
-
+
 (defcustom debugger-record-buffer "*Debugger-record*"
   "*Buffer name for expression values, for \\[debugger-record-expression]."
   :type 'string
@@ -627,6 +626,27 @@
 	     (buffer-substring (line-beginning-position 0)
 			       (line-end-position 0)))))
 
+(defun debug-help-follow (&optional pos)
+  "Follow cross-reference at POS, defaulting to point.
+
+For the cross-reference format, see `help-make-xrefs'."
+  (interactive "d")
+  (require 'help-mode)
+  (unless pos
+    (setq pos (point)))
+  (unless (push-button pos)
+    ;; check if the symbol under point is a function or variable
+    (let ((sym
+	   (intern
+	    (save-excursion
+	      (goto-char pos) (skip-syntax-backward "w_")
+	      (buffer-substring (point)
+				(progn (skip-syntax-forward "w_")
+				       (point)))))))
+      (when (or (boundp sym) (fboundp sym) (facep sym))
+	(switch-to-buffer-other-window (generate-new-buffer "*Help*"))
+	(help-do-xref pos #'help-xref-interned (list sym))))))
+
 (put 'debugger-mode 'mode-class 'special)
 
 (defun debugger-mode ()