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

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 26 Aug 2021 19:47:54 +0200

Glenn Morris <[email-masked]> 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