From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#1282: Improvement to gud.el error message Date: Sun, 20 Sep 2020 00:30:51 +0200 Message-ID: <87eemxjt5w.fsf@gnus.org> References: <18698.36759.322749.276498@swsmde.ds.mpi-sws.mpg.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6458"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 1282@debbugs.gnu.org To: Michael Ernst Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 20 00:32:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJlOu-0001Yu-Di for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Sep 2020 00:32:12 +0200 Original-Received: from localhost ([::1]:35516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJlOt-0003Bj-EP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Sep 2020 18:32:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJlOk-0003BL-SS for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 18:32:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJlOk-0001FM-Iw for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 18:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kJlOk-0006vy-F8 for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 18:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Sep 2020 22:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 1282 X-GNU-PR-Package: emacs Original-Received: via spool by 1282-submit@debbugs.gnu.org id=B1282.160055467124083 (code B ref 1282); Sat, 19 Sep 2020 22:32:02 +0000 Original-Received: (at 1282) by debbugs.gnu.org; 19 Sep 2020 22:31:11 +0000 Original-Received: from localhost ([127.0.0.1]:48371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJlNv-0006G2-6q for submit@debbugs.gnu.org; Sat, 19 Sep 2020 18:31:11 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:52946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJlNs-00069E-RB for 1282@debbugs.gnu.org; Sat, 19 Sep 2020 18:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=zNdw6TG9IYiXcZbnnEqp1rLa+FiP/roEb3B5k6NKs7w=; b=h1y36r6DbuFxlt3NkOV73N+cDo 5UX/aeW1piiG2kY1LzE/T0EXuxJ6p1+yk6XkoLOYqmMgzLQgW8TILO511bXHprRIYinKw+VkrqcW0 t3aKz4N6DY7Ouae6zWQILqx7/4h+8Z8DIc69Ou9nCzTFftDLf71Mraz2FRiqIUgfKLD8=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJlNc-0007Le-WF; Sun, 20 Sep 2020 00:31:02 +0200 X-Now-Playing: Anne Pigalle's _Everything Could Be So Perfect..._: "Looking for Love" In-Reply-To: <18698.36759.322749.276498@swsmde.ds.mpi-sws.mpg.de> (Michael Ernst's message of "Fri, 31 Oct 2008 05:54:47 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188448 Archived-At: Michael Ernst 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 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 , > ;; the second group matches and the third group > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > ;; matches . 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