From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: `C-u 2 S-Tab' with `#+STARTUP: odd' Date: Wed, 14 Oct 2009 15:58:15 +0200 Message-ID: References: 6D3A0AC2-C1BF-4541-8E55-0E3A4E488A67@gmail.com <4AD2D9A9.1030504@alumni.ethz.ch> <4AD38AE1.7000409@alumni.ethz.ch> <8850D7A8-1F73-494D-98CF-10AA691B1170@gmail.com> <4AD56D56.5050302@alumni.ethz.ch> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1My4Nm-0005PP-A0 for emacs-orgmode@gnu.org; Wed, 14 Oct 2009 09:59:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1My4Nh-0005M6-Mu for emacs-orgmode@gnu.org; Wed, 14 Oct 2009 09:59:13 -0400 Received: from [199.232.76.173] (port=55809 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1My4Nh-0005Lq-8H for emacs-orgmode@gnu.org; Wed, 14 Oct 2009 09:59:09 -0400 Received: from mail-ew0-f228.google.com ([209.85.219.228]:33521) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1My4Ng-0005pF-Nk for emacs-orgmode@gnu.org; Wed, 14 Oct 2009 09:59:08 -0400 Received: by ewy28 with SMTP id 28so18230633ewy.42 for ; Wed, 14 Oct 2009 06:59:05 -0700 (PDT) In-Reply-To: <4AD56D56.5050302@alumni.ethz.ch> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Michael Brand Cc: emacs-orgmode@gnu.org On Oct 14, 2009, at 8:19 AM, Michael Brand wrote: >>> There is something more with org-outline-level in org-version >>> 6.31a which I still don't understand because I am not aware of >>> some functions used in its implementation. I drilled down the >>> quite special situation to the following file content. I hope that >>> the indentation of x by three spaces does not get lost in the >>> mailing list archive: >>> >>> -*- eval: (org-mode) -*- >>> x >>> >>> After opening this file and confirming `eval', org-outline-level >>> reports `3' (changes when changing the indentation of x) but I >>> expect it to report someting like `0', `1000' or `1001' or similar >>> like it does with variations like e. g. >>> >>> -*- mode: org -*- >>> x >> The function assumes that the cursor is located at the beginning > > Ok. I found out that (save-excursion (beginning-of-line) (org- > outline-level)) can compensate. > >> of an outline heading. If it is not, it will return garbage. > > Here I am lost and would like some help. I was not able to find out > how to determine if the cursor is on a line with an outline heading > or not. 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. 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). 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)) HTH - Carsten - Carsten