[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code folding in Emacs.

From: David Masterson
Subject: Re: Code folding in Emacs.
Date: Wed, 13 Oct 2021 22:47:25 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hongyi Zhao <> writes:

> I just found the following code snippet from here [1] for code folding in 
> Emacs:
> (global-set-key (kbd "<C-f5>") 'set-selective-display-dlw)
> (defun set-selective-display-dlw (&optional level)
>   "Fold text indented same of more than the cursor.
> If level is set, set the indent level to LEVEL.
> If 'selective-display' is already set to LEVEL, clicking
> F5 again will unset 'selective-display' by setting it to 0."
>   (interactive "P")
>   (if (eq selective-display (1+ (current-column)))
>       (set-selective-display 0)
>     (set-selective-display (or level (1+ (current-column))))))
> The above code trick seems very simple, but it works for many
> languages. So I recommend it here.
> [1]

See Origami.

David Masterson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]