emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Niels Giesen <niels.giesen@gmail.com>
To: Michael Brand <michael.ch.brand@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: understanding the function outline-level
Date: Tue, 7 Jun 2011 20:33:36 +0200	[thread overview]
Message-ID: <BANLkTinrHF7FUBSEqZ=HD0O0GiTXzrbYSA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikSyCCo8SW3kGK95O1s+SajdA8v+Q@mail.gmail.com>

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
<michael.ch.brand@gmail.com> 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

  parent reply	other threads:[~2011-06-07 18:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 16:23 understanding the function outline-level Michael Brand
2011-06-07 17:54 ` Jambunathan K
2011-06-07 18:33 ` Niels Giesen [this message]
2011-06-09  7:04   ` Michael Brand
2011-06-09  7:51   ` Carsten Dominik
2011-06-07 20:30 ` Aankhen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTinrHF7FUBSEqZ=HD0O0GiTXzrbYSA@mail.gmail.com' \
    --to=niels.giesen@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=michael.ch.brand@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).