GNU bug report logs -
#25028
26.0.50; comint-get-old-input-default: behavior follows docstring
Previous Next
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 #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here's a simple patch to tweak the behavior of
(comint-get-old-input-default) to do what the docstring says it should
do. Example:
1. emacs -Q
2. M-x shell
3. seq 5 [RET]
This produces the output
1
2
3
4
5
4. Move point to "3"
5. (comint-get-old-input-default)
According to the docstring, this should return the current line; i.e.
"3". Instead it returns "3\n4\n5\n" + the next prompt. This behavior can
produce lots of unwanted commands executing accidentally, and it goes
against what the docstring says.
[0001-comint-get-old-input-default-behavior-follows-docstr.patch (text/x-diff, inline)]
From 8af07631226f0dafc90c7d481085c2d08b37a710 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
Date: Fri, 25 Nov 2016 13:15:12 -0800
Subject: [PATCH] comint-get-old-input-default: behavior follows docstring
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.
---
lisp/comint.el | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lisp/comint.el b/lisp/comint.el
index b9c65b0..0288157 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2239,10 +2239,7 @@ comint-get-old-input-default
(null (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) (line-end-position)))))
(defun comint-copy-old-input ()
"Insert after prompt old input at point as new input to be edited.
--
2.8.0.rc3
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.