From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#28700: 25.2; Cannot kill Eshell buffer Date: Sun, 15 Oct 2017 22:20:52 -0400 Message-ID: <87376jj0jf.fsf@users.sourceforge.net> References: <87fuazb5hb.fsf@aol.com> <87y3orceiq.fsf@users.sourceforge.net> <874lrfatm6.fsf@aol.com> <87zi979bxb.fsf@aol.com> <87tvzeahuz.fsf@aol.com> <87o9pmae0q.fsf@aol.com> <87efqia7fv.fsf@aol.com> <87vajucw4a.fsf@users.sourceforge.net> <87o9p8p6sn.fsf@aol.com> <87bml88a55.fsf@users.sourceforge.net> <87d15ooyr5.fsf@aol.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1508120542 18195 195.159.176.226 (16 Oct 2017 02:22:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Oct 2017 02:22:22 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 28700@debbugs.gnu.org To: Live System User Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 16 04:22:18 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 1e3v2h-0003CQ-FS for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 04:22:11 +0200 Original-Received: from localhost ([::1]:59024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3v2n-0001kt-8W for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Oct 2017 22:22:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3v2b-0001jg-Vi for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 22:22:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3v2Y-0000bu-RY for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 22:22:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33509) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e3v2Y-0000bq-Lp for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 22:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e3v2Y-0004YH-Bs for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 22:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Oct 2017 02:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28700 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: unreproducible moreinfo Original-Received: via spool by 28700-submit@debbugs.gnu.org id=B28700.150812046317424 (code B ref 28700); Mon, 16 Oct 2017 02:22:02 +0000 Original-Received: (at 28700) by debbugs.gnu.org; 16 Oct 2017 02:21:03 +0000 Original-Received: from localhost ([127.0.0.1]:42190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3v1b-0004Wt-2n for submit@debbugs.gnu.org; Sun, 15 Oct 2017 22:21:03 -0400 Original-Received: from mail-it0-f42.google.com ([209.85.214.42]:54894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3v1Y-0004Vz-U9; Sun, 15 Oct 2017 22:21:01 -0400 Original-Received: by mail-it0-f42.google.com with SMTP id 72so16397454itk.3; Sun, 15 Oct 2017 19:21:00 -0700 (PDT) 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=noJ+J01dK8E/88BYXn56fGj1/HQmgEj/Otp17ucZYWw=; b=MQs4C1OJDwF1rGrS26ptytmuLxIiTTxV75TI+SUOQGPH+6QPUOPz+i5v5xfDMfJ1Br CN1kfFpRGS9AR9QUOhzt4zN5Q1DFwpP/mtmUhePdqlJRUBOG6k/kTITPAX8lJJpYY9Yl Vw6CwNlYp0QkIM3A75Iwulh9DFET3zr03zjXpC5jfRPPqNSQEMiRX+jHMd5z8JzPTed6 dS46YHAooDl81wlfH17Upw7r5XiqWUXLYHaGZd0LmTwh1xkVjRMjj85W0nZE1mtRBF4v laRUYYwmd5Z75k6xWnaYGOUAC6lToUzOSL9NzFEo9PcQ8HSnnxOIrqeQRCwX9MEYOxG1 0jdg== 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=noJ+J01dK8E/88BYXn56fGj1/HQmgEj/Otp17ucZYWw=; b=ZYeSroixIsVeWoSQ95xF154seuDVRy0El82TiAg9py+pR14D3wCj50Mdks/dzuV1uW uZXNeOQaKlTKz+EmOoUW0kP3zz6sCCfyagpvYDH/jbpINo0Ao7WIZCZvd0n+Fw4KRDyJ 3U6mWx7kPi0LrLLCf1egaR2N78k0/udKwKClA4GdvfedxF2APYqg2QGNTBGEJkBL2ISw Ah+Ozx6hiMvNYZgIi4I+Fu4HHJ2HdxscxvBPrHnFKVWi3rwLCFzBCuDqigRs3SzzAqbV tmnmCKdG5Af3sKfS5jQPAWd1g/wawWBI7KLJQFjs9J35fmSwdeqL0HvkPPcL3Jl3cmCi u0jA== X-Gm-Message-State: AMCzsaViIUb9OTg5pemwRVKPtzZzIuyKyETeDL7zK2e7MggP0yyc9/I1 MufJTK6+fyMVwpteZHfuNXr01g== X-Google-Smtp-Source: AOwi7QAqfstLVDVj9iXkR4jVtw82+dYF++epg5rFqPnbodT19LNxx7PnbcGbJwd1MHpU/VqmwKraPg== X-Received: by 10.36.123.74 with SMTP id q71mr10845842itc.97.1508120455126; Sun, 15 Oct 2017 19:20:55 -0700 (PDT) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id e95sm3089908iod.41.2017.10.15.19.20.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Oct 2017 19:20:54 -0700 (PDT) In-Reply-To: <87d15ooyr5.fsf@aol.com> (Live System User's message of "Sun, 15 Oct 2017 18:02:54 -0400") 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:138488 Archived-At: --=-=-= Content-Type: text/plain tags 28700 = patch quit Live System User writes: >> Thanks, my guess is you have some string with a read-only property in >> eshell history (probably introduced by copying from another buffer), and >> this is tripping up eshell-write-history. >> >> Can you post the result of >> >> M-x pp-eval-expression RET eshell-history-ring RET >> >> If my guess is correct there should be some strings of the form >> >> #("some command" 0 11 (read-only t)) > > Yes. So how do I deal wi'th? > #("~/" 0 1 > (rear-nonsticky > (arg-begin arg-end) > read-only t arg-begin t) > 1 2 > (rear-nonsticky > (arg-end arg-begin) > read-only t arg-end t)) Ah, there we are. I can't quite work out exactly how you managed to get such a string, but stripping properties in eshell-write-history should take care of it regardless. If you evaluate the following defun in your emacs session, it should be able to exit: (defun eshell-write-history (&optional filename append) "Writes the buffer's `eshell-history-ring' to a history file. The name of the file is given by the variable `eshell-history-file-name'. The original contents of the file are lost if `eshell-history-ring' is not empty. If `eshell-history-file-name' is nil this function does nothing. Useful within process sentinels. See also `eshell-read-history'." (let ((file (or filename eshell-history-file-name))) (cond ((or (null file) (equal file "") (null eshell-history-ring) (ring-empty-p eshell-history-ring)) nil) ((not (file-writable-p file)) (message "Cannot write history file %s" file)) (t (let* ((ring eshell-history-ring) (index (ring-length ring))) ;; Write it all out into a buffer first. Much faster, but ;; messier, than writing it one line at a time. (with-temp-buffer (while (> index 0) (setq index (1- index)) (let ((start (point))) ;; Remove properties before inserting, to avoid trouble ;; with read-only strings (Bug#28700). (insert (substring-no-properties (ring-ref ring index)) ?\n) (subst-char-in-region start (1- (point)) ?\n ?\177))) (eshell-with-private-file-modes (write-region (point-min) (point-max) file append 'no-message)))))))) Here's the corresponding patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Ignore-string-properties-when-saving-eshell-history-.patch Content-Description: patch >From ffaeb09ca6ef9b3d97c8b378c1e5c2b2723dae6f Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 15 Oct 2017 16:41:17 -0400 Subject: [PATCH] Ignore string properties when saving eshell history (Bug#28700) * lisp/eshell/em-hist.el (eshell-write-history): Remove properties before inserting history strings. (eshell-read-history): Remove obsolete comment. --- lisp/eshell/em-hist.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 1ab3c60b2c..8084c12653 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -444,7 +444,6 @@ eshell-read-history (ignore-dups eshell-hist-ignoredups)) (with-temp-buffer (insert-file-contents file) - ;; Save restriction in case file is already visited... ;; Watch for those date stamps in history files! (goto-char (point-max)) (while (and (< count size) @@ -488,7 +487,9 @@ eshell-write-history (while (> index 0) (setq index (1- index)) (let ((start (point))) - (insert (ring-ref ring index) ?\n) + ;; Remove properties before inserting, to avoid trouble + ;; with read-only strings (Bug#28700). + (insert (substring-no-properties (ring-ref ring index)) ?\n) (subst-char-in-region start (1- (point)) ?\n ?\177))) (eshell-with-private-file-modes (write-region (point-min) (point-max) file append -- 2.11.0 --=-=-=--