-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I'm getting an error from pythonic which prevents me from opening new files in emacs:
pythonic-python-readable-file-name: Wrong type argument: stringp, nil
This happens after I've installed flx-ido, and am using M-x f to attempt to open a file. With flx-ido, there's an "extra" key sequence you can use (Ctrl-f) to exit IDO and use basic file opening which does work with pythonic.
I believe the problem is that pythonic-python-readable-file-name is assuming that the filename argument passed to it is non-nil. This is not always going to be the case:
https://stackoverflow.com/a/5414033
I don't really understand elisp, but I have replaced pythonic-python-readable file name with
(defun pythonic-python-readable-file-name (filename)
"Emacs to Python FILENAME conversion.
Take FILENAME from the perspective of the localhost and translate
it to the FILENAME Python process can read. Python can be
running locally or remotely. FILENAME can have local or tramp
format. Result will have local format."
(if filename
(let ((alias (pythonic-aliased-path (expand-file-name filename))))
(if (tramp-tramp-file-p alias)
(tramp-file-name-localname (tramp-dissect-file-name alias))
alias))
filename
))
And the problem goes away. In keeping with the "be liberal in what you accept" dictum, can you modify pythonic-python-readable-file-name to return filename if it is nil?