Michael Brand <michael.ch.br...@gmail.com> 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 > > --