5

I used several IDEs for Python. I like Spyder, but I have have been a pretty obsessive Emacs user for a LONG time. I install ELPY. It works very well for my needs. However, I cannot get code folding to work. Whenever I click on anything and then choose EPLY->Code folding->Hide/show at point (through the menu system), I get the following error:

Debugger entered--Lisp error: (void-variable hs-minor-mode) elpy-folding-toggle-at-point() funcall-interactively(elpy-folding-toggle-at-point) call-interactively(elpy-folding-toggle-at-point nil nil) command-execute(elpy-folding-toggle-at-point)

Does anybody know how to get this working? It does not matter much where I click on a function or pretty much anything.

henning
  • 82
  • 2
  • 16
  • 1
    Hide/Show minor mode works very well inside ELPY. However, I still find it very strange the ELPY's menus for code folding/unfolding with the error changing to: `Debugger entered--Lisp error: (invalid-function hs-life-goes-on) hs-life-goes-on(nil) elpy-folding-toggle-at-point() funcall-interactively(elpy-folding-toggle-at-point) call-interactively(elpy-folding-toggle-at-point nil nil) command-execute(elpy-folding-toggle-at-point)` Any ideas? – Pablo A Perez-Fernandez Dec 07 '19 at 09:41
  • 2
    ```(void-variable hs-minor-mode) ```means the the variable hs-minor-mode is ```nil```, and becomes true if you enable the mode with ```M-x hs-minor-mode```. After this is enabled, you may type the command ```ELPY -> Code-folding ->...```. Try if this works for you, you may add a hook to elpy config to enable this mode automatically. Also see the same question here: https://stackoverflow.com/questions/5244485/python-code-folding-in-emacs. – Ian Dec 07 '19 at 14:20
  • @Ian, unfortunately, your suggestion is the first thing I tried. I did `M-x hs-minor-mode` and did confirm that the var `hs-minor-mode` evaluates to `t` using `M-: hs-minor-mode`. I added `hs-minor-mode` as a hook for `elpy-mode`. As I mentioned, I can fold/unfold code using `hs-minor-mode`, but the ELPY menus throw an error. – Pablo A Perez-Fernandez Dec 08 '19 at 16:38
  • 1
    Allow me to expand on the issues. Once you have enabled `hs-minor-mode`, the ELPY menus do fold/unfold code. However, they fold and unfold code as well as throwing the error I mentioned. What does not make sense is that the symbol `hs-life-goes-on` is defined (contrary to the error at the top of the stack trace) as if defined as a macro. – Pablo A Perez-Fernandez Dec 08 '19 at 16:47
  • Folding appears to be in development and not yet released: https://github.com/jorgenschaefer/elpy/commit/0c7207ba124e4dca1856a9d86f11e4401dc36775. – aparkerlue Jan 11 '20 at 21:29
  • As of ELPY's latest version, code folding works perfectly. I am on Emacs 26.2 and ELPY version 20200112.1819 (as specified by package on Emacs). – Pablo A Perez-Fernandez Mar 15 '20 at 09:41

0 Answers0