emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* avoiding "First item of list cannot move without its subtree"
@ 2017-02-20 12:58 Max Rydahl Andersen
  2017-02-20 16:27 ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Max Rydahl Andersen @ 2017-02-20 12:58 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]

Hi,

First time poster and recently started using org-mode and so far 
enjoying it :)

One nag I do have though is how moving of basic lists are handled.
I constantly bump into "First item of list cannot move without its 
subtree"

Is there a way to avoid this error and instead be given the option to 
say "Please just move it up to the next level" ?

What I often have is that I during a meeting or brain dump do this:

```
* Some important topic
   - idea 1, some notes
   - idea 2, another note
   - idea 3, a third note
```

And then I go over these and I use the shift/alt+keys to reorder the 
ideas up and down and eventually I would like to do this:

```
* Some important topic
   - idea 1, some notes
   ** TODO idea 2, another note
   - idea 3, a third note
```

I know I can press a short cut to make it a top item, but why can't I 
just use the normal standard tree editing keys ?

Is there a way to have org-mode ask what kind of thing it should do when 
I move the lists "out-of-bounds" instead
of just error out on me ?

Thank you,
/max
http://about.me/maxandersen

[-- Attachment #2: Type: text/html, Size: 2165 bytes --]

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-20 12:58 Max Rydahl Andersen
@ 2017-02-20 16:27 ` Nicolas Goaziou
  2017-02-20 21:35   ` Max Rydahl Andersen
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2017-02-20 16:27 UTC (permalink / raw)
  To: Max Rydahl Andersen; +Cc: Org-mode

Hello,

"Max Rydahl Andersen" <manderse@redhat.com> writes:

> What I often have is that I during a meeting or brain dump do this:
>
> ```
> * Some important topic
>   - idea 1, some notes
>   - idea 2, another note
>   - idea 3, a third note
> ```

OK.

> And then I go over these and I use the shift/alt+keys to reorder the
> ideas up and down and eventually I would like to do this:
>
> ```
> * Some important topic
>   - idea 1, some notes
>   ** TODO idea 2, another note
>   - idea 3, a third note
> ```

What is that? Is "** TODO idea 2, another note" a headline, in which
case it should be at column 0?

Headlines are different from plain lists. You can use C-c * on second
item to turn it into a headline.

You can also move to the beginning of line (C-a), kill word (M-d) and
insert the two stars. It is a longer but maybe more natural, since those
are standard text editing keys.

> I know I can press a short cut to make it a top item, but why can't
> I just use the normal standard tree editing keys ?

I'm not sure to understand what "standard tree editing keys" you're
talking about.

AFAIU, you want to turn a structure (a list) into another one (a
headline). There's a command for that, but I don't consider the action
to be a standard editing one.

> Is there a way to have org-mode ask what kind of thing it should do
> when I move the lists "out-of-bounds" instead
> of just error out on me ?

IMO, you may be mis-using the tool.

Regards,

-- 
Nicolas Goaziou

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

* Re: avoiding "First item of list cannot move without its subtree"
       [not found] <cabe8a30ab4e4a79a7d100b0d07093d6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-02-20 16:32 ` Eric S Fraga
  2017-02-20 21:40   ` Max Rydahl Andersen
  0 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2017-02-20 16:32 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

On Monday, 20 Feb 2017 at 12:58, Max Rydahl Andersen wrote:
> Hi,
>
> First time poster and recently started using org-mode and so far enjoying it :)
>
> One nag I do have though is how moving of basic lists are handled.
> I constantly bump into "First item of list cannot move without its subtree"
>
> Is there a way to avoid this error and instead be given the option to
> say "Please just move it up to the next level" ?
>
> What I often have is that I during a meeting or brain dump do this:
>
> * Some important topic
>   - idea 1, some notes
>   - idea 2, another note
>   - idea 3, a third note

Maybe change your approach and use headlines throughout:

* Some important topic
** idea 1
some notes
** idea 2
another note
** idea 3
a third note

