-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
* layers/+lang/python/funcs.el: Rewrite spacemacs/pyenv-executable-find to support list #16819
base: develop
Are you sure you want to change the base?
Conversation
…nd to support list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for this contribution.
(setq i (1+ i)))) | ||
executable)) | ||
(executable-find command))) | ||
(defun spacemacs/pyenv-executable-find (commands) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function might be called in user configs. It would be nicer if it continued to accept a single command and treated it as a singleton list, for backwards compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also avoid some unnecessary changes in this same file.
(defun spacemacs/pyenv-executable-find (commands) | ||
"Find executable taking pyenv shims into account. If the pyenv was | ||
configured with \"system\" then the system exectutable will be included, | ||
otherwise the system executable will be ignored." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add documentation about how the function handles the commands argument? Specifically, it's important to note that it will return some path corresponding to some command (the first one that appears in the list?)
(thing-at-point 'line)))) | ||
(line (thing-at-point 'line))) | ||
(let* ((exe (spacemacs/pyenv-executable-find '("trepan3k" "wdb" "ipdb3" "pudb3" "ipdb" "pudb" "python3"))) | ||
(trace (pcase (file-name-nondirectory (or exe "")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: (and exe (file-name-nondirectory exe))
would be more elegant here, IMO (avoid unnecessarily calling the function file-name-nondirectory
).
Rewrite the function
spacemacs/pyenv-executable-find
for better performance.Original function will invoke the '/bin/pyenv' twice to determine one command; then it has 24 invokes for the
/bin/pyenv
triggered by the functionspacemacs/python-toggle-breakpoint
on my local, with this patch the calls will reduce to 8.Please help review the changes, thanks