aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/eshell/em-prompt.el3
-rw-r--r--lisp/progmodes/cperl-mode.el4
-rw-r--r--lisp/treesit.el4
-rw-r--r--test/lisp/eshell/em-prompt-tests.el31
4 files changed, 35 insertions, 7 deletions
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index 9f9e58e83d7..42f8f273b52 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -180,7 +180,8 @@ negative, find the Nth next match."
180 (text-property-search-forward 'field 'prompt t)) 180 (text-property-search-forward 'field 'prompt t))
181 (setq n (1- n))) 181 (setq n (1- n)))
182 (let (match this-match) 182 (let (match this-match)
183 (forward-line 0) ; Don't count prompt on current line. 183 ;; Don't count the current prompt.
184 (text-property-search-backward 'field 'prompt t)
184 (while (and (< n 0) 185 (while (and (< n 0)
185 (setq this-match (text-property-search-backward 186 (setq this-match (text-property-search-backward
186 'field 'prompt t))) 187 'field 'prompt t)))
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index d6efd5d75a4..52c5d183dec 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -3394,7 +3394,9 @@ position of the end of the unsafe construct."
3394 (goto-char (nth 8 state)) ; beginning of this here-doc 3394 (goto-char (nth 8 state)) ; beginning of this here-doc
3395 (cperl-backward-to-noncomment ; skip back over more 3395 (cperl-backward-to-noncomment ; skip back over more
3396 (point-min)) ; here-documents (if any) 3396 (point-min)) ; here-documents (if any)
3397 (beginning-of-line)))) ; skip back over here-doc starters 3397 (beginning-of-line)) ; skip back over here-doc starters
3398 ((nth 4 state) ; in a comment (or POD)
3399 (goto-char (nth 8 state))))) ; ...so go to its beginning
3398 (while (and pos (progn 3400 (while (and pos (progn
3399 (beginning-of-line) 3401 (beginning-of-line)
3400 (get-text-property (setq pos (point)) 'syntax-type))) 3402 (get-text-property (setq pos (point)) 'syntax-type)))
diff --git a/lisp/treesit.el b/lisp/treesit.el
index ea701ce1ff7..d79e7732387 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -3070,7 +3070,9 @@ nil, the grammar is installed to the standard location, the
3070 nil 3070 nil
3071 'treesit--install-language-grammar-out-dir-history 3071 'treesit--install-language-grammar-out-dir-history
3072 default-out-dir) 3072 default-out-dir)
3073 out-dir))) 3073 ;; When called non-interactively, OUT-DIR should
3074 ;; default to DEFAULT-OUT-DIR.
3075 (or out-dir default-out-dir))))
3074 (condition-case err 3076 (condition-case err
3075 (progn 3077 (progn
3076 (apply #'treesit--install-language-grammar-1 3078 (apply #'treesit--install-language-grammar-1
diff --git a/test/lisp/eshell/em-prompt-tests.el b/test/lisp/eshell/em-prompt-tests.el
index 257549e40fb..93bf9d84ab3 100644
--- a/test/lisp/eshell/em-prompt-tests.el
+++ b/test/lisp/eshell/em-prompt-tests.el
@@ -80,8 +80,13 @@ This tests the case when `eshell-highlight-prompt' is nil."
80 (apply #'propertize "hello\n" 80 (apply #'propertize "hello\n"
81 eshell-command-output-properties))))))) 81 eshell-command-output-properties)))))))
82 82
83(ert-deftest em-prompt-test/next-previous-prompt () 83(defmacro em-prompt-test--with-multiline (&rest body)
84 "Check that navigating forward/backward through old prompts works correctly." 84 "Execute BODY with a multiline Eshell prompt."
85 `(let ((eshell-prompt-function (lambda () "multiline prompt\n$ ")))
86 ,@body))
87
88(defun em-prompt-test/next-previous-prompt-with ()
89 "Helper for checking forward/backward navigation of old prompts."
85 (with-temp-eshell 90 (with-temp-eshell
86 (eshell-insert-command "echo one") 91 (eshell-insert-command "echo one")
87 (eshell-insert-command "echo two") 92 (eshell-insert-command "echo two")
@@ -98,8 +103,17 @@ This tests the case when `eshell-highlight-prompt' is nil."
98 (eshell-next-prompt 3) 103 (eshell-next-prompt 3)
99 (should (equal (eshell-get-old-input) "echo fou")))) 104 (should (equal (eshell-get-old-input) "echo fou"))))
100 105
101(ert-deftest em-prompt-test/forward-backward-matching-input () 106(ert-deftest em-prompt-test/next-previous-prompt ()
102 "Check that navigating forward/backward via regexps works correctly." 107 "Check that navigating forward/backward through old prompts works correctly."
108 (em-prompt-test/next-previous-prompt-with))
109
110(ert-deftest em-prompt-test/next-previous-prompt-multiline ()
111 "Check old prompt forward/backward navigation for multiline prompts."
112 (em-prompt-test--with-multiline
113 (em-prompt-test/next-previous-prompt-with)))
114
115(defun em-prompt-test/forward-backward-matching-input-with ()
116 "Helper for checking forward/backward navigation via regexps."
103 (with-temp-eshell 117 (with-temp-eshell
104 (eshell-insert-command "echo one") 118 (eshell-insert-command "echo one")
105 (eshell-insert-command "printnl something else") 119 (eshell-insert-command "printnl something else")
@@ -117,4 +131,13 @@ This tests the case when `eshell-highlight-prompt' is nil."
117 (eshell-forward-matching-input "echo" 3) 131 (eshell-forward-matching-input "echo" 3)
118 (should (equal (eshell-get-old-input) "echo fou")))) 132 (should (equal (eshell-get-old-input) "echo fou"))))
119 133
134(ert-deftest em-prompt-test/forward-backward-matching-input ()
135 "Check that navigating forward/backward via regexps works correctly."
136 (em-prompt-test/forward-backward-matching-input-with))
137
138(ert-deftest em-prompt-test/forward-backward-matching-input-multiline ()
139 "Check forward/backward regexp navigation for multiline prompts."
140 (em-prompt-test--with-multiline
141 (em-prompt-test/forward-backward-matching-input-with)))
142
120;;; em-prompt-tests.el ends here 143;;; em-prompt-tests.el ends here