* Temporary code folding for navigation
@ 2013-04-24 15:39 Illya Bomash
2013-04-24 17:09 ` Thorsten Jolitz
0 siblings, 1 reply; 5+ messages in thread
From: Illya Bomash @ 2013-04-24 15:39 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]
Hi everyone,
When I use org-mode, I really like org-goto: it puts me in a temporary buffer that has an overview of my file (with all the details folded away), thereby showing me the structure of the file at a glance, and lets me easily get to a particular place, using simple keys for navigation or using isearch within this temporary buffer.
I’d love to have something similar for source code, e.g. Python files:
Press a key to temporarily put me in a buffer with only the outline of my code;
Put me in a mode where I can use single keystrokes to navigate to the different locations in my code.
Do you know of any existing modes or packages that work this way?
There are a few code-outline modes that exist, but I don’t want this on the screen all the time…only when I want to jump someplace new. Hideshow is close, but it’s not meant as a “temporary” mode, and it doesn’t do anything to make navigation easier.
Any tips would be appreciated! Thanks!
Best,
Illya
[-- Attachment #2: Type: text/html, Size: 1329 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Temporary code folding for navigation
2013-04-24 15:39 Illya Bomash
@ 2013-04-24 17:09 ` Thorsten Jolitz
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Jolitz @ 2013-04-24 17:09 UTC (permalink / raw)
To: help-gnu-emacs
Illya Bomash <ibomash@gmail.com> writes:
> When I use org-mode, I really like org-goto: it puts me in a temporary buffer
> that has an overview of my file (with all the details folded away), thereby
> showing me the structure of the file at a glance, and lets me easily get to a
> particular place, using simple keys for navigation or using isearch within
> this temporary buffer.
>
> I’d love to have something similar for source code, e.g. Python files:
navi-mode.el (in combination with outshine.el and outorg.el) might give
you exactly what you want, see this article on Worg
,-----------------------------------------------------------
| http://orgmode.org/worg/org-tutorials/org-outside-org.html
`-----------------------------------------------------------
There are screencasts available on youtube, e.g.
,--------------------------------------------
| Modern conventions for Emacs Lisp files
| https://www.youtube.com/watch?v=nqE6YxlY0rw
`--------------------------------------------
to give you an idea what its all about.
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Temporary code folding for navigation
@ 2013-04-24 19:49 Illya Bomash
2013-04-25 13:43 ` Thien-Thi Nguyen
2013-04-25 14:14 ` Thorsten Jolitz
0 siblings, 2 replies; 5+ messages in thread
From: Illya Bomash @ 2013-04-24 19:49 UTC (permalink / raw)
To: tjolitz, help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]
Hi Thorsten, thanks! This looks very much in line with what I was looking for!
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?
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!
Best,
Illya
> navi-mode.el (in combination with outshine.el and outorg.el) might give
> you exactly what you want, see this article on Worg
>
> ,-----------------------------------------------------------
> | http://orgmode.org/worg/org-tutorials/org-outside-org.html
> `-----------------------------------------------------------
>
> There are screencasts available on youtube, e.g.
>
> ,--------------------------------------------
> | Modern conventions for Emacs Lisp files
> | https://www.youtube.com/watch?v=nqE6YxlY0rw
> `--------------------------------------------
>
> to give you an idea what its all about.
>
> --
> cheers,
> Thorsten
>
[-- Attachment #2: Type: text/html, Size: 1680 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Temporary code folding for navigation
2013-04-24 19:49 Temporary code folding for navigation Illya Bomash
@ 2013-04-25 13:43 ` Thien-Thi Nguyen
2013-04-25 14:14 ` Thorsten Jolitz
1 sibling, 0 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2013-04-25 13:43 UTC (permalink / raw)
To: Illya Bomash; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 570 bytes --]
() Illya Bomash <ibomash@knewton.com>
() Wed, 24 Apr 2013 15:49:22 -0400
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!
If hideshow is close to what you want, and you succeed in hacking some
"temporary hideshow" feature, please consider contributing it to Emacs.
--
Thien-Thi Nguyen
GPG key: 4C807502
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Temporary code folding for navigation
2013-04-24 19:49 Temporary code folding for navigation Illya Bomash
2013-04-25 13:43 ` Thien-Thi Nguyen
@ 2013-04-25 14:14 ` Thorsten Jolitz
1 sibling, 0 replies; 5+ messages in thread
From: Thorsten Jolitz @ 2013-04-25 14:14 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-25 14:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-24 19:49 Temporary code folding for navigation Illya Bomash
2013-04-25 13:43 ` Thien-Thi Nguyen
2013-04-25 14:14 ` Thorsten Jolitz
-- strict thread matches above, loose matches on Subject: below --
2013-04-24 15:39 Illya Bomash
2013-04-24 17:09 ` Thorsten Jolitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).