0

In python mode (the one that Emacs uses to open python script by default), can I fold the definition of a function?

How can I quickly select the entire definition of a function? (so that I can copy and paste)

If not, which python package/IDE shall I install in emacs? Thanks.

1 Answer 1

3

For folding, I use Hideshow mode (built-in) with Hydra like this:

(global-set-key
 (kbd "M-F")
 (defhydra hydra-fold (global-map "M-F")
   "Fold"
   ("h" hs-hide-all "hide all")
   ("s" hs-show-all "show all")
   ("f" hs-toggle-hiding "toggle")))

To mark the current function, press C-M-h to run mark-defun.

These work for nearly any language.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.