emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* `C-u 2 S-Tab' with `#+STARTUP: odd'
@ 2009-09-10 11:48 Michael Brand
  2009-09-10 16:32 ` Carsten Dominik
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Michael Brand @ 2009-09-10 11:48 UTC (permalink / raw)
  To: emacs-orgmode

I like the org-indent-mode with the soft-indentation but even more I
like the hard-indentation with `#+STARTUP: odd hidestars' instead for
which I have a question.

This is the content of the example file oddeven:
-*- mode: org -*-
#+STARTUP: oddeven hidestars content
* 1 Org Mode
** 1.1 Introduction
*** 1.1.1 Installation

This is the content of the example file odd:
-*- mode: org -*-
#+STARTUP: odd hidestars content
* 1 Org Mode
*** 1.1 Introduction
***** 1.1.1 Installation

The different _Emacs-faces_ (colors) for the heading levels are the same
when comparing the two files. This Emacs-internal adaptation I
appreciate a lot.

C-u 2 S-Tab shows _two_ levels with the file oddeven but only _one_ with
the file odd. Is this how it is intended to work for the file odd?


org-version is 6.30e.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-09-10 11:48 Michael Brand
@ 2009-09-10 16:32 ` Carsten Dominik
  2009-10-14 10:15 ` Carsten Dominik
  2009-10-14 13:58 ` Carsten Dominik
  2 siblings, 0 replies; 13+ messages in thread
From: Carsten Dominik @ 2009-09-10 16:32 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode

Hi Michael,

yes, I agree it would be consistent to adapt the interpretation
of the prefix arg when using odd-levels.

I have fixed this, it is available in git now, and will be in
the next release (6.31).

Thanks!

- Carsten

On Sep 10, 2009, at 1:48 PM, Michael Brand wrote:

> I like the org-indent-mode with the soft-indentation but even more I
> like the hard-indentation with `#+STARTUP: odd hidestars' instead for
> which I have a question.
>
> This is the content of the example file oddeven:
> -*- mode: org -*-
> #+STARTUP: oddeven hidestars content
> * 1 Org Mode
> ** 1.1 Introduction
> *** 1.1.1 Installation
>
> This is the content of the example file odd:
> -*- mode: org -*-
> #+STARTUP: odd hidestars content
> * 1 Org Mode
> *** 1.1 Introduction
> ***** 1.1.1 Installation
>
> The different _Emacs-faces_ (colors) for the heading levels are the  
> same
> when comparing the two files. This Emacs-internal adaptation I
> appreciate a lot.
>
> C-u 2 S-Tab shows _two_ levels with the file oddeven but only _one_  
> with
> the file odd. Is this how it is intended to work for the file odd?
>
>
> org-version is 6.30e.
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
@ 2009-10-12  7:24 Michael Brand
  2009-10-12 13:15 ` Carsten Dominik
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Brand @ 2009-10-12  7:24 UTC (permalink / raw)
  To: carsten.dominik; +Cc: emacs-orgmode

Thank you for the fix of the function org-shifttab in org-version 6.31a.

I wonder how the function org-outline-level is intended to work. Should it show the outline level or count the stars like in org-version 6.31a and one has to take into account `odd' himself to get the outline level when implementing own stuff which use e. g. the function org-shifttab?


> yes, I agree it would be consistent to adapt the interpretation
> of the prefix arg when using odd-levels.
> 
> I have fixed this, it is available in git now, and will be in
> the next release (6.31).
> 
> Thanks!
> 
> - Carsten
> 
> On Sep 10, 2009, at 1:48 PM, Michael Brand wrote:
> 
>> I like the org-indent-mode with the soft-indentation but even more I
>> like the hard-indentation with `#+STARTUP: odd hidestars' instead for
>> which I have a question.
>>
>> This is the content of the example file oddeven:
>> -*- mode: org -*-
>> #+STARTUP: oddeven hidestars content
>> * 1 Org Mode
>> ** 1.1 Introduction
>> *** 1.1.1 Installation
>>
>> This is the content of the example file odd:
>> -*- mode: org -*-
>> #+STARTUP: odd hidestars content
>> * 1 Org Mode
>> *** 1.1 Introduction
>> ***** 1.1.1 Installation
>>
>> The different _Emacs-faces_ (colors) for the heading levels are the  same
>> when comparing the two files. This Emacs-internal adaptation I
>> appreciate a lot.
>>
>> C-u 2 S-Tab shows _two_ levels with the file oddeven but only _one_  with
>> the file odd. Is this how it is intended to work for the file odd?
>>
>>
>> org-version is 6.30e.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-10-12  7:24 `C-u 2 S-Tab' with `#+STARTUP: odd' Michael Brand
@ 2009-10-12 13:15 ` Carsten Dominik
  2009-10-12 20:00   ` Michael Brand
  0 siblings, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2009-10-12 13:15 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode


On Oct 12, 2009, at 9:24 AM, Michael Brand wrote:

> Thank you for the fix of the function org-shifttab in org-version  
> 6.31a.
>
> I wonder how the function org-outline-level is intended to work.  
> Should it show the outline level or count the stars like in org- 
> version 6.31a and one has to take into account `odd' himself to get  
> the outline level when implementing own stuff which use e. g. the  
> function org-shifttab?

org-outline-level shows the number of stars, independently of org-odd- 
levels

Use

    (org-reduced-level (org-outline-level))

to get normalized levels.

Inside org, you need to check which function works with what kind
of level, this is unfortunately not entirely abstracted.

HTH

- Carsten

>
>
>> yes, I agree it would be consistent to adapt the interpretation
>> of the prefix arg when using odd-levels.
>> I have fixed this, it is available in git now, and will be in
>> the next release (6.31).
>> Thanks!
>> - Carsten
>> On Sep 10, 2009, at 1:48 PM, Michael Brand wrote:
>>> I like the org-indent-mode with the soft-indentation but even more I
>>> like the hard-indentation with `#+STARTUP: odd hidestars' instead  
>>> for
>>> which I have a question.
>>>
>>> This is the content of the example file oddeven:
>>> -*- mode: org -*-
>>> #+STARTUP: oddeven hidestars content
>>> * 1 Org Mode
>>> ** 1.1 Introduction
>>> *** 1.1.1 Installation
>>>
>>> This is the content of the example file odd:
>>> -*- mode: org -*-
>>> #+STARTUP: odd hidestars content
>>> * 1 Org Mode
>>> *** 1.1 Introduction
>>> ***** 1.1.1 Installation
>>>
>>> The different _Emacs-faces_ (colors) for the heading levels are  
>>> the  same
>>> when comparing the two files. This Emacs-internal adaptation I
>>> appreciate a lot.
>>>
>>> C-u 2 S-Tab shows _two_ levels with the file oddeven but only  
>>> _one_  with
>>> the file odd. Is this how it is intended to work for the file odd?
>>>
>>>
>>> org-version is 6.30e.

- Carsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-10-12 13:15 ` Carsten Dominik
@ 2009-10-12 20:00   ` Michael Brand
  2009-10-13 18:47     ` Carsten Dominik
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Brand @ 2009-10-12 20:00 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

>> I wonder how the function org-outline-level is intended to work. 
>> Should it show the outline level or count the stars like in 
>> org-version 6.31a and one has to take into account `odd' himself to 
>> get the outline level when implementing own stuff which use e. g. the 
>> function org-shifttab?
> 
> org-outline-level shows the number of stars, independently of 
> org-odd-levels
> 
> Use
> 
>    (org-reduced-level (org-outline-level))
> 
> to get normalized levels.
> 
> Inside org, you need to check which function works with what kind
> of level, this is unfortunately not entirely abstracted.
> 
> HTH
> 
> - Carsten

Thank you, exactly what I have missed. Allow me to mention that I would like this hint to be added to the Help documentation of org-outline-level where I looked before.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-10-12 20:00   ` Michael Brand
@ 2009-10-13 18:47     ` Carsten Dominik
  2009-10-14  6:19       ` Michael Brand
  0 siblings, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2009-10-13 18:47 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode


On Oct 12, 2009, at 10:00 PM, Michael Brand wrote:

>>> I wonder how the function org-outline-level is intended to work.  
>>> Should it show the outline level or count the stars like in org- 
>>> version 6.31a and one has to take into account `odd' himself to  
>>> get the outline level when implementing own stuff which use e. g.  
>>> the function org-shifttab?
>> org-outline-level shows the number of stars, independently of org- 
>> odd-levels
>> Use
>>   (org-reduced-level (org-outline-level))
>> to get normalized levels.
>> Inside org, you need to check which function works with what kind
>> of level, this is unfortunately not entirely abstracted.
>> HTH
>> - Carsten
>
> Thank you, exactly what I have missed. Allow me to mention that I  
> would like this hint to be added to the Help documentation of org- 
> outline-level where I looked before.

Done.

>
> 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
of an outline heading.  If it is not, it will return garbage.

HTH

- Carsten




- Carsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-10-13 18:47     ` Carsten Dominik
@ 2009-10-14  6:19       ` Michael Brand
  2009-10-14 11:15         ` Bernt Hansen
  2009-10-14 13:58         ` Carsten Dominik
  0 siblings, 2 replies; 13+ messages in thread
From: Michael Brand @ 2009-10-14  6:19 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