?

You can still move these about and pro/de-mote them as required but you
can now add task management keywords easily.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.4-242-g2c27b8

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-20 16:27 ` Nicolas Goaziou
@ 2017-02-20 21:35   ` Max Rydahl Andersen
  2017-02-21  7:42     ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Max Rydahl Andersen @ 2017-02-20 21:35 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]

>> And then I go over these and I use the shift/alt+keys to reorder the
>> ideas up and down and eventually I would like to do this:
>>
>> ```
>> * Some important topic
>>   - idea 1, some notes
>>   ** TODO idea 2, another note
>>   - idea 3, a third note
>> ```
>
> What is that? Is "** TODO idea 2, another note" a headline, in which
> case it should be at column 0?

Yes sorry, bad indent.

> Headlines are different from plain lists. You can use C-c * on second
> item to turn it into a headline.

Yes, I know about that one - but I would prefer not having to change to
another set of keys :)

I can do shift arrow left/rigt/up/down for the list item *until* I hit 
the top heading.

> You can also move to the beginning of line (C-a), kill word (M-d) and
> insert the two stars. It is a longer but maybe more natural, since 
> those
> are standard text editing keys.

this is what I do know - just more tedious if shift + arrows could ask 
instead of blocking.

>> I know I can press a short cut to make it a top item, but why can't
>> I just use the normal standard tree editing keys ?
>
> I'm not sure to understand what "standard tree editing keys" you're
> talking about.

shift arrows up/down/left/righit.

> AFAIU, you want to turn a structure (a list) into another one (a
> headline). There's a command for that, but I don't consider the action
> to be a standard editing one.

Yes, but it would be so convenient it would not just block edit and 
require
shifting to completely different keys IMO.

>> Is there a way to have org-mode ask what kind of thing it should do
>> when I move the lists "out-of-bounds" instead
>> of just error out on me ?
>
> IMO, you may be mis-using the tool.

Might be - but seems it fits very naturally to be able to at least allow 
to move list items outside its parent.

Don't get me wrong - I  like it defaults to stopping, but would prefer 
it would ask or let me do shift + left + left to override or something 
similar.


/max
http://about.me/maxandersen

