emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] outline-demote incorrectly demotes leaf nodes


From: Carsten Dominik
Subject: Re: [O] outline-demote incorrectly demotes leaf nodes
Date: Wed, 19 Oct 2011 09:14:16 +0200

On 18.10.2011, at 20:03, Sanjoy Mahajan wrote:

> Christian Moe <mail <at> christianmoe.com> writes:
> 
>> The Org manual (2.5 Structure editing) says to use M-S-≤right> 
>> (org-demote-subtree) for what the submitter wants to do.
> 
> (I am the original reporter of the issue on the Debian BTS.)  That is useful
> information for me, and I will use those keys.
> 
> I do worry about one point, namely that C-c C-> (outline-demote) should still
> work.  And it does work in regular outline mode.  For example, if I rename my
> test file to c.otl and then use C-c C-> on the main heading, all the subtrees
> are demoted as I expected.  Whereas in org mode the leaf subtree gets a space
> instead of a * when it is being demoted.

The reason for this is because in outline mode, headings are starting with
a number of stars, while in Org-mode, they start with stars followed
by a space.  So "***News" is a heading in outline-mode, but not in Org-mode,
where you'd have to use "*** News".
When outline-mode tries to invent a new heading during demoting, it replicates
the last character in the headline marker, and that will be a star in 
outline-mode
and the space in Org-mode.

We could fix this by defining outline-headling-alist in org-mode.  For example,
you could do it like this:


(add-hook 'org-mode-hook
   (lambda ()
     (setq outline-heading-alist '(("* " . 1) ("** " . 2) ......))))

and make sure to mention all levels you might possibly every use.
However, Org-mode is not outline mode, and there is no guarantee that
outline functions will work.

Another option, if you prefer the C-> and C-< bindings is this:

(add-hook 'org-mode-hook
   (lambda ()
     (define-key org-mode-map [(control ?<)] 'org-promote-subtree)
     (define-key org-mode-map [(control ?>)] 'org-demote-subtree)))

HTH

- Carsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]