Open whompyjaw opened 3 years ago
I made it C-c Cr f
work, you could try to edit ~/.emacs.d/elpa/elpy-20201115.1811/elpy.el
and add a custom kbdmap, like this
(defvar elpy-refactor-map
(let ((map (make-sparse-keymap "Refactor")))
(define-key map (kbd "i") (cons (format "%snline"
(propertize "i" 'face 'bold))
'elpy-refactor-inline))
(define-key map (kbd "e") (cons (format "function %sxtraction"
(propertize "e" 'face 'bold))
'elpy-refactor-extract-function))
(define-key map (kbd "f") (cons (format "elpy-%sormat-code"
(propertize "f" 'face 'bold))
'elpy-format-code))
(define-key map (kbd "v") (cons (format "%sariable extraction"
(propertize "v" 'face 'bold))
'elpy-refactor-extract-variable))
(define-key map (kbd "r") (cons (format "%sename"
(propertize "r" 'face 'bold))
'elpy-refactor-rename))
map)
"Key map for the refactor command.")
Then, when you reopen emacs and activate C-c C-r f
, those options jump out.
Refactor: rename, variable extraction, f = elpy-format-code, e = function extraction, inline
My emacs env is below, hope it works.
Elpy Configuration
Emacs.............: 27.1
Elpy..............: 1.35.0
Virtualenv........: 3.9.4-dev (/Users/admin/.pyenv/versions/3.9.4/envs/3.9.4-dev)
Interactive Python: jupyter 4.7.1 (/Users/admin/.pyenv/shims/jupyter)
RPC virtualenv....: .pyenv (/Users/admin/.pyenv)
Python...........: python3 3.9.4 (/Users/admin/.pyenv/shims/python3)
Jedi.............: 0.18.0
Rope.............: 0.19.0
Autopep8.........: 1.5.6
Yapf.............: 0.31.0
Black............: 21.4b0
Syntax checker....: flake8 (/Users/admin/.pyenv/shims/flake8)
I'd like to vote this up too. The error has even found its way to the documentation: https://elpy.readthedocs.io/en/latest/ide.html
Summary
I see that these two keybinds are conflicting in the docs: C-c C-r f (elpy-format-code) (C-c C-r f (elpy-refactor-extract-function)
Am I suppose to change something in my config?
Steps to reproduce
Execute: C-c C-r f... Asks me to create a new function name (which is similar to elpy-refactor-extract-function
My configuration
OS
Windows
Result of
(elpy-config)
Elpy configuration in my init.el