Hot answers tagged

46

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-special-modes-alist '(nxml-mode "<!--\\|<[^/>]*[^/]>" "-->\\|</[^/>]*[^/]>" "<!-...


16

Just customise the variable org-ellipsis. Something like (setq org-ellipsis "…")


15

With markdown-mode by Jason Blevins you can toggle folding of the heading with Tab (same as in org-mode).


13

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.


10

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 returns a list of all return values. Thus (1- (length (org-map-entries nil nil 'tree))) returns the number of subentries of the heading at point. To get something ...


9

You can change the characters more generally for selective display with: (set-display-table-slot standard-display-table 'selective-display (string-to-vector " ◦◦◦ ")) ; or whatever you like I've been using these characters because I find them easier to see than the periods, and yet not too distracting. To each their own, though. ...


8

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-display-table-slot standard-display-table 4 (vector (make-glyph-code ?…) (make-glyph-code ?…))))


7

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 of GNU Emacs. M-x find-library org ;; Copyright (C) 2004-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. So, both are included with ...


7

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 you could configure it to recognize markdown syntax. However, another option is to take a look at markdown-mode which supports navigation and folding, e.g. ...


4

You probably need (hide-sublevels 1).


4

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: (defun ess/org-show-just-me (&rest _) "Fold all other trees, then show entire current subtree." (interactive) (org-overview) (org-reveal) (org-...


4

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 elegant version, but this one works fine: (defun outline-count-subheadings () "Count the number of subheadings below the current heading." (let ((sum 0) ...


4

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 C-x t. These are like regular headings but not part of the hierarchy. * H1 L1 Some introductory text for H1 *************** H2 L2 Some text relating to H2 *****...


3

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-y) to yank that subtree


2

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 available here!) so you can use functions like hide-subtree and show-subtree.


2

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 backslash of its own. And in order to use a literal backslash in a regexp, it must be escaped with another backslash. So to get a regexp to match a single literal \ ...


2

C-c * on region to run org-ctrl-c-star


1

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 which turns text to headings or headings to text - you should do C-h f on each of these functions to find out more about it, e.g. what happens with list items). ...


1

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 mode! (See under "Usage".) As for the restructuring commands (moving one header above another and so on), these are just done by C-<down> etc. instead of M-...


1

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 (from orgmode.org repository). The under-the-point-headline-print-in-echo-area behaviour seems to come from org-eldoc which is activated via a hook in org-mode-...


1

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, which then is called whenever the tagged bookmark is visited. Any Lisp-readable function value is allowed: a symbol or a lambda expression. For example, to ...


1

Ooops, I should have tried harder before posting this question: C-return does the trick. Sorry for asking.


1

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 mode.


1

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 delimited by '{' and '}' but it is easily modified to allow '[' and ']' as block delimeters as well. To do this we need to modify the js-mode entry in hs-special-...


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