Emacs indent selection
Code folding
I am programming with Python pygame at the moment.
Like many, I wondered about code folding a la vim.
Without adding a minor mode, I am using
M-<n> C-x $
, where <n> is one of 1, 5, 11 .. since I am using four space Python indentation. Selective display folds lines up to a certain leading indentation.
Selective display
C-x $ runs the command set-selective-display (found in global-map), which is an interactive compiled Lisp function in ‘simple.el’. It is bound to C-x $. (set-selective-display ARG) Set ‘selective-display’ to ARG; clear it if no arg. When the value of ‘selective-display’ is a number > 0, lines whose indentation is >= that value are not displayed. The variable ‘selective-display’ has a separate value for each buffer.
Style?
Withstanding I use Emacs for its extensibility, I prefer a builtin that takes one arguement.
It is kind of ugly to have to specify k * n + 1 with k levels of n space indentation.
Rather than applying a minor hack, my heart tells me the mistake here is Python.
Honorable mention:
M-x occur