jdtsmith / comint-fold

Fold input + output blocks in Emacs comint shells
GNU General Public License v3.0
8 stars 0 forks source link

Folding eats the next prompt #1

Closed elkarouh closed 1 year ago

elkarouh commented 1 year ago

I defined a regex for gdb prompt (setq gdb-prompt-regexp "^(\(gdb\)[[:space:]]*") (add-hook 'gud-mode-hook (comint-fold-configure-hook 0 'gdb-prompt-regexp))

But when using it, it eats the following prompt e.g. (gdb)break hello bbbbbb nnnnnn (gdb)info break dddd eeee

When pressing on the line containing (gdb)break hello, i get (gdb)....info break dddd eeee

jdtsmith commented 1 year ago

Strange. Does comint-next-prompt move you correctly between ends of prompt? BTW, I see that gud.el already sets comint-prompt-regexp.

Your regex looks malformed (missing ), unnecessary \(\), single \ escape). Did you try without the hook?

elkarouh commented 1 year ago

Yes. It sets the cursor just after (gdb) But the fold should comprise the next prompt. It should stop at the end of the preceding line. FYI, my config (setq gdb-prompt-regexp "^(\(gdb\)[[:space:]]*") (add-hook 'gud-mode-hook (comint-fold-configure-hook 0 'gdb-prompt-regexp))

Regards

On Mon, Nov 13, 2023 at 12:31 PM JD Smith @.***> wrote:

Strange. Does comint-next-prompt move you correctly between ends of prompt?

— Reply to this email directly, view it on GitHub https://github.com/jdtsmith/comint-fold/issues/1#issuecomment-1808079148, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXGMAQP6NSEN5QZNMLVTCDYEIHLZAVCNFSM6AAAAAA7IWVJZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBYGA3TSMJUHA . You are receiving this because you authored the thread.Message ID: @.***>

jdtsmith commented 1 year ago

Yes to what? I asked 2 questions. Your regex is still malformed. Try two things:

  1. Remove the gud-mode-hook, just let comint-fold figure things out itself. Does it work?
  2. If 1 doesn't work, try (add-hook 'gud-mode-hook (comint-fold-configure-hook 0 (rx bol "(gdb)" (+ space))))
elkarouh commented 1 year ago

The second option works ! many thanks !

On Tue, Nov 14, 2023 at 12:32 PM JD Smith @.***> wrote:

Yes to what? I asked 2 questions. Your regex is still malformed. Try two things:

  1. Remove the gud-mode-hook, just let comint-fold figure things out itself. Does it work?
  2. If 1 doesn't work, try (add-hook 'gud-mode-hook (comint-fold-configure-hook 0 (rx bol "(gdb)" (+ space))))

— Reply to this email directly, view it on GitHub https://github.com/jdtsmith/comint-fold/issues/1#issuecomment-1810118762, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXGMAQA24D75CMYLBG7UYDYENQFZAVCNFSM6AAAAAA7IWVJZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJQGEYTQNZWGI . You are receiving this because you authored the thread.Message ID: @.***>

jdtsmith commented 1 year ago

BTW, this should probably be gdb-mode-hook, since gud can run many different debuggers besides gdb.