From: Pete Beardmore <pete.beardmore@msn.com>
To: 7899@debbugs.gnu.org
Subject: bug#7899: Unsatisfactory interaction between shell-mode-hook and comint-read-input-ring
Date: Mon, 27 May 2013 08:44:25 +0100 [thread overview]
Message-ID: <BLU0-SMTP2042915E4D3C655AD0C80F68A960@phx.gbl> (raw)
In-Reply-To: <87y66b3042.fsf@sc3d.org>
[-- Attachment #1: Type: text/plain, Size: 904 bytes --]
[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
[-- Attachment #2: 0001.comint_.ensure.buffer.local.comint-input-ring-read-size.variable.is.visible.throughout.input-read-ring.diff --]
[-- Type: text/x-patch, Size: 1582 bytes --]
#------------------------------------------------------------
#revno: 112736
#committer: Pete Beardmore <pete.beardmore@msn.com>
#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)
[-- Attachment #3: 0001.comint_.don't.strip.anything.by.default.on.comint-input-ring-read.diff --]
[-- Type: text/x-patch, Size: 715 bytes --]
#------------------------------------------------------------
#revno: 112737
#committer: Pete Beardmore <pete.beardmore@msn.com>
#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
next prev parent reply other threads:[~2013-05-27 7:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-23 19:12 bug#7899: 23.2.91; Unsatisfactory interaction between shell-mode-hook and comint-read-input-ring Reuben Thomas
2013-05-27 7:44 ` Pete Beardmore [this message]
2013-05-30 12:55 ` bug#7899: " Pete Beardmore
2021-05-10 11:16 ` bug#7899: 23.2.91; " Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BLU0-SMTP2042915E4D3C655AD0C80F68A960@phx.gbl \
--to=pete.beardmore@msn.com \
--cc=7899@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.