GNU bug report logs - #7461
23.2; gud.el always uses comint-prompt-regexp; things can break if prompt is changed

Previous Next

Package: emacs;

Reported by: Rolando Pereira <finalyugi <at> sapo.pt>

Date: Sun, 21 Nov 2010 19:23:01 UTC

Severity: normal

Found in version 23.2

To reply to this bug, email your comments to 7461 AT debbugs.gnu.org.

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

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


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7461; Package emacs. (Sun, 21 Nov 2010 19:23:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rolando Pereira <finalyugi <at> sapo.pt>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 21 Nov 2010 19:23:01 GMT) Full text and rfc822 format available.

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

From: Rolando Pereira <finalyugi <at> sapo.pt>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; Gdb only does tab completion inside Emacs when prompt is (gdb)
Date: Sun, 21 Nov 2010 17:45:14 +0000
When running gdb inside emacs, either by doing M-x gdb or M-x gud-gdb,
if the prompt is set to something that isn't "(gdb)" (or similar, see
the examples below), pressing TAB doesn't do the completion of
commands, functions or variables.

Use the following steps to reproduce the error using emacs -Q:

1) Create a new C file, for example code.c, with the following
contents:

#include <stdio.h>

int main(void) {
	printf("Hello World\n");
	return 0;
}

2) Compile code using gcc -g code.c -o code

3) Open emacs -Q

4) Start debugging the file using M-x gdb

5) Prompt should be "(gdb) ". Try to type "b ma" and press TAB. It
should expand to "b main".

6) Change gdb's prompt to something else using "set prompt". I changed
it to "gdb> ".

7) Try to type "b ma" and press TAB. It should display on the
minibuffer the message "No completions of ma".


Prompts I've tried where TAB completion still worked:

* "(gdb)"
* "        (gdb)        " (the prefix whitespace is discarded by gdb,
  so this is the same as "(gdb)        ")
* "( gdb) "
* "(gdb)_______________________"
* "(GDB) "
* "( GDB) "

Prompts I've tried where TAB completion DIDN'T work:

* "(gdb )"
* "_(gdb)"
* "(gdb "
* "gdb) "
* "( gdb )"
* "" (removed prompt by typing "set prompt" in gdb)
* "gdb> "
* "gdb>"
* "gdb "
* "gdb"
* "<gdb "
* "<gdb"

Emacs version is: GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version
2.16.1)

GDB version is: GNU gdb (GDB) 7.2




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7461; Package emacs. (Tue, 23 Nov 2010 01:57:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Rolando Pereira <finalyugi <at> sapo.pt>
Cc: 7461 <at> debbugs.gnu.org
Subject: Re: bug#7461: 23.2;
	Gdb only does tab completion inside Emacs when prompt is (gdb)
Date: Mon, 22 Nov 2010 21:01:14 -0500
Rolando Pereira wrote:

> When running gdb inside emacs, either by doing M-x gdb or M-x gud-gdb,
> if the prompt is set to something that isn't "(gdb)" (or similar, see
> the examples below), pressing TAB doesn't do the completion of
> commands, functions or variables.

Thank you for the complete example.

It looks like, after you have changed the prompt, you can set the
local value of comint-prompt-regexp to match it.

More generally, when comint-use-prompt-regexp is nil (which it is by
default), gud.el probably ought not to try and use comint-prompt-regexp.
Instead it should use whatever field properties comint adds.

> Emacs version is: GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version
> 2.16.1)
>
> GDB version is: GNU gdb (GDB) 7.2




Added tag(s) notabug. Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sat, 04 Dec 2010 22:41:01 GMT) Full text and rfc822 format available.

Removed tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 07 Oct 2019 05:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7461; Package emacs. (Thu, 26 Aug 2021 17:49:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Rolando Pereira <finalyugi <at> sapo.pt>, 7461 <at> debbugs.gnu.org
Subject: Re: bug#7461: 23.2; gud.el always uses comint-prompt-regexp; things
 can break if prompt is changed
Date: Thu, 26 Aug 2021 19:47:54 +0200
Glenn Morris <rgm <at> gnu.org> writes:

>> When running gdb inside emacs, either by doing M-x gdb or M-x gud-gdb,
>> if the prompt is set to something that isn't "(gdb)" (or similar, see
>> the examples below), pressing TAB doesn't do the completion of
>> commands, functions or variables.
>
> Thank you for the complete example.
>
> It looks like, after you have changed the prompt, you can set the
> local value of comint-prompt-regexp to match it.
>
> More generally, when comint-use-prompt-regexp is nil (which it is by
> default), gud.el probably ought not to try and use comint-prompt-regexp.
> Instead it should use whatever field properties comint adds.

(I'm going through old bug reports that unfortunately weren't
resolved at the time.)

Looking at the gud code, that sounds like a good idea --- but
unfortunately comint doesn't put any specific field property on the
prompt.  Instead it seems like it marks all the data output, including
the prompt, as `output'.  Which makes sense, but doesn't help us with
distinguishing whether the line we're at is a prompt.

I think.

And I don't think we can change the fields here, because I'm guessing a
lot of stuff depends on all the output being the same field.

But comint does indeed know that it's a prompt...  so we could add
another property here -- like `comint-prompt' on the prompts, and then
use that.

Anybody have any other ideas here?

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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 26 Aug 2021 17:49:02 GMT) Full text and rfc822 format available.

Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 25 Sep 2021 02:39:02 GMT) Full text and rfc822 format available.

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

Previous Next


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