[Top][All Lists]

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

Re: [O] Using orgstruct-mode (or just org-cycle) in emacs-lisp-mode

From: Jorge A. Alfaro-Murillo
Subject: Re: [O] Using orgstruct-mode (or just org-cycle) in emacs-lisp-mode
Date: Sun, 08 Nov 2015 12:36:24 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Jonas Bernoulli writes:

`orgstruct-mode' sounds like it could be really useful too, but as I mentioned it doesn't work for me at all. So for now I would like to stick to just `outline-minor-mode'.
Jonas Ps: I am still not sure whether I am just doing something stupid or why else `orgstruct-mode' doesn't work for me. So I would apprechiate a little tutorial starting from emacs -Q that demonstrates what setup is required and what keys I have to press for things to happen.

Generally it is enough to set orgstruct-heading-prefix-regexp and turn-on-orgstruct. I do this on a per mode basis, for example:

#+BEGIN_SRC emacs-lisp
 (add-hook 'elisp-mode-hook 'turn-on-orgtbl)
 (add-hook 'elisp-mode-hook
           (lambda ()
                   (setq-local orgstruct-heading-prefix-regexp
                               ";; ")))

Then you can organize your code using

;; * section-name

;; ** subsection-name

and folding with TAB, shift-TAB, etc will work when you are in those lines.

To use lists you just have to start a line with -, +, 1., etc and then lists keybindings work, for example M-C-m for new items. I do not know why lists do not respect orgstruct-heading-prefix-regexp, it has always seem weird to me that I cannot gain orgstruct functionality with something like:

;; - first item
;; - second item


reply via email to

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