emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 87fc99f: Better support for the case of typing RE


From: Juri Linkov
Subject: [Emacs-diffs] emacs-24 87fc99f: Better support for the case of typing RET on the prompt in comint.
Date: Tue, 10 Feb 2015 00:39:03 +0000

branch: emacs-24
commit 87fc99fee17ef1df4c22db15ec783a7735d3fc6b
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    Better support for the case of typing RET on the prompt in comint.
    
    * lisp/comint.el (comint-get-old-input-default): Go to the field end
    when comint-use-prompt-regexp is nil.
    (comint-line-beginning-position): Check if point is already
    on the prompt before searching for the prompt when
    comint-use-prompt-regexp is non-nil.
    
    Fixes: debbugs:19710
---
 lisp/ChangeLog |   10 ++++++++++
 lisp/comint.el |    8 ++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 728b983..ea428b1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2015-02-10  Juri Linkov  <address@hidden>
+
+       Better support for the case of typing RET on the prompt in comint.
+
+       * comint.el (comint-get-old-input-default): Go to the field end
+       when comint-use-prompt-regexp is nil.
+       (comint-line-beginning-position): Check if point is already
+       on the prompt before searching for the prompt when
+       comint-use-prompt-regexp is non-nil.  (Bug#19710)
+
 2015-02-08  Eli Zaretskii  <address@hidden>
 
        * frame.el (frame-notice-user-settings): Refresh the value of
diff --git a/lisp/comint.el b/lisp/comint.el
index 419938e..c81551a 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2215,7 +2215,10 @@ the current line with any initial string matching the 
regexp
              (null (get-char-property (setq bof (field-beginning)) 'field)))
        (field-string-no-properties bof)
       (comint-bol)
-      (buffer-substring-no-properties (point) (line-end-position)))))
+      (buffer-substring-no-properties (point)
+                                     (if comint-use-prompt-regexp
+                                         (line-end-position)
+                                       (field-end))))))
 
 (defun comint-copy-old-input ()
   "Insert after prompt old input at point as new input to be edited.
@@ -2263,8 +2266,9 @@ a buffer local variable."
   (if comint-use-prompt-regexp
       ;; Use comint-prompt-regexp
       (save-excursion
-       (re-search-backward comint-prompt-regexp nil t)
        (beginning-of-line)
+       (unless (looking-at comint-prompt-regexp)
+         (re-search-backward comint-prompt-regexp nil t))
        (comint-skip-prompt)
        (point))
     ;; Use input fields.  Note that, unlike the behavior of



reply via email to

[Prev in Thread] Current Thread [Next in Thread]