Function: eshell-forward-paragraph
eshell-forward-paragraph is an interactive and byte-compiled function
defined in em-prompt.el.gz.
Signature
(eshell-forward-paragraph &optional N)
Documentation
Move to the beginning of the Nth next prompt in the buffer.
Like forward-paragraph, but also stops at the beginning of each prompt.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-prompt.el.gz
(defun eshell-forward-paragraph (&optional n)
"Move to the beginning of the Nth next prompt in the buffer.
Like `forward-paragraph', but also stops at the beginning of each prompt."
(interactive "p")
(unless n (setq n 1))
(let (;; We'll handle the "paragraph" starts ourselves.
(paragraph-start regexp-unmatchable)
(inhibit-field-text-motion t))
(cond
((> n 0)
(while (and (> n 0) (< (point) (point-max)))
(let ((next-paragraph (save-excursion (forward-paragraph) (point)))
(next-prompt (save-excursion
(if-let* ((match (text-property-search-forward
'field 'prompt t t)))
(prop-match-beginning match)
(point-max)))))
(goto-char (min next-paragraph next-prompt)))
(setq n (1- n))))
((< n 0)
(while (and (< n 0) (> (point) (point-min)))
(let ((prev-paragraph (save-excursion (backward-paragraph) (point)))
(prev-prompt (save-excursion
(if (text-property-search-backward
'field 'prompt t)
(point)
(point-min)))))
(goto-char (max prev-paragraph prev-prompt)))
(setq n (1+ n)))))))