emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [ANN] outorg.el -- reverse Org-Babel


From: Thorsten Jolitz
Subject: Re: [O] [ANN] outorg.el -- reverse Org-Babel
Date: Wed, 13 Feb 2013 11:54:36 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux)

Bastien <address@hidden> writes:

Hi Bastien,

> Note that both your libraries (supporting some Org syntax in
> comments) are a perfect match for Christopher recent chance
> in master, which allows a more powerful orgstruct-mode in
> those files -- with folding etc.  If you didn't, have a look:
>
>   C-h v orgstruct-heading-prefix-regexp RET

for equivalence with outline-minor-mode, one would need 

,--------------------------------
| orgstruct-heading-prefix-regexp
| orgstruct-heading-prefix-level
`--------------------------------

just like: 

,-------------------------------------------------------------------------------
| outline-regexp is a variable defined in `outline.el'.
| 
| Regular expression to match the beginning of a heading.
| Any line whose beginning matches this regexp is considered to start a heading.
| Note that Outline mode only checks this regexp at the start of a line,
| so the regexp need not (and usually does not) start with `^'.
| The recommended way to set this is with a Local Variables: list
| in the file it applies to.  See also `outline-heading-end-regexp'.
`-------------------------------------------------------------------------------

,----------------------------------------------------------------------------
| outline-level is a variable defined in `outline.el'.
| 
| *Function of no args to compute a header's nesting level in an outline.
| It can assume point is at the beginning of a header line and that the match
| data reflects the `outline-regexp'.
`----------------------------------------------------------------------------

on the other hand:

,---------------------------------------------------------
| (define-derived-mode org-mode outline-mode "Org"
| [...]
|   (org-set-local 'outline-regexp org-outline-regexp)
|   (org-set-local 'outline-level 'org-outline-level) ...)
`---------------------------------------------------------

I'm not sure if I really understand orgstruct-mode, but it seems to me
that when orgstruct-mode is active in a (e.g. elisp) buffer, all outline
functions and vars are available, and so are org-outline-regexp and
org-outline-level. 

Then a library like outorg could use outline functionality in its
functions and it would work no matter if the buffer is in
outline-minor-mode or in orgstruct-mode. The only change necesary would
be to set outline-regexp and outline-level conditionally on the
minor-mode active. 

Or why not use outline-regexp and outline-level directly, like org.el
does in some places: 

,---------------------------------------------------------------------------
| 6624:            (if (re-search-forward (concat "^" outline-regexp) nil t)
`---------------------------------------------------------------------------

,-----------------------------------------------------
| 36 matches for "[^-]outline-level" in buffer: org.el
`-----------------------------------------------------

I'm not really sure how much of Org-mode and Outline is available when
orgstruct is loaded, and if and why there is a need for
'orgstruct-heading-prefix-regexp' - couldn't orgstruct just set a
buffer-local 'outline-regexp' instead? Some enlightment is welcome. 

-- 
cheers,
Thorsten
 




reply via email to

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