]> code.delx.au - gnu-emacs/blobdiff - lisp/gud.el
(quail-help): The output message is improved.
[gnu-emacs] / lisp / gud.el
index 2953834b8ff818e2ebf4ae38e8868a4470b5ca52..13a8a101118ab509ced41653c63b273bc84ba990 100644 (file)
@@ -4,7 +4,7 @@
 ;; Maintainer: FSF
 ;; Keywords: unix, tools
 
-;; Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 93, 94, 95, 96, 1998, 2000 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -411,11 +411,7 @@ This is implemented using the GDB `complete' command which isn't
 available with older versions of GDB."
   (interactive)
   (let* ((end (point))
-        (command (save-excursion
-                   (beginning-of-line)
-                   (and (looking-at comint-prompt-regexp)
-                        (goto-char (match-end 0)))
-                   (buffer-substring (point) end)))
+        (command (buffer-substring (comint-line-beginning-position) end))
         command-word)
     ;; Find the word break.  This match will always succeed.
     (string-match "\\(\\`\\| \\)\\([^ ]*\\)\\'" command)
@@ -1545,7 +1541,15 @@ and source-file directory for your debugger."
 ;; List of Java source file directories.
 (defvar gud-jdb-directories (list ".")
   "*A list of directories that gud jdb should search for source code.
-The file names should be absolute, or relative to the current directory.")
+The file names should be absolute, or relative to the current
+directory.
+
+The set of .java files residing in the directories listed are
+syntactically analyzed to determine the classes they define and the
+packages in which these classes belong.  In this way gud jdb maps the
+package-qualified class names output by the jdb debugger to the source
+file from which the class originated.  This allows gud mode to keep
+the source code display in sync with the debugging session.")
 
 ;; List of the java source files for this debugging session.
 (defvar gud-jdb-source-files nil)
@@ -2177,23 +2181,26 @@ It is saved for when this flag is not set.")
            (if gud-filter-pending-text
                (setq string (concat gud-filter-pending-text string)
                      gud-filter-pending-text nil))
-           (save-excursion
-             (set-buffer (process-buffer proc))
+
+           (with-current-buffer (process-buffer proc)
              ;; If we have been so requested, delete the debugger prompt.
-             (if (marker-buffer gud-delete-prompt-marker)
-                 (progn
-                   (delete-region (process-mark proc) gud-delete-prompt-marker)
-                   (set-marker gud-delete-prompt-marker nil)))
-             ;; Save the process output, checking for source file markers.
-             (setq output (gud-marker-filter string))
-             ;; Check for a filename-and-line number.
-             ;; Don't display the specified file
-             ;; unless (1) point is at or after the position where output appears
-             ;; and (2) this buffer is on the screen.
-             (setq process-window
-                   (and gud-last-frame
-                        (>= (point) (process-mark proc))
-                        (get-buffer-window (current-buffer))))
+             (save-restriction
+               (widen)
+               (if (marker-buffer gud-delete-prompt-marker)
+                   (progn
+                     (delete-region (process-mark proc)
+                                    gud-delete-prompt-marker)
+                     (set-marker gud-delete-prompt-marker nil)))
+               ;; Save the process output, checking for source file markers.
+               (setq output (gud-marker-filter string))
+               ;; Check for a filename-and-line number.
+               ;; Don't display the specified file
+               ;; unless (1) point is at or after the position where output appears
+               ;; and (2) this buffer is on the screen.
+               (setq process-window
+                     (and gud-last-frame
+                          (>= (point) (process-mark proc))
+                          (get-buffer-window (current-buffer)))))
 
              ;; Let the comint filter do the actual insertion.
              ;; That lets us inherit various comint features.
@@ -2378,10 +2385,12 @@ Obeying it means displaying in another window the specified file and line."
     ;; Arrange for the current prompt to get deleted.
     (save-excursion
       (set-buffer gud-comint-buffer)
-      (goto-char (process-mark proc))
-      (beginning-of-line)
-      (if (looking-at comint-prompt-regexp)
-         (set-marker gud-delete-prompt-marker (point))))
+      (save-restriction
+       (widen)
+       (goto-char (process-mark proc))
+       (forward-line 0)
+       (if (looking-at comint-prompt-regexp)
+           (set-marker gud-delete-prompt-marker (point)))))
     (process-send-string proc command)))
 
 (defun gud-refresh (&optional arg)