[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Defining outline-regexp Interactively?, the Pros of outline-minor-mode
From: |
Veli-Pekka Tätilä |
Subject: |
Defining outline-regexp Interactively?, the Pros of outline-minor-mode |
Date: |
Sat, 4 Oct 2008 21:54:30 +0300 |
Hi,
One thing I really like in Emacs is outline-minor-mode. A newbie question,
though, can I easily interactively set the outline-regexp without having to
evaluate Lisp code in a separate buffer, or update my config? My matching
needs dynamically depend on the kind of content in the buffer, I use a
regexp for matching functions when doing Lua, but would like to use a regexp
matching numbered headings like 1.3. when viewing a text dump of the Lua
reference manual.
In fact, I view outline minor mode as a kind of alternative UI to traversing
regexp search results non-linearly. Which reminds me if I have n
dot-separated sections e.g.
1.3.5
can I make outline-minor-mode understand the concept of subchapters and
subsubchapters in its tree structures? I can regexp match the bits all
right, though.
As to what's good in it:
Outline minor mode let's me easily hide function bodies and get the big
picture, without having to use regexp matching to jump from function to
function. It also makes rearranging stuff a breeze compared to selecting
line by line and cutting and pasting, which is what I used to do. It also
works great for languages not supported out of the box, such as Lua, if you
just say something like:
(setq outline-regexp "function")
The Emacs wiki has taught me almost as many handy things as the book
Learning Gnu Emacs, it is a great resource!
Further more, things are so much easier to manage from the keyboard if you
go and redefine the branch management keys to emulate tree-control keyboard
conventions. I found the following in the wiki and have it in my .emacs file
(for Windows and Linux):
(global-set-key [M-left] 'hide-body)
(global-set-key [M-right] 'show-all)
(global-set-key [M-up] 'outline-previous-heading)
(global-set-key [M-down] 'outline-next-heading)
(global-set-key [C-M-left] 'hide-sublevels)
(global-set-key [C-M-right] 'show-children)
(global-set-key [C-M-up] 'outline-previous-visible-heading)
(global-set-key [C-M-down] 'outline-next-visible-heading)
--
With kind regards Veli-Pekka Tätilä
Accessibility, Apps and Coding plus Synths and Music:
http://vtatila.kapsi.fi
- Defining outline-regexp Interactively?, the Pros of outline-minor-mode,
Veli-Pekka Tätilä <=