* bug#1282: Improvement to gud.el error message
@ 2008-10-31 4:54 Michael Ernst
2008-11-01 8:52 ` Nick Roberts
2020-09-19 22:30 ` Lars Ingebrigtsen
0 siblings, 2 replies; 4+ messages in thread
From: Michael Ernst @ 2008-10-31 4:54 UTC (permalink / raw
To: bug-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#1282: Improvement to gud.el error message
2008-10-31 4:54 bug#1282: Improvement to gud.el error message Michael Ernst
@ 2008-11-01 8:52 ` Nick Roberts
2008-11-02 15:40 ` Michael Ernst
2020-09-19 22:30 ` Lars Ingebrigtsen
1 sibling, 1 reply; 4+ messages in thread
From: Nick Roberts @ 2008-11-01 8:52 UTC (permalink / raw
To: Michael Ernst, 1282; +Cc: bug-gnu-emacs
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#1282: Improvement to gud.el error message
2008-11-01 8:52 ` Nick Roberts
@ 2008-11-02 15:40 ` Michael Ernst
0 siblings, 0 replies; 4+ messages in thread
From: Michael Ernst @ 2008-11-02 15:40 UTC (permalink / raw
To: Nick Roberts; +Cc: bug-gnu-emacs, 1282
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#1282: Improvement to gud.el error message
2008-10-31 4:54 bug#1282: Improvement to gud.el error message Michael Ernst
2008-11-01 8:52 ` Nick Roberts
@ 2020-09-19 22:30 ` Lars Ingebrigtsen
1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-19 22:30 UTC (permalink / raw
To: Michael Ernst; +Cc: 1282
Michael Ernst <mernst@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@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
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-19 22:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-31 4:54 bug#1282: Improvement to gud.el error message Michael Ernst
2008-11-01 8:52 ` Nick Roberts
2008-11-02 15:40 ` Michael Ernst
2020-09-19 22:30 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.