1

As in the question title, I want to know where the inferior Python shell stores its command history (the history you cycle through through with the up arrow).

I've been searching high and low. I'm trying to make this variable persistent using savehist-additional-variables, but I can't find the variable. I've looked for all variables containing history, ring, command, input, etc, and none of them have been it. The few I thought might be it all were valued nil despite my having stuff in my command history that I could cycle through.

1

The inferior Python shell uses comint for managing inputs. The variable you're looking for is most likely comint-input-ring. Just bear in mind that it's buffer-local.

  • Ohhhhhhh that probably explains it. I was looking at that variable, but I thought it wasn't it because it evaluated to nil. – Zorgoth Aug 11 '17 at 12:27
  • 1
    Is there an effective way to preserve the state of a buffer-local variable so that it will be set in the next *Python*Buffer? I don't want to use any kind of full Bowen session management. – Zorgoth Aug 11 '17 at 12:30
  • I suppose I could do it with advice or a repeating timer, but I'd rather use something built-in if possible. – Zorgoth Aug 11 '17 at 12:31
  • Oh I thin I'm being silly. When I'm at my computer I'll try the obvious thing of just putting it in the list. I was thinking I already did that but I think it was another variable I tried that on come to think of it. – Zorgoth Aug 11 '17 at 12:37
  • Yep, that should do the trick. – Wojciech Gac Aug 11 '17 at 12:39
0

This does not really answer your question, but using ipython as the python shell remembers history out-of-the-box:

(setq python-shell-interpreter "ipython")

You might need to add to fix some ipython weirdness:

(setq python-shell-interpreter-args "--simple-prompt -i")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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