aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/eshell
diff options
context:
space:
mode:
authorNoam Postavsky2017-07-11 22:11:19 -0400
committerNoam Postavsky2017-07-20 22:40:34 -0400
commit7a0ca227af1081ca7ada2e82a87b1a575ef04759 (patch)
tree916dd74fecf89ab91a1acc416b9616b863f23b66 /lisp/eshell
parentffde1e9b9e9aa763e18f009e0d54345f509134db (diff)
downloademacs-7a0ca227af1081ca7ada2e82a87b1a575ef04759.tar.gz
emacs-7a0ca227af1081ca7ada2e82a87b1a575ef04759.zip
Make eshell-next-prompt more reliable (Bug#27405)
* lisp/eshell/em-prompt.el (eshell-next-prompt): Search for `eshell-prompt-regexp' (and `read-only' text-property if `eshell-highlight-prompt' is set) rather than trying to use `forward-paragraph'. (eshell-previous-prompt): Don't count prompt on current line.
Diffstat (limited to 'lisp/eshell')
-rw-r--r--lisp/eshell/em-prompt.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index 8c81b43b1fa..2fd1db2113d 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -161,14 +161,25 @@ If N is negative, find the previous or Nth previous match."
161 "Move to end of Nth next prompt in the buffer. 161 "Move to end of Nth next prompt in the buffer.
162See `eshell-prompt-regexp'." 162See `eshell-prompt-regexp'."
163 (interactive "p") 163 (interactive "p")
164 (forward-paragraph n) 164 (if eshell-highlight-prompt
165 (progn
166 (while (< n 0)
167 (while (and (re-search-backward eshell-prompt-regexp nil t)
168 (not (get-text-property (match-beginning 0) 'read-only))))
169 (setq n (1+ n)))
170 (while (> n 0)
171 (while (and (re-search-forward eshell-prompt-regexp nil t)
172 (not (get-text-property (match-beginning 0) 'read-only))))
173 (setq n (1- n))))
174 (re-search-forward eshell-prompt-regexp nil t n))
165 (eshell-skip-prompt)) 175 (eshell-skip-prompt))
166 176
167(defun eshell-previous-prompt (n) 177(defun eshell-previous-prompt (n)
168 "Move to end of Nth previous prompt in the buffer. 178 "Move to end of Nth previous prompt in the buffer.
169See `eshell-prompt-regexp'." 179See `eshell-prompt-regexp'."
170 (interactive "p") 180 (interactive "p")
171 (eshell-next-prompt (- (1+ n)))) 181 (beginning-of-line) ; Don't count prompt on current line.
182 (eshell-next-prompt (- n)))
172 183
173(defun eshell-skip-prompt () 184(defun eshell-skip-prompt ()
174 "Skip past the text matching regexp `eshell-prompt-regexp'. 185 "Skip past the text matching regexp `eshell-prompt-regexp'.