I normally use C-x C-f to counsel-find-file by every time I try using it in python-mode, it starts up the Python Shell in a buffer. I've tried investigating whether there is a hotkey conflict using "C-h b", but all that comes up when I search through "C-h b" for "C-x C-f" is:

C-x C-f        counsel-find-file
C-x C-k C-f    kmacro-set-format
C-x 4 C-f      find-file-other-window
C-x 5 C-f      find-file-other-frame

Can anyone help me figure out why C-x C-f is starting up the Python shell in python mode?

  • 1
    What does C-h c C-x C-f show? Also, press C-h l immediately after C-x C-f. What's on the line with C-x C-f? – Gilles 'SO- stop being evil' Aug 19 '19 at 8:54
  • For the first I get "C-x C-f runs the command counsel-find-file". For the second, when I press C-x C-f it opens a python shell and simultaneously runs counsel-find-file, so I can't type "C-h l" while in the minibuffer. If I only have 1 buffer open with source code, this is what I see immediately after doing C-x C-f. – Paradox Aug 19 '19 at 9:39
  • 1
    You can press C-h l at any time. Please do this after the problematic C-x C-f and copy-paste the last few lines from the *Help* buffer. – Gilles 'SO- stop being evil' Aug 19 '19 at 9:42
  • Ah, I see. C-h l was overriden by counsel-load-library. But I was able to M-x view-lossage. Unfortunately doesn't seem to mention python shell <ns-open-file-line> [ns-open-file-select-line] <down-mouse-1> [mouse-drag-region] <mouse-1> [mouse-set-point] C-x C-f [counsel-find-file] C-g [minibuffer-keyboard-quit] M-x [counsel-M-x] ... <return> [ivy-done] – Paradox Aug 19 '19 at 10:02
  • 1
    Wow, overriding help bindings is evil. So it seems that starting the Python shell is not due to a binding. Hmmm. Do you know the name of a function that's involved in starting or displaying the Python shell? If so you can set it to debug on entry and look at the backtrace. E.g. M-x debug-on-entry RET python-shell-get-buffer RET. – Gilles 'SO- stop being evil' Aug 19 '19 at 10:08

Your Answer

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

Browse other questions tagged or ask your own question.