GNU bug report logs - #1282
Improvement to gud.el error message

Previous Next

Package: emacs;

Reported by: Michael Ernst <mernst <at> alum.mit.edu>

Date: Fri, 31 Oct 2008 05:05:04 UTC

Severity: wishlist

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1282 in the body.
You can then email your comments to 1282 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1282; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Michael Ernst <mernst <at> alum.mit.edu>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Ernst <mernst <at> alum.mit.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: Improvement to gud.el error message
Date: Fri, 31 Oct 2008 05:54:47 +0100
This patch improves an error message in gud.el, by indicating the name of
the file that cannot be found.

                    -Michael Ernst


diff -u -b -r --exclude=CVS --exclude=.bzr --exclude=.hg --exclude=.hgtags --exclude=.svn /DS/home-0/mernst/.synchronized/gud.el-orig /DS/home-0/mernst/.synchronized/gud.el-patched
--- /DS/home-0/mernst/.synchronized/gud.el-orig	2008-10-25 11:28:35.918786020 +0200
+++ /DS/home-0/mernst/.synchronized/gud.el-patched	2008-10-25 11:28:12.635390729 +0200
@@ -2223,8 +2223,9 @@
 		(if (< n gud-jdb-lowest-stack-level)
 		    (progn (setq gud-jdb-lowest-stack-level n) t)))
 	    t)
+	  (let ((filename (match-string 2 gud-marker-acc)))
 	  (if (setq file-found
-		    (gud-jdb-find-source (match-string 2 gud-marker-acc)))
+		      (gud-jdb-find-source filename))
 	      (setq gud-last-frame
 		    (cons file-found
 			  (string-to-number
@@ -2233,7 +2234,7 @@
                              (if (string-match "[.,]" numstr)
                                  (replace-match "" nil nil numstr)
                                numstr)))))
-	    (message "Could not find source file.")))
+	      (message "Could not find source file %s" filename))))
 
       ;; Set the accumulator to the remaining text.
       (setq gud-marker-acc (substring gud-marker-acc (match-end 0))))

Diff finished.  Fri Oct 31 05:54:35 2008





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1282; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Nick Roberts <nickrob <at> snap.net.nz>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 1282 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Nick Roberts <nickrob <at> snap.net.nz>
To: Michael Ernst <mernst <at> alum.mit.edu>, 1282 <at> debbugs.gnu.org
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1282: Improvement to gud.el error message
Date: Sat, 1 Nov 2008 21:52:29 +1300
 > This patch improves an error message in gud.el, by indicating the name of
 > the file that cannot be found.
 > 
 >                     -Michael Ernst

If I have a file MyProg.java, with your patch I get:

Could not find source file MyProg

i.e. the class name not the filename.

Have you read this comment in gud.el?

       ;; The first group matches <fully-qualified-class>,
       ;; the second group matches <class> and the third group
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       ;; matches <line-number>.  We don't care about using

Generally, if there is more than one (non-public) class in the file, the
class name needn't match the filename.

-- 
Nick                                           http://www.inet.net.nz/~nickrob




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1282; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Nick Roberts <nickrob <at> snap.net.nz>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1282; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Michael Ernst <mernst <at> alum.mit.edu>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Ernst <mernst <at> alum.mit.edu>
To: Nick Roberts <nickrob <at> snap.net.nz>
Cc: 1282 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1282: Improvement to gud.el error message
Date: Sun, 2 Nov 2008 16:40:38 +0100
> If I have a file MyProg.java, with your patch I get:
> 
> Could not find source file MyProg
> 
> i.e. the class name not the filename.

OK.  Feel free to modify the patch based on your more intimate knowledge of
the source code.  The key point is that the error message with no
indication of anything (class name nor filename) is cryptic, and additional
information would be useful.  Thanks!

                    -Michael Ernst





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1282; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Michael Ernst <mernst <at> alum.mit.edu>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Severity set to `wishlist' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Mon, 01 Dec 2008 22:45:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1282; Package emacs. (Sat, 19 Sep 2020 22:32:02 GMT) Full text and rfc822 format available.

Message #30 received at 1282 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Ernst <mernst <at> alum.mit.edu>
Cc: 1282 <at> debbugs.gnu.org
Subject: Re: bug#1282: Improvement to gud.el error message
Date: Sun, 20 Sep 2020 00:30:51 +0200
Michael Ernst <mernst <at> alum.mit.edu> writes:

> This patch improves an error message in gud.el, by indicating the name of
> the file that cannot be found.

[...]

> +	  (let ((filename (match-string 2 gud-marker-acc)))
>  	  (if (setq file-found
> -		    (gud-jdb-find-source (match-string 2 gud-marker-acc)))
> +		      (gud-jdb-find-source filename))
>  	      (setq gud-last-frame
>  		    (cons file-found
>  			  (string-to-number
> @@ -2233,7 +2234,7 @@
>                               (if (string-match "[.,]" numstr)
>                                   (replace-match "" nil nil numstr)
>                                 numstr)))))
> -	    (message "Could not find source file.")))
> +	      (message "Could not find source file %s" filename))))

Nick Roberts <nickrob <at> snap.net.nz> writes:

> If I have a file MyProg.java, with your patch I get:
>
> Could not find source file MyProg
>
> i.e. the class name not the filename.
>
> Have you read this comment in gud.el?
>
>        ;; The first group matches <fully-qualified-class>,
>        ;; the second group matches <class> and the third group
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>        ;; matches <line-number>.  We don't care about using
>
> Generally, if there is more than one (non-public) class in the file, the
> class name needn't match the filename.

I'm not quite sure I get the objection here.  The patch only adds more
information to the error message and doesn't change anything else.  Is
the objection that the new message implies that the thing we matched was
a file name and not a class?

So I changed the patch to slightly and applied it to Emacs 28.

diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 092d15983e..84c473ddb7 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -2358,17 +2358,17 @@ gud-jdb-marker-filter
 		(if (< n gud-jdb-lowest-stack-level)
 		    (progn (setq gud-jdb-lowest-stack-level n) t)))
 	    t)
-	  (if (setq file-found
-		    (gud-jdb-find-source (match-string 2 gud-marker-acc)))
-	      (setq gud-last-frame
-		    (cons file-found
-			  (string-to-number
-			   (let
-                               ((numstr (match-string 4 gud-marker-acc)))
-                             (if (string-match "[.,]" numstr)
-                                 (replace-match "" nil nil numstr)
-                               numstr)))))
-	    (message "Could not find source file.")))
+	  (let ((class (match-string 2 gud-marker-acc)))
+	    (if (setq file-found (gud-jdb-find-source class))
+	        (setq gud-last-frame
+		      (cons file-found
+			    (string-to-number
+			     (let
+                                 ((numstr (match-string 4 gud-marker-acc)))
+                               (if (string-match "[.,]" numstr)
+                                   (replace-match "" nil nil numstr)
+                                 numstr)))))
+	      (message "Could not find source file for %s" class))))
 
       ;; Set the accumulator to the remaining text.
       (setq gud-marker-acc (substring gud-marker-acc (match-end 0))))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 19 Sep 2020 22:32:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 1282 <at> debbugs.gnu.org and Michael Ernst <mernst <at> alum.mit.edu> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 19 Sep 2020 22:32:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Oct 2020 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 189 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.