[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
From: |
Michael Brand |
Subject: |
[Orgmode] Re: `C-u 2 S-Tab' with `#+STARTUP: odd' |
Date: |
Wed, 14 Oct 2009 21:20:10 +0200 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
I have troube understanding what you mean.
An outline heading looks like this
*** heading
If the cursor is at the first character of that line, org-outline-level
will return 3.
I want `3' _independently_ of on which column the cursor is on that line and
therefore use (save-excursion (beginning-of-line) (org-outline-level)).
If the line looks different, the return value will be badly
determined (governed by the most recent match of a regular expression
anywhere in Emacs, might be anything).
To cover this I use (outline-on-heading-p), without the optional parameter in
my case.
If you need to find out, in a lisp program, if you are at the beginning
of a headline, use
(and (org-at-heading-p t) (bolp))
The matter is that within any one line I rather want to _ignore_ the column
than to _know_ on which column the cursor is.
With all discussed here in this thread combined together I use
(if (outline-on-heading-p)
(org-reduced-level
(save-excursion (beginning-of-line) (org-outline-level)))
'0)))
for my suggestion of heading visibility depth stepping described here
http://thread.gmane.org/gmane.emacs.orgmode/17581/focus=18392