GNU bug report logs -
#27405
25.2; Make eshell-next-prompt more reliable
Previous Next
Reported by: Pierre Neidhardt <ambrevar <at> gmail.com>
Date: Sat, 17 Jun 2017 09:09:01 UTC
Severity: minor
Tags: confirmed, fixed, patch
Found in version 25.2
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #26 received at control <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 27405 + patch
quit
Pierre Neidhardt <ambrevar <at> gmail.com> writes:
>>
>> Hmm, maybe beginning-of-line would make more sense? If I have point on
>> the same line of the prompt I can get to the beginning of the prompted
>> line with C-a, so C-c C-p probably means I want to go farther back.
>
> Agreed. Please make the change and add a comment.
I think also that doing the text property check following the regexp
search doesn't really make sense, one or the other should be used, not
both:
[v2-0001-Make-eshell-next-prompt-more-reliable-Bug-27405.patch (text/x-diff, inline)]
From 1dd9644f1322d3b40ba98482d4aca0105db56d81 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Tue, 11 Jul 2017 22:11:19 -0400
Subject: [PATCH v2] 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.
---
lisp/eshell/em-prompt.el | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index 8c81b43b1f..2fd1db2113 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -161,14 +161,25 @@ (defun eshell-next-prompt (n)
"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'.
--
2.11.1
This bug report was last modified 8 years and 35 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.