>> 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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-09-10 11:48 Michael Brand
  2009-09-10 16:32 ` Carsten Dominik
@ 2009-10-14 10:15 ` Carsten Dominik
  2009-10-14 13:58 ` Carsten Dominik
  2 siblings, 0 replies; 13+ messages in thread
From: Carsten Dominik @ 2009-10-14 10:15 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode


On Sep 10, 2009, at 1:48 PM, Michael Brand wrote:

> I like the org-indent-mode with the soft-indentation but even more I
> like the hard-indentation with `#+STARTUP: odd hidestars' instead for
> which I have a question.
>
> This is the content of the example file oddeven:
> -*- mode: org -*-
> #+STARTUP: oddeven hidestars content
> * 1 Org Mode
> ** 1.1 Introduction
> *** 1.1.1 Installation
>
> This is the content of the example file odd:
> -*- mode: org -*-
> #+STARTUP: odd hidestars content
> * 1 Org Mode
> *** 1.1 Introduction
> ***** 1.1.1 Installation
>
> The different _Emacs-faces_ (colors) for the heading levels are the  
> same
> when comparing the two files. This Emacs-internal adaptation I
> appreciate a lot.
>
> C-u 2 S-Tab shows _two_ levels with the file oddeven but only _one_  
> with
> the file odd. Is this how it is intended to work for the file odd?

Actually, I tested this now, and it works correctly in 6.31.  I don't  
quite
remember when his was changed, but this is implemented already - sorry  
for
nor earlier looking what this really was about.

- Carsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-10-14  6:19       ` Michael Brand
@ 2009-10-14 11:15         ` Bernt Hansen
  2009-10-14 11:56           ` Michael Brand
  2009-10-14 13:58         ` Carsten Dominik
  1 sibling, 1 reply; 13+ messages in thread
From: Bernt Hansen @ 2009-10-14 11:15 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode, Carsten Dominik

Michael Brand <michael.brand@alumni.ethz.ch> writes:

> 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 think you can use the function org-on-heading-p to determine if you
are on a heading or not.

HTH
-Bernt

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-10-14 11:15         ` Bernt Hansen
@ 2009-10-14 11:56           ` Michael Brand
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Brand @ 2009-10-14 11:56 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

>> 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 think you can use the function org-on-heading-p to determine if you
> are on a heading or not.

Thank you, exactly what I have missed.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-10-14  6:19       ` Michael Brand
  2009-10-14 11:15         ` Bernt Hansen
@ 2009-10-14 13:58         ` Carsten Dominik
  2009-10-14 19:20           ` Michael Brand
  1 sibling, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2009-10-14 13:58 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-09-10 11:48 Michael Brand
  2009-09-10 16:32 ` Carsten Dominik
  2009-10-14 10:15 ` Carsten Dominik
@ 2009-10-14 13:58 ` Carsten Dominik
  2 siblings, 0 replies; 13+ messages in thread
From: Carsten Dominik @ 2009-10-14 13:58 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode


On Sep 10, 2009, at 1:48 PM, Michael Brand wrote:

> I like the org-indent-mode with the soft-indentation but even more I
> like the hard-indentation with `#+STARTUP: odd hidestars' instead for
> which I have a question.
>
> This is the content of the example file oddeven:
> -*- mode: org -*-
> #+STARTUP: oddeven hidestars content
> * 1 Org Mode
> ** 1.1 Introduction
> *** 1.1.1 Installation
>
> This is the content of the example file odd:
> -*- mode: org -*-
> #+STARTUP: odd hidestars content
> * 1 Org Mode
> *** 1.1 Introduction
> ***** 1.1.1 Installation
>
> The different _Emacs-faces_ (colors) for the heading levels are the  
> same
> when comparing the two files. This Emacs-internal adaptation I
> appreciate a lot.
>
> C-u 2 S-Tab shows _two_ levels with the file oddeven but only _one_  
> with
> the file odd. Is this how it is intended to work for the file odd?

Actually, I tested this now, and it works correctly in 6.31.  I don't  
quite
remember when his was changed, but this is implemented already - sorry  
for
nor earlier looking what this really was about.

- Carsten

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: `C-u 2 S-Tab' with `#+STARTUP: odd'
  2009-10-14 13:58         ` Carsten Dominik
@ 2009-10-14 19:20           ` Michael Brand
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Brand @ 2009-10-14 19:20 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-10-14 19:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-12  7:24 `C-u 2 S-Tab' with `#+STARTUP: odd' Michael Brand
2009-10-12 13:15 ` Carsten Dominik
2009-10-12 20:00   ` Michael Brand
2009-10-13 18:47     ` Carsten Dominik
2009-10-14  6:19       ` Michael Brand
2009-10-14 11:15         ` Bernt Hansen
2009-10-14 11:56           ` Michael Brand
2009-10-14 13:58         ` Carsten Dominik
2009-10-14 19:20           ` Michael Brand
  -- strict thread matches above, loose matches on Subject: below --
2009-09-10 11:48 Michael Brand
2009-09-10 16:32 ` Carsten Dominik
2009-10-14 10:15 ` Carsten Dominik
2009-10-14 13:58 ` Carsten Dominik

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).