GNU bug report logs - #25028
26.0.50; comint-get-old-input-default: behavior follows docstring

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Fri, 25 Nov 2016 21:23:02 UTC

Severity: minor

Tags: fixed, patch

Found in versions 26.0.50, 24.5

Fixed in version 26.2

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 25028 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 25028 <at> debbugs.gnu.org
Subject: Re: bug#25028: 26.0.50;
 comint-get-old-input-default: behavior follows docstring
Date: Fri, 11 May 2018 07:11:49 -0400
[Message part 1 (text/plain, inline)]
Dima Kogan <dima <at> secretsauce.net> writes:

> lisp/comint.el (comint-get-old-input-default): Modify behavior to follow
> docstring: if `comint-use-prompt-regexp' is nil, then return the CURRENT LINE,
> if point is on an output field.

That patch returns current line when point is on an output field even if
comint-use-prompt-regexp is non-nil.  I think it should rather go like
this:

[0001-Fix-comint-get-old-input-default-for-output-field-ca.patch (text/x-diff, inline)]
From 8f1c83af6b69c0d6007b4afe68f2d61eb1bb98f2 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Fri, 11 May 2018 07:05:53 -0400
Subject: [PATCH] Fix comint-get-old-input-default for output field case
 (Bug#25028)

* lisp/comint.el (comint-get-old-input-default): Don't return whole
field when point was on an output field.
---
 lisp/comint.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index e81f739849..5c1918ffad 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2262,16 +2262,18 @@ comint-get-old-input-default
 If `comint-use-prompt-regexp' is non-nil, then return
 the current line with any initial string matching the regexp
 `comint-prompt-regexp' removed."
-  (let (bof)
+  (let (field-prop bof)
     (if (and (not comint-use-prompt-regexp)
              ;; Make sure we're in an input rather than output field.
-             (null (get-char-property (setq bof (field-beginning)) 'field)))
+             (not (setq field-prop (get-char-property
+                                    (setq bof (field-beginning)) 'field))))
 	(field-string-no-properties bof)
       (comint-bol)
-      (buffer-substring-no-properties (point)
-				      (if comint-use-prompt-regexp
-					  (line-end-position)
-					(field-end))))))
+      (buffer-substring-no-properties
+       (point)
+       (if (or comint-use-prompt-regexp (eq field-prop 'output))
+           (line-end-position)
+         (field-end))))))
 
 (defun comint-copy-old-input ()
   "Insert after prompt old input at point as new input to be edited.
-- 
2.11.0


This bug report was last modified 6 years and 349 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.