From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niels Giesen Subject: Re: understanding the function outline-level Date: Tue, 7 Jun 2011 20:33:36 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:55869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QU15x-0006tT-Cl for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 14:33:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QU15u-0006GG-3r for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 14:33:40 -0400 Received: from mail-px0-f179.google.com ([209.85.212.179]:39715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QU15t-0006Fz-Q8 for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 14:33:38 -0400 Received: by pxi2 with SMTP id 2so3484398pxi.38 for ; Tue, 07 Jun 2011 11:33:36 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Michael Brand Cc: Org Mode 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 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