help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Temporary code folding for navigation


From: Thorsten Jolitz
Subject: Re: Temporary code folding for navigation
Date: Thu, 25 Apr 2013 16:14:41 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Illya Bomash <ibomash@knewton.com> writes:

Hi Illya,

> From what I can tell, outshine won’t just use the function definitions
> themselves to define structure — it specifically uses commented
> org-mode header lines for structure?

outshine.el is enhanced outline-minor-mode and responsable for the file
structuring and outline-navigation and structure editing.

I think what you want is navi-mode.el,build on top of outshine and
occur-mode. You can think of an *Navi* buffer as an permanent *Occur*
buffer associated with an original buffer, with predefined headline and
(mode-specific) keyword searches. For Emacs Lisp, I defined the
following set of keyword searches:

,-------------------------------------------
| [KEY] : [SEARCH]
| ================
|                         a : ALL
|                         f : FUN
|                         v : VAR
|                         x : OBJ
|                         b : DB
|                         F : defun
|                         V : defvar
|                         C : defconst
|                         G : defgroup
|                         U : defcustom
|                         A : defadvice
|                         M : defmarcro
|                         D : defface
|                         S : defstruct
|                         L : defclass
|                         K : global-set-key
|                         T : add-to-list
|                         Q : setq
|                         H : add-hook
|                         O : hook
|                         X : lambda
|                         R : require
`-------------------------------------------

thus if you type 'a' in a *Navi* buffer associated to an Emacs Lisp
buffer, all definitions will be used to define structure (and only the
definitions). 'f' is a bit more specific, it shows 'function'
definitions in a broader sense (functions, macros...). And 'F' only
shows '(defun ...) matches. 

If you want to use (outshine) headlines to define structure, just type
'1', '2', ...,'8' in the *Navi* buffer, and the headlines up to that
level will be shown. 

You combine headline with keyword searches by using 'C-1 F' or 'C-3 v'
for example. 

Note that keyword-searches are customizable ('navi-key-mappings' and
'navi-keywords'), and that by default all ASCII printing characters are
bound to 'navi-generic-command', thus there are a lot of free one-key
bindings left you can use to define your own keyword searches
(mode-specific). 

> What I had in mind originally would just use the function definitions
> themselves as navigation headers (sort of like making a temporary
> buffer from the current imenu or ECB data), but doing it by header
> levels instead could be a useful way to go about it…. I’ll give it a
> shot!

As mentioned above, when the original (Emacs Lisp) buffer has
outline-minor-mode with outshine extensions activated, you only have to
type 'F' in the associated *Navi* buffer and you get the function
definitions as navigation headers and nothing else.

-- 
cheers,
Thorsten




reply via email to

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