Hot answers tagged

46 votes
Accepted

The old "how to fold XML" question

I found this SO post: https://stackoverflow.com/questions/944614/emacs-does-hideshow-work-with-xml-mode-sgml-mode (require 'hideshow) (require 'sgml-mode) (require 'nxml-mode) (add-to-list 'hs-...
user avatar
18 votes
Accepted

Collapse sections in markdown

With markdown-mode by Jason Blevins you can toggle folding of the heading with Tab (same as in org-mode).
user avatar
  • 1,831
16 votes
Accepted

Changing the appearance of org-mode “hidden contents” ellipsis

Just customise the variable org-ellipsis. Something like (setq org-ellipsis "…")
user avatar
  • 5,520
13 votes

The old "how to fold XML" question

web-mode has element folding built in and bound to C-c C-f. But you will lose some of the features of using nxml-mode obviously.
user avatar
10 votes
Accepted

Counting sub-headings in org-mode using elisp

The org function you are looking for is org-map-entries. (org-map-entries FUNC &optional MATCH SCOPE &rest SKIP) This calls function for each heading determined by MATCH and SCOPE and ...
user avatar
  • 536
9 votes

Changing the appearance of org-mode “hidden contents” ellipsis

You can change the characters more generally for selective display with: (set-display-table-slot standard-display-table 'selective-display (string-to-vector " ◦◦◦ ")) ; or ...
user avatar
  • 31.1k
8 votes
Accepted

Org is implemented on top of Outline mode

One option is to check the source. M-x find-library outline You'll find in the header comments: ;; Copyright (C) 1986, 1993-1995, 1997, 2000-2019 Free Software Foundation, Inc. ;; This file is part ...
user avatar
  • 19.4k
8 votes

Changing the appearance of org-mode “hidden contents” ellipsis

Personally, instead of setting it only for Org, I do it globally with: (unless standard-display-table (setq standard-display-table (make-display-table))) (when (fboundp 'make-glyph-code) (set-...
user avatar
  • 25.4k
7 votes
Accepted

Enable any outline mode for markdown

If I understand the question, you are looking for a way to edit markdown files where you can show or hide sections, navigate by headings and so on. I've never used allout-mode but it does look like ...
user avatar
  • 19.4k
4 votes

Counting sub-headings in org-mode using elisp

Here's a function that will count the subheadings (which works more generally for outline-mode, and therefore for org-mode, which is built on top of outline-mode). You could, presumably, write a more ...
user avatar
  • 31.1k
4 votes
Accepted

How to show all contents of current subtree and fold all the other subtrees?

Edited in response to first comment Not quite sure if this is what you want, but here's a function that will show the current subtree (and its children) and fold all other headings to their top level:...
user avatar
4 votes
Accepted

Hide all header contents in Org mode

You probably need (hide-sublevels 1).
user avatar
  • 13.6k
4 votes
Accepted

Reverting back to higher heading

If you need H2 to have heading like features (eg you can tag, put properties, etc), you can use inline tasks for this as @NickD suggested (see M-x find-library org-inlinetask). You insert one with C-c ...
user avatar
3 votes
Accepted

Bulk convert text under heading to individual sub-headings?

C-c * on region to run org-ctrl-c-star
user avatar
  • 923
3 votes
Accepted

Prevent org-mode from unfolding pasted outlines

There is a configuration value org-yank-folded-subtrees that accomplishes this, but you need to use: org-cut-special (C-c C-x C-w) to kill the subtree initially and then org-paste-special (C-c C-x C-...
user avatar
  • 6,864
2 votes

Collapse sections in markdown

I've found two ways that can be useful: enable hideshow mode (hs-minor-mode) and use the provided functions Apparently markdown-mode inherits from outline mode (or at least the functions are ...
user avatar
  • 1,795
2 votes
Accepted

How to use outline-minor-mode to hide some exam class exercises in auctex

You haven't properly escaped the regexp for "\question". It should be: "\\\\question\\b" This is a string, and in order to encode a single backslash in a string, it needs to be escaped with a ...
user avatar
  • 20.5k
2 votes

Bulk convert text under heading to individual sub-headings?

As @nichijou points out, C-c * on the region will turn a sequence of plain lines into a sequence of headings (and vice-versa: in this context, org-ctrl-c-star runs the function org-toggle-heading ...
user avatar
  • 20.5k
1 vote
Accepted

outshine mode changes outline-regexp from markdown's

Digging further, I feel stupid(er than usual). Removing outshine-mode completely, I still get org-like folding behavior in markdown-mode, and this is because org-like folding is already in markdown ...
user avatar
1 vote
Accepted

bookmark-jump to a hidden part of a buffer

If you use Bookmark+ then you can add a bmkp-jump tag to any bookmark, to carry out any action just after that particular bookmark location is jumped to. Give this tag a value that is a function, ...
user avatar
  • 70.3k
1 vote

Keybinding for adding a new heading under a list item in org-mode

Ooops, I should have tried harder before posting this question: C-return does the trick. Sorry for asking.
user avatar
  • 101
1 vote

Meaning of plus in org mode documents

The user is free to use plus as bullet for plain lists. There is no special use case which is reserved for plus. Follow the hint of Tyler [Jan 16 at 18:36] to find variants of plain lists within Org ...
user avatar
  • 2,646
1 vote

How to change the face of org-display-outline-path in echo area?

An answer to the point : turn off displaying any outline path in the echo area. Encountered the same problem : that behaviour appeared after changing the distribution from org to org-plus-contrib (...
user avatar
  • 26
1 vote

Outline editing, like org-mode, for JSON

Emacs comes with hs-minor-mode which can be used selectively hide/show code and comment blocks in several languages, including JavaScript. By default this will let you hide and show JSON blocks ...
user avatar
  • 717
1 vote

Hide all header contents in Org mode

This function is obsolete since 25.1; use ‘outline-hide-sublevels’ instead.
user avatar
  • 389

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