From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pete Beardmore Newsgroups: gmane.emacs.bugs Subject: bug#7899: Unsatisfactory interaction between shell-mode-hook and comint-read-input-ring Date: Mon, 27 May 2013 08:44:25 +0100 Message-ID: References: <87y66b3042.fsf@sc3d.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_1u-lG5sBzdOGXxkkad3Pjw1" X-Trace: ger.gmane.org 1369640719 17592 80.91.229.3 (27 May 2013 07:45:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 May 2013 07:45:19 +0000 (UTC) To: 7899@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 27 09:45:17 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ugs7I-0007pp-5L for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 May 2013 09:45:16 +0200 Original-Received: from localhost ([::1]:38760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ugs7H-0004gB-Na for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 May 2013 03:45:15 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ugs74-0004ac-Ug for bug-gnu-emacs@gnu.org; Mon, 27 May 2013 03:45:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ugs6t-0008Lo-Et for bug-gnu-emacs@gnu.org; Mon, 27 May 2013 03:45:02 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ugs6t-0008Le-Ag for bug-gnu-emacs@gnu.org; Mon, 27 May 2013 03:44:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Ugs81-0004uP-Mm for bug-gnu-emacs@gnu.org; Mon, 27 May 2013 03:46:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87y66b3042.fsf@sc3d.org> Resent-From: Pete Beardmore Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 May 2013 07:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7899 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7899-submit@debbugs.gnu.org id=B7899.136964074918851 (code B ref 7899); Mon, 27 May 2013 07:46:01 +0000 Original-Received: (at 7899) by debbugs.gnu.org; 27 May 2013 07:45:49 +0000 Original-Received: from localhost ([127.0.0.1]:36106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ugs7o-0004tz-2B for submit@debbugs.gnu.org; Mon, 27 May 2013 03:45:48 -0400 Original-Received: from blu0-omc1-s5.blu0.hotmail.com ([65.55.116.16]:6638) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ugs7l-0004tf-1z for 7899@debbugs.gnu.org; Mon, 27 May 2013 03:45:46 -0400 Original-Received: from BLU0-SMTP204 ([65.55.116.9]) by blu0-omc1-s5.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 27 May 2013 00:44:28 -0700 X-EIP: [Q0gD7MG1Rr70IcrmRT9FBCL16U35x414] X-Originating-Email: [pete.beardmore@msn.com] Original-Received: from elservo.lemondedelabarbe ([93.97.95.47]) by BLU0-SMTP204.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 27 May 2013 00:44:26 -0700 Original-Received: by elservo.lemondedelabarbe (Postfix, from userid 80) id A6582140C7A; Mon, 27 May 2013 08:44:25 +0100 (BST) Original-Received: from elbeardo.lemondedelabarbe (elbeardo.lemondedelabarbe [10.0.0.5]) by elservo.lemondedelabarbe (Horde Framework) with HTTP; Mon, 27 May 2013 08:44:25 +0100 User-Agent: Internet Messaging Program (IMP) H5 (6.0.4) X-OriginalArrivalTime: 27 May 2013 07:44:27.0025 (UTC) FILETIME=[03861010:01CE5AAE] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74594 Archived-At: --=_1u-lG5sBzdOGXxkkad3Pjw1 Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=Yes Content-Disposition: inline [patches against bzr master attached (hopefully!)] hi, i believe this is a bug in comint-read-input-ring. shell-mode sets a buffer-local version of comint-read-input-size which is effectively ignored due to comint-read-input-ring's use of '(with-temp-buffer ...' . i've lost ~40000 line bash history on more than one occasion over the last several years and am elated to have finally pinned the problem on something (very loosely) related to this issue is the question of why the default of 'comint-input-history-ignore' is set to anything at all? it's currently "^#", and therefore without having pro-actively made any changes to their emacs setup, a user's shell history (for instance) doesn't emerge unscathed from a trip through comint if it contains comments. if modifying this default touches too many other comint uses, perhaps an override in shell-mode.el? cheers, Pete --=_1u-lG5sBzdOGXxkkad3Pjw1 Content-Type: text/x-patch; charset="us-ascii"; name*0="0001.comint_.ensure.buffer.local.comint-input-ring-read-size.variabl"; name*1="e.is.visible.throughout.input-read-ring.diff" Content-Disposition: attachment; filename*0= "0001.comint_.ensure.buffer.local.comint-input-ring-read-size.var"; filename*1="iable.is.visible.throughout.input-read-ring.diff"; size=1582 #------------------------------------------------------------ #revno: 112736 #committer: Pete Beardmore #branch nick: bzr #timestamp: Mon 2013-05-27 07:53:30 +0100 #message: # comint: ensure buffer local comint-input-ring-read-size variable is visible throughout input-read-ring logic === modified file 'lisp/comint.el' --- lisp/comint.el 2013-05-25 02:40:33 +0000 +++ lisp/comint.el 2013-05-27 06:53:30 +0000 @@ -938,6 +938,7 @@ ;; to huge numbers. Don't allocate a huge ring right ;; away; there might not be that much history. (ring-size (min 1500 comint-input-ring-size)) + (ring-size-max (max 1500 comint-input-ring-size)) (ring (make-ring ring-size))) (with-temp-buffer (insert-file-contents file) @@ -945,7 +946,7 @@ ;; Watch for those date stamps in history files! (goto-char (point-max)) (let (start end history) - (while (and (< count comint-input-ring-size) + (while (and (< count ring-size-max) (re-search-backward comint-input-ring-separator nil t) (setq end (match-beginning 0))) @@ -963,7 +964,7 @@ (not (string-equal (ring-ref ring 0) history)))) (when (= count ring-size) - (ring-extend ring (min (- comint-input-ring-size ring-size) + (ring-extend ring (min (- ring-size-max ring-size) ring-size)) (setq ring-size (ring-size ring))) (ring-insert-at-beginning ring history) --=_1u-lG5sBzdOGXxkkad3Pjw1 Content-Type: text/x-patch; charset="us-ascii"; name*0="0001.comint_.don't.strip.anything.by.default.on.comint-input-ring-re"; name*1="ad.diff" Content-Disposition: attachment; filename*0= "0001.comint_.don't.strip.anything.by.default.on.comint-input-rin"; filename*1="g-read.diff"; size=715 #------------------------------------------------------------ #revno: 112737 #committer: Pete Beardmore #branch nick: bzr #timestamp: Mon 2013-05-27 08:12:04 +0100 #message: # comint: don't strip anything by default on comint-input-ring-read === modified file 'lisp/comint.el' --- lisp/comint.el 2013-05-27 06:53:30 +0000 +++ lisp/comint.el 2013-05-27 07:12:04 +0000 @@ -318,7 +318,7 @@ (defvar comint-input-ring-separator "\n" "Separator between commands in the history file.") -(defvar comint-input-history-ignore "^#" +(defvar comint-input-history-ignore "" "Regexp for history entries that should be ignored when Comint initializes.") (defcustom comint-process-echoes nil --=_1u-lG5sBzdOGXxkkad3Pjw1--