From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: understanding the function outline-level Date: Tue, 07 Jun 2011 23:24:01 +0530 Message-ID: <81r575mssm.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QU0Tw-0004qF-Se for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 13:54:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QU0Tv-0007Gi-Ak for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 13:54:24 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]:33272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QU0Tu-0007Ga-TP for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 13:54:23 -0400 Received: by pzk4 with SMTP id 4so3195625pzk.0 for ; Tue, 07 Jun 2011 10:54:21 -0700 (PDT) In-Reply-To: (Michael Brand's message of "Tue, 7 Jun 2011 18:23:27 +0200") 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 Michael Brand writes: > 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? (A quick hint. May not be complete though) The typical call sequence seems to be: 1. Move the cursor to a headline. 2. Call outline-level. It is (1) which presumably does a regexp search and ends up in the headline. So outline-level cannot be called in and of itself. It always need to be preceded by some other call which positions the cursor in a headline in the first place. Cursory look suggests that there are multiple ways by which (1) could be achieved - mostly they seem to be outline tree traversal functions. Summary: Look at outline-level in source code. Jump a few lines above and watch out for any sort of traversal functions. ,----[ C-h f outline-level RET ] | outline-level is a compiled Lisp function in `outline.el'. | | (outline-level) | | Return the depth to which a statement is nested in the outline. | Point must be at the beginning of a header line. | This is actually either the level specified in `outline-heading-alist' | or else the number of characters matched by `outline-regexp'. | | [back] `---- > > Michael > > --