emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] understanding the function outline-level


From: Niels Giesen
Subject: Re: [O] understanding the function outline-level
Date: Tue, 7 Jun 2011 20:33:36 +0200

Hi Michael,

match data get set by searches. One can inhibit match-data being
cluttered by using the `save-match-data' macro (you should probably do
so when using searches in a lisp program).

Outline.el seems to make very frequent use of this 'global' data;
instead of passing this data on via function arguments or so, it
depends on this dynamically set data, which makes it very hard to see
who does what.

Some prodding about led me to believe the searching in
`outline-back-to-heading' is your suspect (but I have not investigated
this further). At least

(progn
  (outline-back-to-heading)
  (outline-level))

Returns a reasonable answer each time I run it.

(info "(Elisp)Match Data")

May be of interest to you.

On Tue, Jun 7, 2011 at 6:23 PM, Michael Brand
<address@hidden> wrote:
> Hi all
>
> I am on the way of tracking down an (Org?) buglet and now
> outline-level tries to strike me with my lack of experience with
> "Match Data" of Emacs search and I would like to ask for some help to
> understand.
>
> M-: (outline-level) returns a value that I don't understand yet. The
> number does not correspond to the amount of stars and is independent
> of at the beginning of which line the point was before. And when I
> look at the implementation of outline-level I am missing a function
> that initializes the "Match Data". Where is that last search or match
> operation?
>
> Michael
>
>



-- 
http://pft.github.com



reply via email to

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