(lambda ()
(concat (abbreviate-file-name (eshell/pwd))
(if (= (file-user-uid) 0) " # " " $ ")))
- "A function that returns the Eshell prompt string.
-Make sure to update `eshell-prompt-regexp' so that it will match your
-prompt."
+ "A function that returns the Eshell prompt string."
:type 'function
:group 'eshell-prompt)
(defcustom eshell-prompt-regexp "^[^#$\n]* [#$] "
- "A regexp which fully matches your Eshell prompt.
-This is useful for navigating by paragraph using \
-\\[forward-paragraph] and \\[backward-paragraph].
-
-If this variable is changed, all Eshell buffers must be exited
-and re-entered for it to take effect."
+ "A regexp which fully matches your Eshell prompt."
:type 'regexp
:group 'eshell-prompt)
+(make-obsolete-variable 'eshell-prompt-regexp nil "30.1")
(defcustom eshell-highlight-prompt t
"If non-nil, Eshell should highlight the prompt."
:group 'eshell-prompt)
(defvar-keymap eshell-prompt-mode-map
- "C-c C-n" #'eshell-next-prompt
- "C-c C-p" #'eshell-previous-prompt)
+ "C-c C-n" #'eshell-next-prompt
+ "C-c C-p" #'eshell-previous-prompt
+ "<remap> <forward-paragraph>" #'eshell-forward-paragraph
+ "<remap> <backward-paragraph>" #'eshell-backward-paragraph)
(defvar-keymap eshell-prompt-repeat-map
:doc "Keymap to repeat eshell-prompt key sequences. Used in `repeat-mode'."
"Initialize the prompting code."
(unless eshell-non-interactive-p
(add-hook 'eshell-post-command-hook 'eshell-emit-prompt nil t)
-
- (make-local-variable 'eshell-prompt-regexp)
- (if eshell-prompt-regexp
- (setq-local paragraph-start eshell-prompt-regexp))
-
(eshell-prompt-mode)))
(defun eshell-emit-prompt ()
(interactive (eshell-regexp-arg "Backward input matching (regexp): "))
(eshell-forward-matching-input regexp (- arg)))
+(defun eshell-forward-paragraph (&optional n)
+ "Move to the beginning of the Nth next prompt in the buffer.
+Like `forward-paragraph', but navigates using fields."
+ (interactive "p")
+ (eshell-next-prompt n)
+ (goto-char (field-beginning (point) t)))
+
+(defun eshell-backward-paragraph (&optional n)
+ "Move to the beginning of the Nth previous prompt in the buffer.
+Like `backward-paragraph', but navigates using fields."
+ (interactive "p")
+ (eshell-previous-prompt n)
+ (goto-char (field-beginning (point) t)))
+
(defun eshell-next-prompt (&optional n)
"Move to end of Nth next prompt in the buffer."
(interactive "p")