From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#25838: 25.1; Eshell history polluted by eshell/clear Date: Wed, 22 Feb 2017 22:05:06 -0500 Message-ID: <87wpchfvz1.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1487819122 17904 195.159.176.226 (23 Feb 2017 03:05:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Feb 2017 03:05:22 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 25838@debbugs.gnu.org To: Thomas Ferreira Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 23 04:05:14 2017 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 1cgjiT-0003hL-RZ for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Feb 2017 04:05:14 +0100 Original-Received: from localhost ([::1]:56165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgjiX-0002As-M3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Feb 2017 22:05:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgjiR-000279-2G for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2017 22:05:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgjiI-0004tn-VM for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2017 22:05:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53615) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cgjiI-0004tj-Rv for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2017 22:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cgjiI-0004h7-FL for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2017 22:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Feb 2017 03:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25838 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25838-submit@debbugs.gnu.org id=B25838.148781904317976 (code B ref 25838); Thu, 23 Feb 2017 03:05:02 +0000 Original-Received: (at 25838) by debbugs.gnu.org; 23 Feb 2017 03:04:03 +0000 Original-Received: from localhost ([127.0.0.1]:51814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgjhK-0004fn-Dj for submit@debbugs.gnu.org; Wed, 22 Feb 2017 22:04:02 -0500 Original-Received: from mail-it0-f42.google.com ([209.85.214.42]:38818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgjhI-0004fE-Jr; Wed, 22 Feb 2017 22:04:01 -0500 Original-Received: by mail-it0-f42.google.com with SMTP id y135so2707329itc.1; Wed, 22 Feb 2017 19:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=wK6cr1nfviLlRd6lP3Xvjmh3smr13HNoGmTxXLaLpzE=; b=Nf0Y40VTs4AGsuyawrhKNn7CvOJJeMlsRSbpPyTRkzEuv0d/BSbiNA9Bdz0aVObLMO zGEXSpepfHb0Qm+uTdQ4RGow1fL/4/SPA+tKYTe97eoxeZ+FDTuJxeTX4yfwB5tP0eDB +AdMYdBMBwJef9lNnE6G6LMKz0pSZ1QnG2dKrvbuzIkUjis7slsZIrKg05jjGsz30H6o Obh8EwNpKYVm0ng4aCmcS8uuPpeIj+pX4kzw0IjkIafgTW8T14NGPf8tFyKKTwzts1pr PRNgQWj6WnIFYeVwJbm0Z73/48EZg0HvsEPbmexg/YR+3qJB3H0lRRocrTlYnrDNsQaJ jDPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=wK6cr1nfviLlRd6lP3Xvjmh3smr13HNoGmTxXLaLpzE=; b=Rei6E8/2l5mzPwslX+Trd513y/PpyJTQrQyvY8VQeIX5sVoIqzwPR98ZLXzunO7aIa NHX4OaEGWuCCdIq7fJbJFEmTVaGbJr0OBxT/OSKXnyu/qLmW6L9BmzMS/ht/QzacohHM ZI8DavMhTH6E2FvTr2T4w61S4hovrs2k06YHfTBXZVmTAHrrylfNlYl2Z9Q7fJb6bv/b TzMK/I0p2xosTR1eC2DfC7CJf0wx2gbaAtg5PaYj83A+lllW3Gm22Pbb8NwUWOO9+2XL P1u+sSJ8RyzQJf7AmAPF0MPvQJTRqUG8p0e/CWpaTQ8A+LrDZUZtl+YbD1capkm+jDlg 9Icg== X-Gm-Message-State: AMke39kzLHGb8/lx1V2la1abPGIAxYTds0LQKLUsfegQIgLotWteuoHVppVjIAvhssEQMA== X-Received: by 10.107.144.9 with SMTP id s9mr26338385iod.146.1487819035048; Wed, 22 Feb 2017 19:03:55 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id y126sm1534941itf.14.2017.02.22.19.03.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Feb 2017 19:03:54 -0800 (PST) In-Reply-To: (Thomas Ferreira's message of "Wed, 22 Feb 2017 06:03:13 -0500") 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:129678 Archived-At: --=-=-= Content-Type: text/plain severity 25838 minor tags 25838 patch quit Thomas Ferreira writes: > In eshell: > > ~ $ history > 1 history > ~ $ eshell/clear > [...] > ~ $ > [...] > ~ $ history > 1 history > 2 eshell/clear > 3 > [...] > 4 history > > An easy (dirty?) way to fix it could be override eshell-input-filter (from em-hist.el): IMO, it should be filtering out newlines anyway, but since it is customizable, it's not quite a satisfactory fix. We should also disable eshell-add-to-history while sending the `eshell/clear'ing lines: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Don-t-record-eshell-clear-command-in-history-Bug-.patch Content-Description: patch >From 8235a5510c5e0dd8262fe1ae2960d5d03883d617 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 22 Feb 2017 21:48:29 -0500 Subject: [PATCH v1] Don't record eshell/clear "command" in history (Bug#25838) `eshell/clear' is implemented by sending a series of blank lines, which is not a useful thing to have in the history. * lisp/eshell/em-hist.el (eshell-input-filter-default): Use `string-blank-p' which does check for newlines (even though newlines have comment-end syntax, not whitespace syntax class). * lisp/eshell/esh-mode.el (eshell/clear): Remove `eshell-add-to-history' from `eshell-input-filter-functions' while sending the blank lines. This change is needed to solve the bug if the user customizes `eshell-input-filter' to something that doesn't filter newlines. --- lisp/eshell/em-hist.el | 3 ++- lisp/eshell/esh-mode.el | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 99158c7686..5c6e629120 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -55,6 +55,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) ; `string-blank-p' (require 'ring) (require 'esh-opt) @@ -208,7 +209,7 @@ eshell-rebind-keys-alist (defun eshell-input-filter-default (input) "Do not add blank input to input history. Returns non-nil if INPUT is blank." - (not (string-match "\\`\\s-*\\'" input))) + (not (string-blank-p input))) (defun eshell-input-filter-initial-space (input) "Do not add input beginning with empty space to history. diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index b1195c9e1d..0fd0c18301 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -882,8 +882,10 @@ eshell/clear (interactive) (if scrollback (eshell/clear-scrollback) - (insert (make-string (window-size) ?\n)) - (eshell-send-input))) + (let ((eshell-input-filter-functions + (remq 'eshell-add-to-history eshell-input-filter-functions))) + (insert (make-string (window-size) ?\n)) + (eshell-send-input)))) (defun eshell/clear-scrollback () "Clear the scrollback content of the eshell window." -- 2.11.1 --=-=-=--