Subject: bug#63748: [PATCH] bug#63748: 30.0.50; eshell-previous-prompt doesn't work for multiline prompts

From: Jim Porter <[email-masked]>
Date: Sat, 3 Jun 2023 12:35:50 -0700

On 6/3/2023 6:27 AM, Tony Zorman via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> Okay, I now added some hopefully sufficient tests for this based on both
> next-previous-prompt and forward-backward-matching-input (if that's not
> too overkill). Let me know what you think.

Thanks. You can probably simplify the multiline wrapper in your test to 
something like this:

   (defmacro em-prompt-test--with-multiline (&rest body)
     "Execute BODY with a multiline Eshell prompt."
     `(let ((eshell-prompt-function (lambda () "multiline prompt\n$ ")))
        ,@body))

Then use it like so:

   ;; Note: no arguments necessary.
   (defun em-prompt-test/forward-backward-matching-input-with ()
      ;; ...
      )

   (ert-deftest em-prompt-test/forward-backward-matching-input-multiline ()
     (em-prompt-test--with-multiline
      (em-prompt-test/forward-backward-matching-input-with)))

That should be safer than setq'ing the prompt function. (You also don't 
need to set the prompt regexp, since that's only useful if you want to 
navigate via '(forward|backward)-paragraph', and we don't test that here.)

If you prefer, I can make that change myself and then merge your patch.