emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [NEW] navi-mode for org files


From: Thorsten Jolitz
Subject: Re: [O] [NEW] navi-mode for org files
Date: Mon, 08 Apr 2013 21:27:49 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Charles Berry <address@hidden> writes:

> Thorsten Jolitz <tjolitz <at> gmail.com> writes:

>> I made navi-mode (=> super-fast buffer navigation, visibility-cycling,
>> structure-editing, and much more, with one-key commands in an associated
>> read-only *Navi* buffer) work with Org-mode buffers too. 

> Some comments:
>
> Maybe you have this on your TODO list, but some things do not work as 
> I would expect.
>
> In the *Navi:myfile.org* buffer, 1,2,3, Z, N, W are all good.
>
> C-1 N also good.
>
> But C-1 Z, C-2 W don't quite work.

> I think the part of the regexp that represents the 'Z' or 'W' search needs
> to be wrapped in \( ... \) as the parts beyond  
>
>   \(^\* \|^[ ^I]*#\+name:[ ^I]*
>
> do not match.

yes, you are right, I noticed that too, its even captured in my new
youtube screencast ;)

But I'm not sure why it doesn't work. Z searches for results with names,
i.e. lines like this:

     ,--------------------------------
     | 87:#+name: org-mode-doc-version
     | 93:#+name: org-mode-version
     `--------------------------------

the complicated regexp is simply copied from the Org-mode sources. Z
alone matches alright and finds the 2 named results in Bernt Hansen's
Org tutorial.

C-2 Z then makes a regexp alternative, combining this keyword search
with a simple regexp that matches headlines up to level 2 (^\*\*? ).

The strange thing is that making this regexp alternative works in all
other cases (for org and elisp), and it looks alright in this case too:

,---------------------------------------------------------------------------
| "\(^\*\*? \|^[
| ^I]*#\+\(name\|results\|tblname\)\(\[\(<\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}
| ?[^^M^J>]*?\)> \)?\([[:alnum:]]+\)\]\)?\:[ ^I]*\([^
| ()^L^I^J^M^K]+\)\((\(.*\))\)\)"
`---------------------------------------------------------------------------

I followed your suggestion and added parenthesis, but to no avial. This
only matches the headline too, not the named results:

,---------------------------------------------------------------------------
| "\(^\*\*? \|\(^[
| ^I]*#\+\(name\|results\|tblname\)\(\[\(<\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}
| ?[^^M^J>]*?\)> \)?\([[:alnum:]]+\)\]\)?\:[ ^I]*\([^
| ()^L^I^J^M^K]+\)\((\(.*\))\)\)\)"
`---------------------------------------------------------------------------

Any hints from the regexp experts why the above doesn't work, but the
following much simpler regexp alternative (C-2 N) does work an matches
the exact same two lines?

,-------------------------------------
| "\(^\*\*? \|^[ ^I]*#\+name:[ ^I]*\)"
`-------------------------------------

,---------------------------------------------------------------------------------
| 132 matches for "\(^\*\*? \|^[ ^I]*#\+name:[ ^I]*\)" in buffer: 
bernt-hansen.org
|      18:* How To Use This Document
|      50:* License
|      82:* Change History - What's new
|      87:#+name: org-mode-doc-version
|      93:#+name: org-mode-version
`---------------------------------------------------------------------------------

> ===
>
> I find myself doing "1 n n r 2 r Z w 2 n r Z" to look at successive pieces 
> of a buffer.
>
> Is there a slicker way to do stuff like this?

actually ["r 3" do stuff "2 w"] and ["r 4" do stuff "3 w"] is something
I do frequently, but since 'r' and 'w' are directly below '1 2 3 4' I
find it easy and fast to type.

Alternatively, you could start with e.g. 4 (shows headlines up to level
4) or directly C-4 Z, use SPC and DEL and 'n' and 'p' to go to the
relevant headline, and narrow with 'r'.

>  ,------------------------------------------------------------------------
>> | PS 
>> | 
>> | Please note that all this is available for your source code buffers
>> | too (e.g. in Emacs Lisp) when you structure them the 'outshine' way. 
>> | 
>> | Use outorg.el, outshine.el or navi-mode.el as example files to see what
>> | I mean (read comment-section of outshine.el for installation tips). 
>> | 
>> | Do 'M-s n' on one of them to open a *Navi* buffer. Try the the
>> | commands from list item (5) above and don't forget to checkout command
>> | 'e' - it is extremely useful since it opens the subtree at point (or,
>> | with prefix, the whole Emacs Lisp buffer) in a temporary Org-mode edit
>> | buffer.
>> `------------------------------------------------------------------------
>
> I cannot seem to get this to work. If I try to execute
>
> ;; # #+begin_src emacs-lisp
> ;; #  (require 'outshine)
> ;; #  (add-hook ‘outline-minor-mode-hook ‘outshine-hook-function)
> ;; # #+end_src
>
> the add-hook returns 
>
> Debugger entered--Lisp error: (void-variable ‘outline-minor-mode-hook)
>
>
> I am running 
>
> Org-mode version 8.0-pre (release_8.0-pre-276-g3d3465 @ ...
> GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of
>  2013-03-12 on bob.porkrind.org

Looks as if outshine is loaded before outline? But since outshine
requires outline, 'outline-minor-mode-hook' should be loaded when the
hook function is added. 
It works here, I'm running:

,----------------------------------------------------------------
| GNU Emacs Version:
| (24.3.1 24 3 gnu/linux hostname x86_64-unknown-linux-gnu x nil)
| Org-mode version 8.0-pre (release_8.0-pre-199-g2746c7 @ ...
`----------------------------------------------------------------

could you try 'M-x toggle-debug-on-error', execute the above, and send
the backtrace?

-- 
cheers,
Thorsten




reply via email to

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