Hello, from Debian bug #645360 (http://bugs.debian.org/645360): Here's my test file, call it "c.org": * a ** aa *** aaa I put the cursor at the beginning of the file (at the * in the first line). Then I type C-c C-> (i.e. outline-demote). The result is ** a *** aa *** aaa I expected that the last line (the leaf node "aaa") would become a fourth-level heading, i.e. "**** aaa". Instead, the fourth * that I was hoping for looks like it became a space. There wasn't any patch provided by the submitter. Cheers, --Seb
Hi,
The Org manual (2.5 Structure editing) says to use M-S-<right>
(org-demote-subtree) for what the submitter wants to do.
Yours,
Christian
On 10/18/11 10:55 AM, Sébastien Delafond wrote:
> Hello,
>
> from Debian bug #645360 (http://bugs.debian.org/645360):
>
> Here's my test file, call it "c.org":
>
> * a
> ** aa
> *** aaa
>
> I put the cursor at the beginning of the file (at the * in the first
> line). Then I type C-c C-> (i.e. outline-demote). The result is
>
> ** a
> *** aa
> *** aaa
>
> I expected that the last line (the leaf node "aaa") would become a
> fourth-level heading, i.e. "**** aaa". Instead, the fourth * that I
> was hoping for looks like it became a space.
>
> There wasn't any patch provided by the submitter.
>
> Cheers,
>
> --Seb
>
>
>
I agree that's not a valid bug and should be closed.
-Bernt
Christian Moe <mail@christianmoe.com> writes:
> Hi,
>
> The Org manual (2.5 Structure editing) says to use M-S-<right>
> (org-demote-subtree) for what the submitter wants to do.
>
> Yours,
> Christian
>
> On 10/18/11 10:55 AM, Sébastien Delafond wrote:
>> Hello,
>>
>> from Debian bug #645360 (http://bugs.debian.org/645360):
>>
>> Here's my test file, call it "c.org":
>>
>> * a
>> ** aa
>> *** aaa
>>
>> I put the cursor at the beginning of the file (at the * in the first
>> line). Then I type C-c C-> (i.e. outline-demote). The result is
>>
>> ** a
>> *** aa
>> *** aaa
>>
>> I expected that the last line (the leaf node "aaa") would become a
>> fourth-level heading, i.e. "**** aaa". Instead, the fourth * that I
>> was hoping for looks like it became a space.
>>
>> There wasn't any patch provided by the submitter.
>>
>> Cheers,
>>
>> --Seb
>>
>>
>>
On 2011-10-18, Bernt Hansen <bernt@norang.ca> wrote:
> I agree that's not a valid bug and should be closed.
gotcha, will do. Christian & Bernt, thanks a lot for your input !
Cheers,
--Seb
Sébastien Delafond <sdelafond@gmail.com> writes:
> On 2011-10-18, Bernt Hansen <bernt@norang.ca> wrote:
>> I agree that's not a valid bug and should be closed.
>
> gotcha, will do. Christian & Bernt, thanks a lot for your input !
>
> Cheers,
>
> --Seb
There's M-right and M-S-right for demoting headings - the shift version
also demotes the child tasks as the poster wanted. (Similarly M-left and
M-S-left promotes tasks)
Regards,
Bernt
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.
So, I wonder whether org mode is somehow messing up outline-demote without
meaning to? I am far from an expert on the org.el lisp code, and maybe the
current org-mode behavior is the intended result. But I worry that it is not
intended and instead is an accidental side effect of something else.
-Sanjoy
Sanjoy Mahajan <sanjoy@olin.edu> 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. That seems like an unreasonable expectation to me. Despite the similarities, it's a completely different function, with different pre- and post- conditions and different assumptions about what the data looks like. [Warning: stupid analogy ahead] When you need to turn a screw, you look at the head and choose the right screwdriver for it. If you use a Philips screwdriver to turn a square-drive screw, you'll damage the screw even if you do manage to turn it a bit. > 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. > To continue the analogy: sure, if you replace the square drive screw with a Philips screw, you can turn it with the Philips screwdriver. > So, I wonder whether org mode is somehow messing up outline-demote without > meaning to? I am far from an expert on the org.el lisp code, and maybe the > current org-mode behavior is the intended result. But I worry that it is not > intended and instead is an accidental side effect of something else. > No: orgmode uses a small subset of outline-* functions, mostly to navigate between headings, but it does not use outline-demote at all. Nick
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
Carsten, Thank you for the very clear explanation. I like this option that you suggested: (add-hook 'org-mode-hook (lambda () (define-key org-mode-map [(control ?<)] 'org-promote-subtree) (define-key org-mode-map [(control ?>)] 'org-demote-subtree))) It makes outline mode adapt to the new age (org mode). -- -Sanjoy `Until lions have their historians, tales of the hunt shall always glorify the hunters.' --African Proverb
Hi Carsten On 18.10.2011, at 20:03, Sanjoy Mahajan wrote: > 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. On Wed, Oct 19, 2011 at 09:14, Carsten Dominik <carsten.dominik@gmail.com> wrote: > 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))) My suggestion is something like (define-key org-mode-map [remap outline-promote] 'org-promote-subtree) (define-key org-mode-map [remap outline-demote] 'org-demote-subtree) [...] permanently built into Org mode (not in org-mode-hook) for these and maybe even a few more outline-* bindings to get the incompatible outline-* bindings out of the way from within Org mode. This remap does not affect the bindings in Outline mode and resolves the issue of the OP in Org mode, independent of, to which key any user might have mapped outline-*mote. Michael
Hi Michael, Michael Brand <michael.ch.brand@gmail.com> writes: > My suggestion is something like > > (define-key org-mode-map [remap outline-promote] 'org-promote-subtree) > (define-key org-mode-map [remap outline-demote] 'org-demote-subtree) I've taken this road and committed the change, thanks for the suggestion. > permanently built into Org mode (not in org-mode-hook) for these and > maybe even a few more outline-* bindings to get the incompatible > outline-* bindings out of the way from within Org mode. If other use-cases come up, we will handle them then. Thanks, -- Bastien
On Oct 19, 2011, at 5:39 PM, Michael Brand wrote:
> Hi Carsten
>
> On 18.10.2011, at 20:03, Sanjoy Mahajan wrote:
>> 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.
>
> On Wed, Oct 19, 2011 at 09:14, Carsten Dominik
> <carsten.dominik@gmail.com> wrote:
>> 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)))
>
> My suggestion is something like
>
> (define-key org-mode-map [remap outline-promote] 'org-promote-subtree)
> (define-key org-mode-map [remap outline-demote] 'org-demote-subtree)
> [...]
>
> permanently built into Org mode (not in org-mode-hook) for these and
> maybe even a few more outline-* bindings to get the incompatible
> outline-* bindings out of the way from within Org mode.
>
> This remap does not affect the bindings in Outline mode and resolves
> the issue of the OP in Org mode, independent of, to which key any user
> might have mapped outline-*mote.
Would you like to carefully think about which other functions you might want to have remapped, and then prepare a patch?
- Carsten
Hi Carsten,
Carsten Dominik <carsten.dominik@gmail.com> writes:
>> permanently built into Org mode (not in org-mode-hook) for these and
>> maybe even a few more outline-* bindings to get the incompatible
>> outline-* bindings out of the way from within Org mode.
>>
>> This remap does not affect the bindings in Outline mode and resolves
>> the issue of the OP in Org mode, independent of, to which key any user
>> might have mapped outline-*mote.
>
> Would you like to carefully think about which other functions you might
> want to have remapped, and then prepare a patch?
I went ahead a applied a patch with Michael's suggestion.
Please feel free to revert the commit while waiting for a more
complete patch.
--
Bastien
Hi Carsten On Fri, Oct 21, 2011 at 16:40, Carsten Dominik <carsten.dominik@gmail.com> wrote: > On Oct 19, 2011, at 5:39 PM, Michael Brand wrote: >> (define-key org-mode-map [remap outline-promote] 'org-promote-subtree) >> (define-key org-mode-map [remap outline-demote] 'org-demote-subtree) >> [...] > > Would you like to carefully think about which other functions you > might want to have remapped ... I started to go through the functions that are bound in outline-mode-prefix-map to compare their behavior with that of the Org equivalents. Now I stumbled upon outline/org-forward/backward-same-level. All four doc strings state "Stop at the first and last subheadings of a superior heading", but the Org ones don't. As I remember, Org "motion on same level" C-c C-f/b once stopped. Git bisect shows that this had been the case before the "motion on same level" functionality moved into the new functions org-forward/backward-same-level with http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=0eaf3cce At that time the (error "No following same-level heading") disappeared. I assume that Org mode should still stop as documented and like Outline mode. If this is true I'd like to ask you if you could help to resolve this. Of course I tried to do it myself but have to admit that it would mean too much effort for me to understand what happens before and after the commit with the three optimization levels that it implements. > and then prepare a patch? I'll add the two new pairs from above and probably some more into a follow-up to this http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=b2632dc4 when I'll be finished with going through outline-mode-prefix-map. Michael
[-- Attachment #1: Type: text/plain, Size: 1808 bytes --] Hi Carsten Attached is the patch with this changelog: Completion of remapping for Outline functions * lisp/org.el Key bindings: remap the Outline functions from `outline-mode-prefix-map' where possible. Michael On Sat, Oct 22, 2011 at 10:15, Michael Brand <michael.ch.brand@gmail.com> wrote: > On Fri, Oct 21, 2011 at 16:40, Carsten Dominik > <carsten.dominik@gmail.com> wrote: >> Would you like to carefully think about which other functions you >> might want to have remapped ... > > I started to go through the functions that are bound in > outline-mode-prefix-map to compare their behavior with that of the Org > equivalents. Now I stumbled upon > outline/org-forward/backward-same-level. All four doc strings state > "Stop at the first and last subheadings of a superior heading", but > the Org ones don't. As I remember, Org "motion on same level" C-c > C-f/b once stopped. Git bisect shows that this had been the case > before the "motion on same level" functionality moved into the new > functions org-forward/backward-same-level with > http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=0eaf3cce > At that time the (error "No following same-level heading") > disappeared. > > I assume that Org mode should still stop as documented and like > Outline mode. If this is true I'd like to ask you if you could help to > resolve this. Of course I tried to do it myself but have to admit that > it would mean too much effort for me to understand what happens before > and after the commit with the three optimization levels that it > implements. > >> and then prepare a patch? > > I'll add the two new pairs from above and probably some more into a > follow-up to this > http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=b2632dc4 > when I'll be finished with going through outline-mode-prefix-map. [-- Attachment #2: 0001-Completion-of-remapping-for-Outline-functions.patch.txt --] [-- Type: text/plain, Size: 3160 bytes --] From 8de47296168ae9c83a81899046ce79a16136c6ee Mon Sep 17 00:00:00 2001 From: Michael Brand <michael.ch.brand@gmail.com> Date: Wed, 9 Nov 2011 19:07:45 +0100 Subject: [PATCH] Completion of remapping for Outline functions * lisp/org.el Key bindings: remap the Outline functions from `outline-mode-prefix-map' where possible. --- lisp/org.el | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 5c4ea33..e24cdae 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17074,9 +17074,43 @@ (defun org-remove-inline-images () ;;;; Key bindings -;; Remap outline keys +;; Outline functions from `outline-mode-prefix-map' +;; that can be remapped in Org: +(define-key org-mode-map [remap outline-mark-subtree] 'org-mark-subtree) +(define-key org-mode-map [remap show-subtree] 'org-show-subtree) +(define-key org-mode-map [remap outline-forward-same-level] + 'org-forward-same-level) +(define-key org-mode-map [remap outline-backward-same-level] + 'org-backward-same-level) +(define-key org-mode-map [remap show-branches] + 'org-kill-note-or-show-branches) (define-key org-mode-map [remap outline-promote] 'org-promote-subtree) (define-key org-mode-map [remap outline-demote] 'org-demote-subtree) +(define-key org-mode-map [remap outline-insert-heading] 'org-ctrl-c-ret) + +;; Outline functions from `outline-mode-prefix-map' +;; that can not be remapped in Org: +;; - the column "key binding" shows whether the Outline function is still +;; available in Org mode on the same key that it has been bound to in +;; Outline mode: +;; - "overridden": key used for a different functionality in Org mode +;; - else: key still bound to the same Outline function in Org mode +;; | Outline function | key binding | Org replacement | +;; |------------------------------------+-------------+-----------------------| +;; | `outline-next-visible-heading' | `C-c C-n' | still same function | +;; | `outline-previous-visible-heading' | `C-c C-p' | still same function | +;; | `show-children' | `C-c C-i' | visibility cycling | +;; | `hide-subtree' | overridden | visibility cycling | +;; | `outline-up-heading' | `C-c C-u' | still same function | +;; | `hide-body' | overridden | no replacement | +;; | `show-all' | overridden | no replacement | +;; | `hide-entry' | overridden | visibility cycling | +;; | `show-entry' | overridden | no replacement | +;; | `hide-leaves' | overridden | no replacement | +;; | `hide-sublevels' | overridden | no replacement | +;; | `hide-other' | overridden | no replacement | +;; | `outline-move-subtree-up' | `C-c C-^' | better: org-shiftup | +;; | `outline-move-subtree-down' | overridden | better: org-shiftdown | ;; Make `C-c C-x' a prefix key (org-defkey org-mode-map "\C-c\C-x" (make-sparse-keymap)) -- 1.6.2.1
Hi Michael,
Michael Brand <michael.ch.brand@gmail.com> writes:
> Attached is the patch with this changelog:
>
> Completion of remapping for Outline functions
>
> * lisp/org.el Key bindings: remap the Outline functions from
> `outline-mode-prefix-map' where possible.
Thanks a lot for going through this systematically.
I've now applied your patch.
Best,
--
Bastien