[-- Attachment #2: Type: text/html, Size: 4352 bytes --]

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-20 16:32 ` avoiding "First item of list cannot move without its subtree" Eric S Fraga
@ 2017-02-20 21:40   ` Max Rydahl Andersen
  0 siblings, 0 replies; 15+ messages in thread
From: Max Rydahl Andersen @ 2017-02-20 21:40 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode


>> * Some important topic
>>   - idea 1, some notes
>>   - idea 2, another note
>>   - idea 3, a third note
>
> Maybe change your approach and use headlines throughout:
>
> * Some important topic
> ** idea 1
> some notes
> ** idea 2
> another note
> ** idea 3
> a third note
>
> ?
>
> You can still move these about and pro/de-mote them as required but 
> you
> can now add task management keywords easily.

I did it this way until I learned about basic lists.

I prefer basic lists because they visually default to be much less 
prominent highlighted.

Thus I prefer the lighter approach by default and only make thins into 
headings when needed.

/max
http://about.me/maxandersen

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-20 21:35   ` Max Rydahl Andersen
@ 2017-02-21  7:42     ` Nicolas Goaziou
  2017-02-21 16:07       ` Max Rydahl Andersen
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2017-02-21  7:42 UTC (permalink / raw)
  To: Max Rydahl Andersen; +Cc: Org-mode

Hello,

"Max Rydahl Andersen" <manderse@redhat.com> writes:

> Might be - but seems it fits very naturally to be able to at least
> allow to move list items outside its parent.
>
> Don't get me wrong - I  like it defaults to stopping, but would prefer
> it would ask or let me do shift + left + left to override or something
> similar.

IMO, the current behaviour is the right one.

However, you can advice, e.g., `org-shiftmetaleft' so it catches the
error and calls `org-ctrl-c-star' instead.

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-21  7:42     ` Nicolas Goaziou
@ 2017-02-21 16:07       ` Max Rydahl Andersen
  2017-02-21 17:35         ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Max Rydahl Andersen @ 2017-02-21 16:07 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

On 21 Feb 2017, at 8:42, Nicolas Goaziou wrote:

> Hello,
>
> "Max Rydahl Andersen" <manderse@redhat.com> writes:
>
>> Might be - but seems it fits very naturally to be able to at least
>> allow to move list items outside its parent.
>>
>> Don't get me wrong - I  like it defaults to stopping, but would prefer
>> it would ask or let me do shift + left + left to override or something
>> similar.
>
> IMO, the current behaviour is the right one.
>
> However, you can advice, e.g., `org-shiftmetaleft' so it catches the
> error and calls `org-ctrl-c-star' instead.

Any pointers on how to do this ?

I tried this but no luck to get hooked in:

```
(defadvice org-fix-list-indent
    (around org-list-indent-item-generic)
  "Advise list indention to trigger creation of star instead"
  (message "DO MAGIC!")
  (ad-do-it)
)
```

But with this "DO MAGIC!" does not show up.

/max
http://about.me/maxandersen

[-- Attachment #2: Type: text/html, Size: 2048 bytes --]

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-21 16:07       ` Max Rydahl Andersen
@ 2017-02-21 17:35         ` Nicolas Goaziou
  2017-02-22  7:22           ` Max Rydahl Andersen
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2017-02-21 17:35 UTC (permalink / raw)
  To: Max Rydahl Andersen; +Cc: Org-mode

"Max Rydahl Andersen" <manderse@redhat.com> writes:

> Any pointers on how to do this ?
>
> I tried this but no luck to get hooked in:
>
> ```
> (defadvice org-fix-list-indent
>     (around org-list-indent-item-generic)
>   "Advise list indention to trigger creation of star instead"
>   (message "DO MAGIC!")
>   (ad-do-it)
> )
> ```
>
> But with this "DO MAGIC!" does not show up.

The function to advice is `org-shiftmetaleft', not
`org-fix-list-indent'.

Anyway, you can also add something like the following to
`org-shiftmetaleft-hook':

  (defun my-shiftmetaleft ()
    (interactive)
    (let* ((element (org-element-at-point))
           (list-parent (org-element-lineage element '(item plain-list) t)))
      (when (and list-parent
                 (= (line-beginning-position)
                    (org-element-property :post-affiliated element)))
        (call-interactively
         (if (org-element-lineage list-parent '(item)) ;not at top level
             #'org-outdent-item-tree
           #'org-ctrl-c-star))
        t)))
      

Regards,

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-21 17:35         ` Nicolas Goaziou
@ 2017-02-22  7:22           ` Max Rydahl Andersen
  2017-02-22 11:04             ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Max Rydahl Andersen @ 2017-02-22  7:22 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]

On 21 Feb 2017, at 18:35, Nicolas Goaziou wrote:

> "Max Rydahl Andersen" <manderse@redhat.com> writes:
>
>> Any pointers on how to do this ?
>>
>> I tried this but no luck to get hooked in:
>>
>> ```
>> (defadvice org-fix-list-indent
>>     (around org-list-indent-item-generic)
>>   "Advise list indention to trigger creation of star instead"
>>   (message "DO MAGIC!")
>>   (ad-do-it)
>> )
>> ```
>>
>> But with this "DO MAGIC!" does not show up.
>
> The function to advice is `org-shiftmetaleft', not
> `org-fix-list-indent'.
>
> Anyway, you can also add something like the following to
> `org-shiftmetaleft-hook':
>
>   (defun my-shiftmetaleft ()
>     (interactive)
>     (let* ((element (org-element-at-point))
>            (list-parent (org-element-lineage element '(item 
> plain-list) t)))
>       (when (and list-parent
>                  (= (line-beginning-position)
>                     (org-element-property :post-affiliated element)))
>         (call-interactively
>          (if (org-element-lineage list-parent '(item)) ;not at top 
> level
>              #'org-outdent-item-tree
>            #'org-ctrl-c-star))
>         t)))

Thanks! I did this but still no effect ;/

What am I doing wrong ?

```
(add-hook 'org-shiftmetaleft-hook
	  (lambda ()
	    (interactive)
	    (let* ((element (org-element-at-point))
		   (list-parent (org-element-lineage element '(item plain-list) t)))
	      (when (and list-parent
			 (= (line-beginning-position)
			    (org-element-property :post-affiliated element)))
		(call-interactively
		 (if (org-element-lineage list-parent '(item)) ;not at top level
		     #'org-outdent-item-tree
		   #'org-ctrl-c-star))
		t))))
```

/max
http://about.me/maxandersen

[-- Attachment #2: Type: text/html, Size: 2959 bytes --]

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-22  7:22           ` Max Rydahl Andersen
@ 2017-02-22 11:04             ` Nicolas Goaziou
  2017-02-23  7:36               ` Max Rydahl Andersen
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2017-02-22 11:04 UTC (permalink / raw)
  To: Max Rydahl Andersen; +Cc: Org-mode

Hello,

"Max Rydahl Andersen" <manderse@redhat.com> writes:

> What am I doing wrong ?

Nothing. There is a typo in my code.

> (add-hook 'org-shiftmetaleft-hook
> 	  (lambda ()
> 	    (interactive)
> 	    (let* ((element (org-element-at-point))
> 		   (list-parent (org-element-lineage element '(item plain-list) t)))
> 	      (when (and list-parent
> 			 (= (line-beginning-position)
> 			    (org-element-property :post-affiliated element)))

-> (org-element-property :post-affiliated list-parent)

> 		(call-interactively
> 		 (if (org-element-lineage list-parent '(item)) ;not at top level
> 		     #'org-outdent-item-tree
> 		   #'org-ctrl-c-star))
> 		t))))

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-22 11:04             ` Nicolas Goaziou
@ 2017-02-23  7:36               ` Max Rydahl Andersen
  2017-02-23 11:41                 ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Max Rydahl Andersen @ 2017-02-23  7:36 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

On 22 Feb 2017, at 12:04, Nicolas Goaziou wrote:

> Hello,
>
> "Max Rydahl Andersen" <manderse@redhat.com> writes:
>
>> What am I doing wrong ?
>
> Nothing. There is a typo in my code.

Fixed the typo - but still nothing happens :/

/max

>
>> (add-hook 'org-shiftmetaleft-hook
>> 	  (lambda ()
>> 	    (interactive)
>> 	    (let* ((element (org-element-at-point))
>> 		   (list-parent (org-element-lineage element '(item plain-list) t)))
>> 	      (when (and list-parent
>> 			 (= (line-beginning-position)
>> 			    (org-element-property :post-affiliated element)))
>
> -> (org-element-property :post-affiliated list-parent)
>
>> 		(call-interactively
>> 		 (if (org-element-lineage list-parent '(item)) ;not at top level
>> 		     #'org-outdent-item-tree
>> 		   #'org-ctrl-c-star))
>> 		t))))
>
> Regards,
>
> -- 
> Nicolas Goaziou                                                0x80A93738


/max
http://about.me/maxandersen

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-23  7:36               ` Max Rydahl Andersen
@ 2017-02-23 11:41                 ` Nicolas Goaziou
  2017-02-23 12:50                   ` Max Rydahl Andersen
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2017-02-23 11:41 UTC (permalink / raw)
  To: Max Rydahl Andersen; +Cc: Org-mode

Hello,

"Max Rydahl Andersen" <manderse@redhat.com> writes:

> Fixed the typo - but still nothing happens :/

"Nothing happens" is a bit vague. M-S-Left should demote an item. When
it reaches top-level, it should be turned into a headline. What happens
instead?

Regards,

-- 
Nicolas Goaziou

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-23 11:41                 ` Nicolas Goaziou
@ 2017-02-23 12:50                   ` Max Rydahl Andersen
  2017-02-23 13:07                     ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Max Rydahl Andersen @ 2017-02-23 12:50 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

On 23 Feb 2017, at 12:41, Nicolas Goaziou wrote:

> Hello,
>
> "Max Rydahl Andersen" <manderse@redhat.com> writes:
>
>> Fixed the typo - but still nothing happens :/
>
> "Nothing happens" is a bit vague. M-S-Left should demote an item. When
> it reaches top-level, it should be turned into a headline. What 
> happens
> instead?

The same as before, i.e. I observe no difference.

Here is a screencast of me trying before and after evaluating buffer 
with the function in it.

https://v.usetapes.com/COVDzfByN0

/max
http://about.me/maxandersen

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-23 12:50                   ` Max Rydahl Andersen
@ 2017-02-23 13:07                     ` Nicolas Goaziou
  2017-02-28 11:31                       ` Max Rydahl Andersen
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2017-02-23 13:07 UTC (permalink / raw)
  To: Max Rydahl Andersen; +Cc: Org-mode

Hello,

"Max Rydahl Andersen" <manderse@redhat.com> writes:

> Here is a screencast of me trying before and after evaluating buffer
> with the function in it.
>
> https://v.usetapes.com/COVDzfByN0

Odd. I definitely see TRT in my case. 

What is the value of `org-shiftmetaleft-hook' ? Could you try in
a minimal environment to check if nothing interferes with the function
(e.g., `org-autolist')? 

If that fails, could you debug `my-shiftmetaleft' and see if it is
called at all?

Regards,

-- 
Nicolas Goaziou

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

* Re: avoiding "First item of list cannot move without its subtree"
  2017-02-23 13:07                     ` Nicolas Goaziou
@ 2017-02-28 11:31                       ` Max Rydahl Andersen
  0 siblings, 0 replies; 15+ messages in thread
From: Max Rydahl Andersen @ 2017-02-28 11:31 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

On 23 Feb 2017, at 14:07, Nicolas Goaziou wrote:

> Hello,
>
> "Max Rydahl Andersen" <manderse@redhat.com> writes:
>
>> Here is a screencast of me trying before and after evaluating buffer
>> with the function in it.
>>
>> https://v.usetapes.com/COVDzfByN0
>
> Odd. I definitely see TRT in my case.
>
> What is the value of `org-shiftmetaleft-hook' ? Could you try in
> a minimal environment to check if nothing interferes with the function
> (e.g., `org-autolist')?
>
> If that fails, could you debug `my-shiftmetaleft' and see if it is
> called at all?

Gah - my brain was wired wrong. I tried to use meta-left, not shift-meta-left.

Now it is working - thanks :)

/max
http://about.me/maxandersen

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

end of thread, other threads:[~2017-02-28 11:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cabe8a30ab4e4a79a7d100b0d07093d6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-02-20 16:32 ` avoiding "First item of list cannot move without its subtree" Eric S Fraga
2017-02-20 21:40   ` Max Rydahl Andersen
2017-02-20 12:58 Max Rydahl Andersen
2017-02-20 16:27 ` Nicolas Goaziou
2017-02-20 21:35   ` Max Rydahl Andersen
2017-02-21  7:42     ` Nicolas Goaziou
2017-02-21 16:07       ` Max Rydahl Andersen
2017-02-21 17:35         ` Nicolas Goaziou
2017-02-22  7:22           ` Max Rydahl Andersen
2017-02-22 11:04             ` Nicolas Goaziou
2017-02-23  7:36               ` Max Rydahl Andersen
2017-02-23 11:41                 ` Nicolas Goaziou
2017-02-23 12:50                   ` Max Rydahl Andersen
2017-02-23 13:07                     ` Nicolas Goaziou
2017-02-28 11:31                       ` Max Rydahl Andersen

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