1 #+OPTIONS: H:4 num:nil toc:4 \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
2 #+STARTUP: align fold nodlcheck oddeven lognotestate
3 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TAGS: Write(w) Update(u) Fix(f) Check(c)
5 #+TITLE: Org-mode outside Org-mode
6 #+AUTHOR: Thorsten Jolitz, François Pinard
7 #+EMAIL: tjolitz at gmail dot com
8 #+DATE: <2013-03-12 Di>
13 [[file:index.org][{Back to Worg's index}]]
17 :CUSTOM_ID: introduction
20 Once one gets used to Org-mode, it's hard to live without it. Even its most
21 basic feature, the hierarchical tree-like structuring of files, can be
22 missed badly when editing files in other GNU Emacs major-modes, not to
23 mention the convenient navigation, structure-editing and visibility-cycling
24 functionality Org-mode offers for these tree-like structures.
26 One especially important case where Org-mode users might miss Org-mode
27 functionality is their =.emacs= configuration file. These Emacs Lisp files
28 might become huge, for example [[http://www.mygooglest.com/fni/dot-emacs.html][Fabrice Niessen's .emacs]] has some 9720 lines,
29 and structuring them only using Emacs Lisp comments (=;=) easily becomes a
30 creative nightmare (many approaches for structuring a .emacs file can be
31 found on [[http://www.dotemacs.de/index.html][the very unofficial dotemacs home]] page).
33 Another typical case where Org-mode's editing facilities are missing is
34 writing the comment-header sections of Emacs Lisp source code files. These
35 sections often contain extensive explanations of the development-history,
36 installation-process and usage of the library, but are just that - Emacs
37 Lisp comment-sections. Sometimes even the comment-strings of important and
38 complex Emacs Lisp functions contain long and complicated text parts that
39 are not easy to edit as comments.
41 Last not least, anybody who has used =C-c C-j (org-goto)= for looking up a
42 different location in the current org-file, keeping current visibility,
43 might have wondered if a kind of 'remote-buffer-control' via an associated
44 read-only buffer might not be a generally useful idea.
48 :CUSTOM_ID: org-mode-everywhere
52 :CUSTOM_ID: file-structuring
56 :CUSTOM_ID: orgstruct-minor-mode
59 One possibility to enjoy Org-mode's structure-editing and list-formatting
60 facilities outside Org-mode buffers is /Orgstruct minor mode/. Let's cite
61 from the [[https://orgmode.org/manual/Orgstruct-mode.html][Org-mode manual]]:
64 If you like the intuitive way the Org mode structure editing and list
65 formatting works, you might want to use these commands in other modes like
66 Text mode or Mail mode as well. The minor mode orgstruct-mode makes this
69 When this mode is active and the cursor is on a line that looks to Org like a
70 headline or the first line of a list item, most structure editing commands
71 will work, even if the same keys normally have different functionality in
72 the major mode you are using. If the cursor is not in one of those special
73 lines, Orgstruct mode lurks silently in the shadows. When you use
74 orgstruct++-mode, Org will also export indentation and autofill settings
75 into that mode, and detect item context after the first line of an item.
78 *orgstruct* currently does NOT work with /outorg/ and /navi-mode/ (see below for
79 a description of these libraries). To make both libraries work with
80 orgstruct-buffers just like with outshine-buffers, it would be necessary to:
82 1. Structure the file with outshine-style headings (e.g. =;; * Header=)
83 2. Make Orgstruct calculate and set file-local variable =outline-regexp= the
85 3. Make Orgstruct calculate and set file-local variable =outline-level= the
87 4. Make Orgstruct calculate and set file-local variable
88 =outline-promotion-headings= the way /outshine/ does.
90 Then, maybe after a few minor tweaks in the libraries themselves, /outorg/ and
91 /navi-mode/ wouldn't care if they deal with an orgstruct-buffer or an
94 *** Outline with Outshine
96 :CUSTOM_ID: outline-with-outshine
99 **** History and Credits
101 :CUSTOM_ID: history-and-credits
104 *outshine* is a merge and extension of older extensions for
105 /outline-minor-mode/. More exactly, /outshine/ developed out of the now
106 obsolete =outxxtra.el=, /Thorsten Jolitz's/ modified extension of /Per
107 Abrahamsen's/ =out-xtra.el=. With the blessing of it's (well-known) author
108 /Carsten Dominik/, /Thorsten Jolitz/ could merge the (slightly modified)
109 =outline-magic.el= with =outxxtra.el= and extend them into the new
110 =outshine.el= library. Thus, if you use outline with outshine, you don't need
111 outline-magic and out-xtra anymore. However, outshine does not make either of
112 these two obsolete libraries, since it has a more specialized approach and
113 might not be able to replace them in all cases.
115 Furthermore, `outshine.el' includes functions and keybindings from
116 [[http://emacswiki.org/emacs/OutlineMinorMode][outline-mode-easy-bindings]]. Unfortunately, no author is given for that
117 library, so I cannot credit the person who wrote it.
119 So what is /outshine/? It's an extension library for outline-minor-mode that
120 gives buffers in different major-modes the 'look-and-feel' of Org-mode buffers
121 and enables the use of /outorg/ and /navi-mode/ on them.
123 To sum it up in one sentence:
126 Outline with Outshine outshines Outline
131 :CUSTOM_ID: outshine-installation
134 Download =outshine.el= (or clone the github-repo) and copy it to a location
135 where Emacs can find it:
137 | https://github.com/tj64/outshine |
138 | git clone git@github.com:tj64/outshine.git |
140 Use this in your '.emacs' to get started:
142 #+begin_src emacs-lisp
144 (add-hook 'outline-minor-mode-hook 'outshine-hook-function)
147 If you like the functions and keybindings for 'M -<<arrow-key>>' navigation
148 and visibility cycling copied from `outline-mode-easy-bindings', you might
149 want to put the following code into your Emacs init file to have the same
150 functionality/keybindings available in Org-mode too, overriding the less
151 frequently used commands for moving and promoting/demoting subtrees (but
152 clashing with 'org-table' keybindings):
154 #+begin_src emacs-lisp
155 (when (require 'outshine nil 'NOERROR)
156 (add-hook 'org-mode-hook
158 ;; Redefine arrow keys, since promoting/demoting and moving
159 ;; subtrees up and down are less frequent tasks then
160 ;; navigation and visibility cycling
161 (org-defkey org-mode-map
162 (kbd "M-<left>") 'outline-hide-more)
163 (org-defkey org-mode-map
164 (kbd "M-<right>") 'outline-show-more)
165 (org-defkey org-mode-map
166 (kbd "M-<up>") 'outline-previous-visible-heading)
167 (org-defkey org-mode-map
168 (kbd "M-<down>") 'outline-next-visible-heading))
172 Add this if you (e.g.) always want outline/outshine for emacs-lisp buffers
175 #+begin_src emacs-lisp
176 (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
179 If you want a different prefix key for outline-minor-mode, insert first
182 #+begin_src emacs-lisp
183 (defvar outline-minor-mode-prefix "\C-c")
186 or whatever you like best to replace the (quite unusable) original prefix
187 "\C-c @". The prefix can only be changed before outline (minor) mode is
190 **** Outshine's fundamental idea
192 :CUSTOM_ID: fundamental-idea
195 /outshine/ is based on a very simple yet powerful idea, that enables its use
196 in any Emacs major-mode (in theory at least):
199 Outshine headlines are Org-mode headlines out-commented with =comment-region=
202 Thus, the file at hand must be outline-structured 'the outshine way', i.e.
203 with the headlines being proper Org-mode headlines, marked and outcommented
204 with =comment-region=. As an example, to generate a 3rd level
205 outshine-headline in an Emacs Lisp file, write down
207 : ,-----------------------
208 : | *** Third Level Header
209 : `-----------------------
211 mark the header line, and apply =comment-region= on it:
213 : ,-----------------------
214 : | ;; *** Third Level Header
215 : `-----------------------
217 In a LaTeX file, an adequate header will look like this:
219 : ,-----------------------
220 : | % *** Third Level Header
221 : `-----------------------
223 and in a PicoLisp file like this (always depending of the major-mode specific
224 values of =comment-start=, =comment-end=, =comment-add= and
227 : ,-----------------------
228 : | ## *** Third Level Header
229 : `-----------------------
231 =outshine.el=, =outorg.el= and =navi-mode.el= are all examples of how to
232 structure emacs-lisp source files with outshine-style headlines.
234 **** Fontification, Navigation and Structure Editing
236 :CUSTOM_ID: fontification-navigation-and-structure-editing
239 After structuring a source code file the 'outshine-way' and loading
240 outline-minor-mode with outshine-extensions, the file will have a very
241 Org-mode like 'look-and-feel'. The headlines (up to level 8) are fontified the
242 same way Org-mode headlines are fontified, and the very specific navigation
243 and structure editing commands of outline-minor-mode as well as their more
244 general Org-mode style counterparts are available:
246 =outline-minor-mode= Minor Mode Bindings:
249 |-----------+----------------------------------|
250 | C-c | PrefixCommand |
251 | <M-down> | outline-next-visible-heading |
252 | <M-left> | outline-hide-more |
253 | <M-right> | outline-show-more |
254 | <M-up> | outline-previous-visible-heading |
255 | <tab> | outshine-cycle-subtree |
256 | <backtab> | outshine-cycle-buffer |
257 | C-c C-a | show-all |
258 | C-c C-b | outline-backward-same-level |
259 | C-c C-c | hide-entry |
260 | C-c C-d | hide-subtree |
261 | C-c C-e | show-entry |
262 | C-c C-f | outline-forward-same-level |
263 | C-c TAB | show-children |
264 | C-c C-k | show-branches |
265 | C-c C-l | hide-leaves |
266 | C-c RET | outline-insert-heading |
267 | C-c C-n | outline-next-visible-heading |
268 | C-c C-o | outline-hide-other |
269 | C-c C-p | outline-previous-visible-heading |
270 | C-c C-q | outline-hide-sublevels |
271 | C-c C-s | show-subtree |
272 | C-c C-t | hide-body |
273 | C-c C-u | outline-up-heading |
274 | C-c C-v | outline-move-subtree-down |
275 | C-c C-^ | outline-move-subtree-up |
276 | C-c ' | outorg-edit-as-org |
277 | C-c @ | outline-mark-subtree |
278 | C-c I | outline-previous-visible-heading |
279 | C-c J | outline-hide-more |
280 | C-c K | outline-next-visible-heading |
281 | C-c L | outline-show-more |
282 | C-c C-< | outline-promote |
283 | C-c C-> | outline-demote |
285 ** Subtree and Comment Editing
287 :CUSTOM_ID: comment-editing
291 :CUSTOM_ID: comment-editing-introduction
294 Once a (outshine) source code buffer looks and behaves like an Org-mode
295 buffer, it would be nice to have the full editing power of Org-mode
296 available when editing the (comment) text parts or overall structure of
299 Think "reverse Org-Babel": editing of comment-sections or entire subtrees
300 from source code files in temporary Org-mode buffers instead of editing of
301 Org-mode source-blocks in temporary source-code buffers.
303 There are two new libraries available for editing with Org-mode in other
304 major-modes, /outorg/ and /poporg/. Although developed independently with
305 very different implementations, both libraries complement each other very
306 well in their functionality.
313 **** Introduction and Installation
315 :CUSTOM_ID: outorg-introduction-and-installation
318 *outorg* is a library written by /Thorsten Jolitz/ on top of his /outshine/
319 library. Thus, /outorg/ needs /outshine/, and files that are structured with
320 outshine-style headers, otherwise it won't work (note that 'oldschool' Emacs
321 Lisp files with headers matched by =^;;;+= are a special case where outorg
324 You can download the file (or clone the github-repo) here:
326 | https://github.com/tj64/outorg |
327 | git clone git@github.com:tj64/outorg.git |
329 /outorg/ requires Org-mode too, thus should be loaded after Org-mode. Insert
331 #+begin_src emacs-lisp
335 in your .emacs and you are done.
339 :CUSTOM_ID: outorg-usage
342 /outorg's/ main command is
344 : ,---------------------------
345 : | C-c ' (outorg-edit-as-org)
346 : `---------------------------
348 used in source-code buffers where `outline-minor-mode' is activated with
349 `outshine' extensions. The Org-mode edit-buffer popped up by this command
350 has `outorg-edit-minor-mode' activated, a minor-mode with only 2 commands:
352 : ,----------------------------------------
353 : | M-# (outorg-copy-edits-and-exit)
354 : | C-x C-s (outorg-save-edits-to-tmp-file)
355 : `----------------------------------------
357 If you want to insert Org-mode source-code or example blocks in
358 comment-sections, simply outcomment them in the outorg-edit buffer before
359 calling `outorg-copy-edits-and-exit'.
361 Thus, with point inside a subtree or on a subtree header, pressing =C-c '
362 (outorg-edit-as-org)= will open this subtree in a temporary Org-mode edit
363 buffer, with all out-commented parts in the original buffer uncommented, and
364 all source code parts enclosed in Org-mode source blocks.
366 When =outorg-edit-as-org= is called with a prefix =C-u=, the whole source-code
367 buffer will be transformed into Org-mode and offered for editing in a
368 temporary Org-mode buffer, all headlines folded except the subtree where point
371 If the original-buffer was read-only, the user is asked if he wants to make it
372 writable for the Org-mode editing. If he answers yes, the buffer can be
373 edited, but will be set back to read-only again after editing is finished.
375 To avoid accidental loss of edits, the temporary outorg-edit-buffer is backed
376 up in the OS =/tmp= directory. During editing, the outorg-edit-buffer can be
377 saved as usual with =save-buffer= via =C-x C-s=. Even when killed by
378 accident, that last state of the outorg-edit-buffer will be saved and can be
381 When done with editing in Org-mode, =M-# (Meta-key and #)= is used to call
382 =outorg-copy-edits-and-exit=, a command that orderly exits the edit-buffer by
383 converting the (modified) comment-sections back to comments and extracting the
384 source-code parts out of the Org-mode source-code blocks.
386 Please note: /outorg/ is line-based, it only works with 'one-line' comments,
387 i.e. with comment-sections like those produced by `comment-region' (a command
388 that comments or uncomments each line in the region). Those special multi-line
389 comments found in many programming languages are not recognized and lead to
392 **** Outorg vs Poporg
394 :CUSTOM_ID: outorg-vs-poporg
397 /outorg/ works on subtrees (or whole buffers).
399 One advantage of this is that there is always a complete subtree (-hierarchy)
400 in the outorg-edit-buffer, thus not only the Orgmode editing functionality can
401 be applied, but also its export facilities and many other commands that act on
402 headlines or subtrees. As an example, in order to produce the nice README.txt
403 files for the github-repos of /outshine/, /outorg/ and /navi-mode/, I simply
404 called =outorg-edit-as-org= on the first 1st-level-headline of the source-code
405 files (the file header comment-sections) and exported the subtree to ASCII.
407 One disadvantage of this is that comment-strings of (e.g. emacs-lips)
408 functions cannot be edited comfortably, since after transformation of the
409 source-code buffer they end up inside Org-mode source-code blocks - as
410 comment-strings, just like before.
412 Enters /poporg/. It will be described in much detail in the next section, but
413 it can already be mentioned here that it does exactly what /outorg/ cannot do
414 well - Org-mode editing of atomic, isolated comment-strings, no matter where
415 they are found in the source code buffer. And it is, in contrast to /outorg/,
416 completely independent from outline structuring with e.g. /outshine/ or
424 [NOTE: This section of the tutorial is copied from
425 [[https://github.com/QBobWatson/poporg]], where you can find the =poporg.el= file too,
426 and only slightly modified]
430 :CUSTOM_ID: poporg-introcuction
433 *poporg* is a small Emacs lisp project written by /François Pinard/ to
434 help editing program strings and comments using Org mode (or any other
435 major mode). This can be useful as it is often more convenient to
436 edit large pieces of text, like Emacs lisp or Python docstrings, in an
437 org-mode buffer instead of in a comment or a string.
439 Emacs does not easily handle multiple major modes in a single buffer.
440 So far many solutions have been implemented, with varying degrees of
441 success, but none is perfect. The *poporg* approach avoids the problem
442 by extracting the text from the comment or the string from a buffer
443 using a major programming mode, into a separate buffer to be edited in
444 a text mode, but containing only that comment or that string. Once
445 the edit is completed, the modified comment or string gets
446 re-integrated in the buffer containing the program, replacing the
449 The main utility of this package is its ability to handle prefixes
450 automatically. For comments, it finds all contiguous nonempty
451 comments on their own line, and strips the common prefix before
452 inserting into the editing buffer (see =poporg-comment-skip-regexp=).
453 For strings, it checks if there is consistent indentation for the
454 whole string (the opening delimiter of the string can only have
455 whitespace before it), and uses that as the common prefix. For
456 regions, it just uses a naive common prefix. When placing the edited
457 text back in context, it adds the common prefix again, potentially
458 stripping any trailing whitespace (see
459 =poporg-delete-trailing-whitespace=). It can even adjust the fill
460 column in the editing buffer to account for indentation (see
461 =poporg-adjust-fill-column=).
465 :CUSTOM_ID: poporg-installation
468 To install *poporg*, move file =poporg.el= to a place where Emacs will
469 find it. You might byte-compile the file if you want. There are also
470 [[https://github.com/dimitri/el-get][El-Get]] and [[http://melpa.milkbox.net/][MELPA]] recipes.
472 To use *poporg*, you need to pick some unused keybinding and add a few
473 lines to your =~/.emacs= file, such as:
475 #+BEGIN_SRC emacs-lisp
476 (autoload 'poporg-dwim "poporg" nil t)
477 (global-set-key (kbd "C-c \"") 'poporg-dwim)
480 It is important that this be a global keybinding, or at least that the
481 command =poporg-dwim= be available from both the programming and the
482 text editing buffers.
486 :CUSTOM_ID: poporg-usage
489 The command =poporg-dwim= searches for a nearby comment or string (see
490 =poporg-find-string-or-comment=) and, upon finding one, it opens an
491 empty buffer in a new window with its contents available for editing.
492 If the region is active then =poporg-dwim= inserts the region into the
493 buffer instead. The original text is grayed out and set read-only to
494 prevent editing in two places at once. After editing, running
495 =poporg-dwim= again from the editing buffer kills the editing buffer and
496 inserts the edited text back into its original context.
498 Hopefully =poporg-dwim= will do what you expect in most situations. It
499 uses the buffer's syntax table for parsing, so it should adapt well to
500 most modes (including sextuple-quoted strings in Python). If you run
501 =poporg-dwim= in the vicinity of a grayed-out region that you are
502 editing in another buffer, it pops to that buffer. It has the
505 1. It does not understand empty strings.
506 2. It cannot deal very well with comments with ending delimiters.
508 For example, in c-mode, comments start with =/*= and end with =*/=. This
509 is a problem because poporg needs a common prefix for all lines. In
510 order to make poporg understand these comments, write them on separate
515 * Comments go here. Not on a line with the opening delimiter or the
520 In this situation poporg will ignore the first and last lines because
521 they are empty except for comment delimiters, and detect the common
522 prefix =__= or =__*_= for the middle lines, depending on whether the =*=
523 character is matched by =poporg-comment-skip-regexp=.
525 You will probably want to customize =poporg-edit-hook=, since that is
526 where the major mode of the edit buffer is set. The minor mode
527 =poporg-mode= is activated in the edit buffer. It has one keybinding by
528 default, which remaps =save-buffer= (C-x C-s) to =poporg-edit-exit=. You
529 can add additional keybindings to =poporg-mode-map=. To save an edit,
530 from the editing buffer run =poporg-edit-exit= or =poporg-dwim=; to abort
531 the edit simply kill the buffer.
533 ** Remote Buffer Control
535 :CUSTOM_ID: remote-buffer-control
538 While visibility-cycling and outline-navigation commands make it very
539 convenient to work even with big Org-mode or outshine buffers, it can't be
540 denied that a read-only "twin-buffer" with one-key command-bindings,
541 exclusively for navigation and high-level structure editing of the associated
542 original-buffer, can be even more convenient.
544 Enters /navi-mode/, a major-mode by /Thorsten Jolitz/ derived from and
545 inspired by /occur-mode/ (and, to a certain extend, the =org-goto= command).
546 Just like /outorg/, /navi-mode/ depends on /outshine/ and works only with
547 source-code files structured with 'outshine-style' outline-headers. It does
548 work with Org-mode files and 'oldschool' Emacs Lisp files too, though.
550 A /navi-buffer/ is a kind of "remote-control" for its associated
551 /original-buffer/. It offers a vast amount of views on the /original-buffer/
552 via predefined occur-searches that combine headlines and
553 (programming-language specific) keywords. It further allows many frequent
554 actions on the subtree at point to be triggered directly from the
555 /navi-buffer/, without (visibly) switching to the /original-buffer/ where the
558 A special feature of /navi-mode/ is its customizability. It predefines all
559 ASCII printing characters as keybindings for the =navi-generic-command=, and
560 users can therefore map their user-defined regexp-searches (customizable
561 variable =navi-keywords=) to any of the many free one-key bindings (in
562 customizable variable =navi-key-mappings=). These customizations are made by
563 programming-language, thus the Emacs community could work out default
564 'alists' for many languages that then may be used and modified by the users.
566 /navi-mode's/ author /Thorsten Jolitz/ already worked out two configurations,
567 one for Emacs Lisp and the other for PicoLisp. You could use them as
568 inspiration for a configuration of your favorite programming language - and
569 send these 'alists' to him so that he can include them in the library. The
570 more predefined sets of keyword searches there are, the easier to use
571 /navi-mode/ with many languages.
575 :CUSTOM_ID: navi-mode
580 :CUSTOM_ID: about-navi-mode
583 /navi-mode/ implements extensions for occur-mode. You can think of a
584 navi-buffer as a kind of 'remote-control' for an (adequately)
585 outline-structured original-buffer. It enables quick navigation and basic
586 structure editing in the original-buffer without (necessarily) leaving the
587 navi-buffer. When switching to the original-buffer and coming back after some
588 modifications, the navi-buffer is always reverted (thus up-to-date).
590 Besides the fundamental outline-heading-searches (8 outline-levels) and the 5
591 basic keyword-searches (:FUN, :VAR, :DB, :OBJ and :ALL), all languages can
592 have their own set of searches and keybindings (see =navi-key-mappings= and
593 =navi-keywords=). Heading-searches and keyword-searches can be combined,
594 offering a vast amount of possible 'views' at the original-buffer.
598 Download (or clone the github-repos of) the three required libraries
600 | `navi-mode.el' | https://github.com/tj64/navi |
601 | | git clone git@github.com:tj64/navi.git |
602 | `outshine.el' | https://github.com/tj64/outshine |
603 | `outorg.el' | https://github.com/tj64/outorg |
605 and put them in a place where Emacs can find them (on the Emacs 'load-path').
606 Follow the installation instructions in =outshine.el= and =outorg.el=.
608 Install =navi-mode.el= by adding
610 #+begin_src emacs-lisp
619 :CUSTOM_ID: navi-mode-usage
622 For /navi-mode/ to work, the original-buffer must be outline-structured 'the
623 outshine way', i.e. with the headlines being proper Org-mode headlines, marked
624 and outcommented with /comment-region/ (but oldschool Emacs Lisp headers like
625 =;;; header level 1= work too) .
627 The second assumption is that /outline-minor-mode/ is activated in the
628 original-buffer and /outshine.el/ loaded like described in its installation
629 instructions (except for Org-mode files).
631 When these pre-conditions are fulfilled (/outorg.el/ must be loaded too), you
632 can use =M-s n (navi-search-and-switch)= to open a /navi-buffer/ and
633 immediately switch to it. The new navi-buffer will show the first-level
634 headings of the /original-buffer/, with point at the first entry.
638 - Show headlines (up-to) different levels:
640 | key | command | function-name |
641 |---------+--------------------+----------------------|
642 | 1 ... 8 | show levels 1 to 8 | navi-generic-command |
644 - Navigate up and down in the search results shown in the navi-buffer:
646 | key | command | function-name |
647 |-----+-----------+---------------------|
648 | p | previous | occur-prev |
649 | n | next | occur-next |
650 | DEL | down page | scroll-down-command |
651 | SPC | up page | scroll-up-command |
653 - Revert the navi-buffer (seldom necessary), show help for the user-defined
654 keyword-searches, and quit the navi-buffer and switch-back to the
657 | key | command | function-name |
658 |-----+---------------------------+----------------------|
659 | g | revert buffer | navi-revert-function |
660 | h | show help | navi-show-help |
661 | q | quit navi-mode and switch | navi-quit-and-switch |
663 - Switch to the original-buffer and back to the navi-buffer, display an
664 occurrence in the original-buffer or go to the occurrence:
666 | key | command | function-name |
667 |---------+------------------------+-----------------------------------|
668 | M-s n | launch navi-buffer | navi-search-and-switch |
669 | M-s s | switch to other buffer | navi-switch-to-twin-buffer |
672 | d | display occurrence | occur-mode-display-occurrence |
673 | o | goto occurrence | navi-goto-occurrence-other-window |
675 - Structure editing on subtrees and visibility cycling
677 | key | command | function-name |
678 |-----------+--------------------------------+------------------------|
679 | TAB | cycle subtrees | navi-cycle-subtree |
680 | <backtab> | cycle buffer | navi-cycle-buffer |
681 | + | Demote Subtree | navi-demote-subtree |
682 | - | promote subtree | navi-promote-subtree |
683 | \^ | move up subtree (same level) | navi-move-up-subtree |
684 | < | move down subtree (same level) | navi-move-down-subtree |
686 - Miscellaneous actions on subtrees
688 | key | command | function-name |
689 |-----+----------------------------+-----------------------------------|
690 | m | mark subtree | navi-mark-subtree-and-switch |
691 | c | copy subtree | navi-copy-subtree-to-register-s |
692 | k | kill subtree | navi-kill-subtree |
693 | y | yank killed/copied subtree | navi-yank-subtree-from-register-s |
694 | u | undo last change | navi-undo |
695 | r | narrow to subtree | navi-narrow-to-subtree |
696 | w | widen | navi-widen |
697 | l | query-replace | navi-query-replace |
698 | i | isearch | navi-isearch |
699 | e | edit as org (outorg) | navi-edit-as-org |
701 - Furthermore, there are five (semantically) predefined keyword-searches:
703 | key | keyword-symbol | searches for |
704 |-----+----------------+----------------------------|
705 | f | :FUN | functions, macros etc. |
706 | v | :VAR | vars, consts, customs etc. |
707 | x | :OBJ | OOP (classes, methods etc) |
708 | b | :DB | DB (store and select) |
712 - And (potentially) many more user-defined keyword-searches
713 (example Emacs Lisp):
715 | key | keyword-symbol | searches for |
716 |-----+----------------+--------------|
717 | F | :defun | (defun |
718 | V | :defvar | (defvar |
719 | C | :defconst | (defconst |
720 | G | :defgroup | (defgroup |
721 | U | :defcustom | (defcustom |
722 | A | :defadvice | (defadvice |
723 | M | :defmacro | (defmacro |
724 | E | :defface | (defface |
725 | S | :defstruct | (defstruct |
726 | L | :defclass | (defclass |
728 - Headline-searches and keyword-searches can be combined, e.g.
734 in a /navi-buffer/ associated to an Emacs Lisp source file shows all headlines
735 up-to level 2 as well as all function, macro and advice definitions in the
742 shows all headlines up-to level 5 as well as all functions, variables,
743 classes, methods, objects, and database-related definitions. The exact meaning
744 of the standard keyword-searches 'f' and 'a' must be defined with a regexp in
745 the customizable variable `navi-keywords' (just like the user-defined
750 :CUSTOM_ID: screencasts
753 There are some screencasts on Youtube that show the libraries mentioned in
754 this article in action:
757 |--------------------------------+--------------------------------|
759 | Modern conventions for Emacs Lisp files | https://www.youtube.com/watch?v=nqE6YxlY0rw |
760 | Exploring Bernt Hansen's Org-mode tutorial with 'navi-mode' | https://www.youtube.com/watch?v=nqE6YxlY0rw |
761 | Exploring my dot emacs file with 'navi-mode' | https://www.youtube.com/watch?v=nqE6YxlY0rw |
762 | Exploring a PicoLisp source file with GNU Emacs navi-mode | https://www.youtube.com/watch?v=MYJvQ-5dvK8 |
764 'Modern conventions for Emacs Lisp files' is probably the video you should
765 watch first, it explores 'navi-mode.el' itself as an Emacs Lisp library
766 structured the 'outshine way', and shows the use of outline-minor-mode,
767 outorg, poporg and navi-mode on such a file. And is has the best background