From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#25028: 26.0.50; comint-get-old-input-default: behavior follows docstring Date: Fri, 25 Nov 2016 13:22:05 -0800 Message-ID: <87a8cn5k76.fsf@secretsauce.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1480108994 4588 195.159.176.226 (25 Nov 2016 21:23:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 25 Nov 2016 21:23:14 +0000 (UTC) To: 25028@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 25 22:23:10 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cANxd-0000KI-8L for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 Nov 2016 22:23:09 +0100 Original-Received: from localhost ([::1]:47954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cANxg-0006pz-Q4 for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 Nov 2016 16:23:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cANxa-0006pi-4l for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2016 16:23:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cANxX-0007g0-05 for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2016 16:23:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54627) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cANxW-0007fh-S8 for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2016 16:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cANxW-0005TJ-Jc for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2016 16:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 25 Nov 2016 21:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25028 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148010894220959 (code B ref -1); Fri, 25 Nov 2016 21:23:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Nov 2016 21:22:22 +0000 Original-Received: from localhost ([127.0.0.1]:41793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cANwr-0005Rz-Rt for submit@debbugs.gnu.org; Fri, 25 Nov 2016 16:22:22 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52557) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cANwp-0005Rm-Ie for submit@debbugs.gnu.org; Fri, 25 Nov 2016 16:22:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cANwj-0007L9-Ed for submit@debbugs.gnu.org; Fri, 25 Nov 2016 16:22:14 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:37387) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cANwj-0007L5-BG for submit@debbugs.gnu.org; Fri, 25 Nov 2016 16:22:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cANwi-0006eG-2U for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2016 16:22:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cANwe-0007Jm-TK for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2016 16:22:12 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:57579) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cANwe-0007J9-Lr for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2016 16:22:08 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A5EAD208A2 for ; Fri, 25 Nov 2016 16:22:06 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 25 Nov 2016 16:22:06 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=content-type:date:from:message-id:mime-version:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=WTh Qm+8k8fLuxASUuNQAdHY5Cjs=; b=KeS0zeRpMmNoGI9EP9iivfW4/K4iym9d/42 ScDjrFbP5ffc92fx07SYCPxypzhxx6V2UwTLhUICy0r3mu05dV9UQaCDJThZLGWV OmJ7Cpk+hxt295C13JxQ0yCH3oQ5gNfB3jPNHbLQ2689GgLPYDCWMI0BQ/mcMfeV 5HZC2FGo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=smtpout; bh=WThQm+8k8fLuxASUuNQAdHY5Cjs=; b=EAkjS qhimn5G2m1u1dfZocM9GRAYxZih8Mnpdi3hWHS3g5qUXNr86ekcIG+Ny9tfwIoH9 W+xRmHFSfNUw5GJUyac9vcz/EKA3pN8JTl/SgwWCPVhztP950p8WMUxeKbb9GG9C MBlQx4zCXN38PVApEcNDok/mDIGi/sI1A7yN1o= X-ME-Sender: X-Sasl-enc: 6oOf6htabs6n9DATy1L3F1mRuiug8li5QPA6ps2ZiSf1 1480108926 Original-Received: from scrawny (50-1-153-216.dsl.dynamic.fusionbroadband.com [50.1.153.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3ED497E046 for ; Fri, 25 Nov 2016 16:22:06 -0500 (EST) Original-Received: from dima by scrawny with local (Exim 4.87) (envelope-from ) id 1cANwb-0002gT-4J for bug-gnu-emacs@gnu.org; Fri, 25 Nov 2016 13:22:05 -0800 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:126091 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-comint-get-old-input-default-behavior-follows-docstr.patch >From 8af07631226f0dafc90c7d481085c2d08b37a710 Mon Sep 17 00:00:00 2001 From: Dima Kogan 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 --=-=-=--