Subject: Re: bug#27405: 25.2; Make eshell-next-prompt more reliable

From: [email-masked]
Date: Sat, 17 Jun 2017 18:13:44 -0400

severity 27405 minor
tags 27405 + confirmed
quit

Pierre Neidhardt <[email-masked]> writes:

> Current definition of `eshell-next-prompt' merely skips a
> paragraph. This won't produce the right result as soon the output
> contains a paragraph separator (typically an empty line).
>
> I have been using the following redefinition for a while and it works much
> better for me:

Seems reasonable.

> 	(defun eshell-next-prompt (n)
> 	  "Move to end of Nth next prompt in the buffer.
> 	See `eshell-prompt-regexp'."
> 	  (interactive "p")
> 	  (re-search-forward eshell-prompt-regexp nil t n)
> 	  (when eshell-highlight-prompt
> 	    (while (not (get-text-property (line-beginning-position) 'read-only) )
> 	      (re-search-forward eshell-prompt-regexp nil t n)))
> 	  (eshell-skip-prompt))
>
> 	(defun eshell-previous-prompt (n)
> 	  "Move to end of Nth previous prompt in the buffer.
> 	See `eshell-prompt-regexp'."
> 	  (interactive "p")
> 	  (backward-char)
> 	  (eshell-next-prompt (- n))))

What's the backward-char for?