I'm missing the input histories like what's in IPython. But it seems that the defaults do not keep input histories after the comint buffer is killed. Also I'd like to keep them between emacs sessions.

  • For me, at least for some comint buffers (M-x shell) if I kill that buffer, and then create a new one with the same name, Emacs remembers its history. But, maybe it's reading Bash history for that - I don't know.
    – wvxvw
    Commented Jun 25, 2018 at 5:27

1 Answer 1


As far as I can tell, comint offers the variable comint-input-ring-file-name for this. It wouldn't make much sense to use this globally, because all "frontend" functions that use comint under the hood would mix their history.

Instead, the frontends maintain their own history by making comint-input-ring-file-name buffer-local and setting it to something suitable.

Examples for how modes do this:

See also this post where someone discussed the same issue: https://oleksandrmanzyuk.wordpress.com/2011/10/23/a-persistent-command-history-in-emacs/

Also, see savehist the comint input ring


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.