Subject: bug#5148: Lossage in comint history

From: Stefan Monnier <[email-masked]>
Date: Mon, 07 Dec 2009 14:23:46 -0500

> Using M-x shell in Emacs causes lossage in .bash_history.
> I set HISTFILESIZE and HISTSIZE to large values in .bashrc
> to not truncate the history file but comint.el disregards
> my settings and truncates the history file used by bash.

That's the bug, yes, thank you.

> The following patch make `comint-input-ring-size' customizable.
> The type should be `integer' because this value is used by `make-ring'
> to create the history ring.  The default value increased to 500
> to be the same as the default value of HISTFILESIZE and HISTSIZE.

Actually, to fix the bug right, comint-read-input-ring should be changed
to grow the ring so as to accomodate all the saved history.  This might
still truncate it more than bash would have, but at least it won't make
your .bash_history shorter than it was.

        Stefan

> Index: lisp/comint.el
> ===================================================================
> RCS file: /sources/emacs/emacs/lisp/comint.el,v
> retrieving revision 1.402
> diff -c -r1.402 comint.el
> *** lisp/comint.el	1 Dec 2009 20:32:00 -0000	1.402
> --- lisp/comint.el	7 Dec 2009 17:27:08 -0000
> ***************
> *** 309,317 ****
>     :type 'integer
>     :group 'comint)
  
> ! ;; FIXME: this should be defcustom
> ! (defvar comint-input-ring-size 150
> !   "Size of input history ring.")
  
>   (defvar comint-input-ring-separator "\n"
>     "Separator between commands in the history file.")
> --- 309,319 ----
>     :type 'integer
>     :group 'comint)
  
> ! (defcustom comint-input-ring-size 500
> !   "Size of input history ring."
> !   :type 'integer
> !   :group 'comint
> !   :version "23.2")
  
>   (defvar comint-input-ring-separator "\n"
>     "Separator between commands in the history file.")

> -- 
> Juri Linkov
> http://www.jurta.org/emacs/