Skip to main content
14 votes
Accepted

Fold all methods in a Python class with Evil

It's not documented well enough, and possibly poorly named, but the hideshow function hs-hide-level will collapse all the blocks within the current block. That is, if your cursor is on the class ... ...
nega's user avatar
  • 3,276
8 votes
Accepted

Org-Mode cycling inside subtree impossible?

Something like this ? (defun my-cycle-previous-heading () (interactive) (outline-previous-heading) (org-cycle)) (define-key org-mode-map (kbd "C-x C-l") 'my-cycle-previous-heading)
bertfred's user avatar
  • 1,729
7 votes
Accepted

Can I hide the part of long lines that exceeds the visual line?

C-hig (emacs)Line Truncation As an alternative to continuation (*note Continuation Lines::), Emacs can display long lines by “truncation”. This means that all the characters that do not fit in ...
phils's user avatar
  • 51.7k
6 votes
Accepted

how do you fold/unfold complex ruby code blocks

I tried yafolding, seems to work (theres room for improvement on this, though) (require 'yafolding) (add-hook 'ruby-mode-hook 'yafolding-mode) (global-set-key (kbd "M-RET") 'yafolding-...
american-ninja-warrior's user avatar
5 votes

Fold all methods in a Python class with Evil

I believe the method given in the question, although not efficient, is sufficient. Let me explain it in greater detail. Assuming you have evil-mode enabled: Toggle hs-minor-mode to enable folding ...
Lorem Ipsum's user avatar
  • 4,527
5 votes

Org-Mode cycling inside subtree impossible?

The Org manual section 2.4 Motion describes the key bindings to be used for navigation. For your case I think C-c C-p (outline-previous-visible-heading) Previous heading. ...
Prasanna's user avatar
  • 1,550
5 votes
Accepted

Fundamental mode doesn't support HideShow minor mode

hs-minor-mode is a minor mode. Like most minor modes, it is buffer-specific and should be activated in each buffer where you want it. The error message you have is because the code you added to your ...
YoungFrog's user avatar
  • 3,526
5 votes
Accepted

Folding by levels (like a vim)

There are a lot of different implementations of folding for emacs. Some are specific to a particular programming language or syntax, others are more generic. Of the generic ones, it sounds like ...
db48x's user avatar
  • 18.4k
4 votes
Accepted

Org-mode hide tags in outline view

Here is one approach to hide tags in folded view, and show them in any expanded view. (defun org-toggle-tag-visibility (state) "Run in `org-cycle-hook'." (message "%s" state) (cond ;; global ...
John Kitchin's user avatar
  • 11.9k
4 votes
Accepted

Folding custom regular expressions in emacs?

Overlay-based solution The preview.el library of auctex shows how something like that can be done with overlays. Font-lock based solution Another state-of-the-art package is hi-lock.el. It does not ...
Tobias's user avatar
  • 33.3k
4 votes

How to fold nested list items in markdown-mode

markdown-mode uses parts of outline-mode for folding. So, IMHO it is most natural to implement the folding of items also with the help of outline-mode. The most obvious way would be: to include ...
Tobias's user avatar
  • 33.3k
3 votes
Accepted

How can I hide general text in parentheses?

A quick answer. If I get time I'll try to add a bit more later. Download isearch-prop.el, and load it. Use this command to make (...) invisible: (defun hide/show-parenthetical-text (&...
Drew's user avatar
  • 78k
3 votes

Folding mode with YAML?

As it seems, no builtin solution exists for your problem. Origami (available from MELPA) can do it for you, although it does some strange things for arrays of objects: - prop1: Value 1 prop2: Value ...
GergelyPolonkai's user avatar
2 votes
Accepted

hs-minor-mode with python.el - hide if statements, for/while loops, etc

After a little more looking around, I found: Origami yafolding Which can do what I wanted (and possibly a little more). I haven't thoroughly tested them both out, but on first impression, yafolding ...
dieggsy's user avatar
  • 475
2 votes

How can I replicate Vim's code folding?

I like and use vimish-fold with evil-vimish-fold (and avy): ;; Optional use of avy (use-package avy :bind ("C-c J" . avy-goto-line) :commands avy-goto-line :init (setq-...
Joe's user avatar
  • 571
2 votes
Accepted

browsing/navigating reStructuredText

rst-toc can be used to navigate sections.
Ista's user avatar
  • 1,188
2 votes
Accepted

evil-vimish-fold based on syntax

This answer does not address evil-vimish-mode. Instead, if you're agnostic about which particular package does the folding for you, you can try the built-in Hideshow mode (manual, wiki page). From ...
Dan's user avatar
  • 33.2k
2 votes

Org-Mode cycling inside subtree impossible?

C-u <tab> (#'org-cycle) will collapse all top-level trees. This might or might not be what you want. Alternately, you can move up to the parent heading (repeating it to go more than one level ...
zck's user avatar
  • 9,112
2 votes

In Auctex, how could I fold acronyms?

I have discovered the variable "TeX-fold-macro-spec-list". This variable contains a list of macros that are folded by "TeX-fold-mode". To fold the acronym macros (e.g.: \ac{}, \acp{}, \acf{}, \acpf{}),...
UndeadKernel's user avatar
2 votes
Accepted

JSON file folding and step-by-step unfolding

The json-navigator Emacs package displays any JSON document in a tree-like structure. It uses the hierarchy package.
Damien Cassou's user avatar
2 votes
Accepted

Folding code between a literal "begin"/"end" block using Hideshow

You did not implement alamo-forward-sexp correctly. If point is at begin_data almo-forward-sexp does not go to the block end, i.e., to the end of end_data but to the end of alamo-forward-sexp. A ...
Tobias's user avatar
  • 33.3k
2 votes
Accepted

Auctex: Fold all environments of a specific type in a buffer

(defun latex-fold-foo () (interactive) (let ((env (read-from-minibuffer "Environment: "))) (save-excursion (goto-char (point-min)) (while (search-forward (format "begin{%s}" env) ...
student's user avatar
  • 1,119
2 votes
Accepted

How to fold the highest headline which I am currently in?

The following code (lightly tested) takes advantage of the fact that org-mode is derived from outline-mode, which allows you to use the latter's functions. It simply jumps up headlines until it can't ...
Dan's user avatar
  • 33.2k
2 votes

Add code block line in emacs

This is commonly referred to as "code foldlng" or just "folding". There are several packages that implement this behavior, and each one displays folded and foldable code in their own way, which may ...
nega's user avatar
  • 3,276
2 votes
Accepted

Fold all regexp matches

The following elisp code defines a new minor mode web-hide-attr-mode. It is hooked to web-mode. So it is already active if you open a document in web-mode. You can toggle it by M-x web-hide-attr-mode....
Tobias's user avatar
  • 33.3k
2 votes
Accepted

How to move point to an invisible line (to access an org property when heading is folded)?

You should check out the Using the Property API section of the manual. In particular, doing (org-entry-get (point) "SCHEDULED") with point at the beginning of the headline returns the scheduled date ...
NickD's user avatar
  • 30.9k
2 votes

Emacs + visual line numbers + folding + visual fill column mode

I've FINALLY got solution for this, but there is not related with line numbers. All what I've done is just set another functions to j, k for evil. And it works almost perfect. God, I'm sooo happy ...
HarryFox's user avatar
2 votes

Folding mode with YAML?

As yaml is indentation based for folding nested blocks can be used native function set-selective-display https://www.gnu.org/software/emacs/manual/html_node/emacs/Selective-Display.html Example: C-u 4 ...
Marek L's user avatar
  • 21
2 votes

Hide / fold settings above an image

I would stick with your image info drawers, and then use a preprocessing hook to remove the lines that cause a problem. Here is one example that just replaces the IMAGE_INFO drawers with their ...
John Kitchin's user avatar
  • 11.9k
2 votes
Accepted

evil/elpy: Auto-fold when opening a file

With EVil, you can use (add-hook 'python-mode-hook (lambda () (evil-close-folds) )) to close all folds upon entering a file.
Luctins's user avatar
  • 120

Only top scored, non community-wiki answers of a minimum length are eligible