<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikemacs.org/index.php?action=history&amp;feed=atom&amp;title=Outline</id>
	<title>Outline - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikemacs.org/index.php?action=history&amp;feed=atom&amp;title=Outline"/>
	<link rel="alternate" type="text/html" href="https://wikemacs.org/index.php?title=Outline&amp;action=history"/>
	<updated>2026-04-20T23:31:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wikemacs.org/index.php?title=Outline&amp;diff=4566&amp;oldid=prev</id>
		<title>Elvince: outline-mode and outline-magic for code folding</title>
		<link rel="alternate" type="text/html" href="https://wikemacs.org/index.php?title=Outline&amp;diff=4566&amp;oldid=prev"/>
		<updated>2013-05-15T16:42:44Z</updated>

		<summary type="html">&lt;p&gt;outline-mode and outline-magic for code folding&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Package&lt;br /&gt;
|name=outline&lt;br /&gt;
|description=show and hide fragments of code&lt;br /&gt;
|author=&lt;br /&gt;
|maintainer=&lt;br /&gt;
|source=&lt;br /&gt;
|in_emacs=yes&lt;br /&gt;
|Development status=active&lt;br /&gt;
|website=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Outline-[minor-]mode''' is a way to hide and show text in an emacs buffer, i.e. to do code folding. For example, we can do the same thing than with [[org]]-mode but with source code.&lt;br /&gt;
&lt;br /&gt;
= Outline-(minor-)mode =&lt;br /&gt;
&lt;br /&gt;
It is included in Emacs.&lt;br /&gt;
&lt;br /&gt;
Once you load it :&lt;br /&gt;
&lt;br /&gt;
{{Command|outline-minor-mode}}&lt;br /&gt;
&lt;br /&gt;
you can learn the commands thanks to the menu (menu-bar-mode).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Outline-magic =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://staff.science.uva.nl/~dominik/Tools/outline-magic.el outline-magic] implements extensions for outline(-minor)-mode. Its main features are :&lt;br /&gt;
&lt;br /&gt;
* VISIBILITY CYCLING: A '''single''' command to replace the many outline commands for showing and hiding parts of a document.&lt;br /&gt;
&lt;br /&gt;
* STRUCTURE EDITING: Promotion, demotion and transposition of subtrees.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Download outline-magic.el, put it on the load path and copy the&lt;br /&gt;
following into .emacs (adapting keybindings to your own preferences)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;scheme&amp;quot;&amp;gt;&lt;br /&gt;
(add-hook 'outline-mode-hook &lt;br /&gt;
          (lambda () &lt;br /&gt;
            (require 'outline-cycle)))&lt;br /&gt;
            &lt;br /&gt;
(add-hook 'outline-minor-mode-hook &lt;br /&gt;
          (lambda () &lt;br /&gt;
            (require 'outline-magic)&lt;br /&gt;
            (define-key outline-minor-mode-map  (kbd &amp;quot;&amp;lt;C-tab&amp;gt;&amp;quot;) 'outline-cycle)))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to add this feature by default to your programming language mode, say python :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;scheme&amp;quot;&amp;gt;&lt;br /&gt;
(add-hook 'python-mode-hook&lt;br /&gt;
          (lambda ()&lt;br /&gt;
            (outline-minor-mode)&lt;br /&gt;
))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Visibility cycling ===&lt;br /&gt;
&lt;br /&gt;
The command `outline-cycle' changes the visibility of text and headings&lt;br /&gt;
in the buffer.  Instead of using many different commands to show and&lt;br /&gt;
hide buffer parts, `outline-cycle' cycles through the most important&lt;br /&gt;
states of an outline buffer.  In the major `outline-mode', it will be&lt;br /&gt;
bound to the TAB key.  In `outline-minor-mode', the user can choose a&lt;br /&gt;
different keybinding.  The action of the command depends on the current&lt;br /&gt;
cursor location:&lt;br /&gt;
&lt;br /&gt;
1. When point is at the beginning of the buffer, `outline-cycle'&lt;br /&gt;
cycles the entire buffer through 3 different states: &lt;br /&gt;
*OVERVIEW: Only top-level headlines are shown.&lt;br /&gt;
*  CONTENTS: All headlines are shown, but no body text.&lt;br /&gt;
* SHOW ALL: Everything is shown.&lt;br /&gt;
&lt;br /&gt;
2. When point in a headline, `outline-cycle' cycles the subtree started&lt;br /&gt;
by this line through the following states:&lt;br /&gt;
* FOLDED:   Only the headline is shown.&lt;br /&gt;
* CHILDREN: The headline and its direct children are shown.  From&lt;br /&gt;
this state, you can move to one of the children and                 zoom in further.&lt;br /&gt;
* SUBTREE:  The entire subtree under the heading is shown.&lt;br /&gt;
&lt;br /&gt;
3. At other positions, `outline-cycle' jumps back to the current heading.   It can also be configured to emulate TAB at those positions, see&lt;br /&gt;
the option `outline-cycle-emulate-tab'.&lt;br /&gt;
&lt;br /&gt;
=== Structure editing ===&lt;br /&gt;
&lt;br /&gt;
Four commands are provided for structure editing.  The commands work on the current subtree (the current headline plus all inferior ones). In&lt;br /&gt;
addition to menu access, the commands are assigned to the four arrow keys pressed with a modifier (META by default) in the following way:&lt;br /&gt;
&lt;br /&gt;
                                move up&lt;br /&gt;
                                   ^&lt;br /&gt;
                       promote  &amp;lt;- | -&amp;gt;  demote &lt;br /&gt;
                                   v&lt;br /&gt;
                               move down&lt;br /&gt;
&lt;br /&gt;
Thus, M-left will promote a subtree, M-up will move it up&lt;br /&gt;
vertically throught the structure.  Configure the variable&lt;br /&gt;
`outline-structedit-modifiers' to use different modifier keys.&lt;br /&gt;
&lt;br /&gt;
== Read more ==&lt;br /&gt;
&lt;br /&gt;
Read the documentation included in [http://staff.science.uva.nl/~dominik/Tools/outline-magic.el outline-magic.el].&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
Narrowing and hiding text in Emacs : http://wikemacs.org/index.php/Emacs_Terminology#Narrow_and_widen&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Third Party Package]]&lt;br /&gt;
[[Category:Navigation]]&lt;br /&gt;
[[Category:Text Editing]]&lt;br /&gt;
[[Category:Visualize]]&lt;br /&gt;
[[Category:Convenience]]&lt;br /&gt;
[[Category:Editing]]&lt;br /&gt;
[[Category:Third Party Package]]&lt;/div&gt;</summary>
		<author><name>Elvince</name></author>
	</entry>
</feed>