"Move to end of Nth next prompt in the buffer.
See `eshell-prompt-regexp'."
(interactive "p")
- (forward-paragraph n)
+ (if eshell-highlight-prompt
+ (progn
+ (while (< n 0)
+ (while (and (re-search-backward eshell-prompt-regexp nil t)
+ (not (get-text-property (match-beginning 0) 'read-only))))
+ (setq n (1+ n)))
+ (while (> n 0)
+ (while (and (re-search-forward eshell-prompt-regexp nil t)
+ (not (get-text-property (match-beginning 0) 'read-only))))
+ (setq n (1- n))))
+ (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")
- (eshell-next-prompt (- (1+ n))))
+ (beginning-of-line) ; Don't count prompt on current line.
+ (eshell-next-prompt (- n)))
(defun eshell-skip-prompt ()
"Skip past the text matching regexp `eshell-prompt-regexp'.