emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Emulating list functionality from traditional GUI editors
@ 2014-12-11  8:14 Calvin Young
  2014-12-11 19:48 ` Rasmus
  0 siblings, 1 reply; 10+ messages in thread
From: Calvin Young @ 2014-12-11  8:14 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all,

I've been using org-mode for a while now, and it's been life-changing in
terms of how I keep organized. However, there's still one thing I miss from
traditional note-taking apps when working with lists. Specifically, I'd
like to enable the following behavior:

   - If the cursor is at the end of a list item, then "Return" should
   insert a new list item (i.e., automatically perform org-meta-return)
   - If the cursor is at the beginning of an empty list item, then "Return"
   should outdent the list item (or remove it if it's already at the
   outer-most indentation level)
   - If the cursor is at the beginning of an empty list item, then
   "Backspace" should delete the list item and move my cursor to the end of
   the previous list item
   - It'd be nice of these rules could be applied to checkboxes as well

What I'm describing is really just the default behavior around bulleted /
numbered lists in other GUI editors (e.g., Google Docs, Gmail, OSX Notes,
etc.). Are there any options built in to org-mode that'd let me enable this?

Best,
Calvin

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

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

* Emulating list functionality from traditional GUI editors
@ 2014-12-11 17:05 Calvin Young
  2014-12-11 17:34 ` Jorge A. Alfaro-Murillo
  0 siblings, 1 reply; 10+ messages in thread
From: Calvin Young @ 2014-12-11 17:05 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all,

I've been using org-mode for a while now, and it's been life-changing in
terms of how I keep organized. However, there's still one thing I miss from
traditional note-taking apps when working with lists. Specifically, I'd
like to enable the following behavior:

   - If the cursor is at the end of a list item, then "Return" should
   insert a new list item (i.e., automatically perform org-meta-return)
   - If the cursor is at the beginning of an empty list item, then "Return"
   should outdent the list item (or remove it if it's already at the
   outer-most indentation level)
   - If the cursor is at the beginning of an empty list item, then
   "Backspace" should delete the list item and move my cursor to the end of
   the previous list item
   - It'd be nice of these rules could be applied to checkboxes as well

What I'm describing is really just the default behavior around bulleted /
numbered lists in other GUI editors (e.g., Google Docs, Gmail, OSX Notes,
etc.). Are there options built in to org-mode that'd let me enable this?

Best,
Calvin

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

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

* Re: Emulating list functionality from traditional GUI editors
  2014-12-11 17:05 Calvin Young
@ 2014-12-11 17:34 ` Jorge A. Alfaro-Murillo
  2014-12-11 17:41   ` Jorge A. Alfaro-Murillo
  2014-12-11 18:19   ` Calvin Young
  0 siblings, 2 replies; 10+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-12-11 17:34 UTC (permalink / raw)
  To: emacs-orgmode

Calvin Young writes:

> * If the cursor is at the end of a list item, then "Return" 
> should 
>   insert a new list item (i.e., automatically perform 
>   org-meta-return)

M-<enter> does this. You do not want <enter> to do that because 
you when you want to finish the list <enter> finishes it.
 
> * If the cursor is at the beginning of an empty list item, then 
>   "Return" should outdent the list item (or remove it if it's 
>   already at the outer-most indentation level)

I am not sure that I understand this but I assume that you would 
obtain the same with <tab>. It goes back and forth between levels 
of list so if you have
 
- one
- two
  + a
  + CURSOR_HERE

and you hit <tab> then it changes to 

- one
- two
  + a
    + CURSOR_HERE

and then two times <tab> (or S-<tab> from the beginning) changes 
it to

- one
- two
  + a
- CURSOR_HERE


> * If the cursor is at the beginning of an empty list item, then 
>   "Backspace" should delete the list item and move my cursor to 
>   the end of the previous list item 

I guess you could remap <backspace> to a function that checks if 
you are at the beginning of the list and when that is true it does 
what you want, otherwise it just calls `delete-backward-char'. But 
generally I would do C-a C-k <backspace>, just two more 
keystrokes.
 
> * It'd be nice of these rules could be applied to checkboxes as 
> well

M-S-<enter> inserts a check box.

Best,

-- 
Jorge.

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

* Re: Emulating list functionality from traditional GUI editors
  2014-12-11 17:34 ` Jorge A. Alfaro-Murillo
@ 2014-12-11 17:41   ` Jorge A. Alfaro-Murillo
  2014-12-11 18:19   ` Calvin Young
  1 sibling, 0 replies; 10+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-12-11 17:41 UTC (permalink / raw)
  To: emacs-orgmode

Jorge A. Alfaro-Murillo writes:

> Calvin Young writes: 

>> * It'd be nice of these rules could be applied to checkboxes as 
>> well 
> 
> M-S-<enter> inserts a check box. 

I forgot to mention that the <tab> S-<tab> behavior also works 
with check boxes.

-- 
Jorge.

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

* Re: Emulating list functionality from traditional GUI editors
  2014-12-11 17:34 ` Jorge A. Alfaro-Murillo
  2014-12-11 17:41   ` Jorge A. Alfaro-Murillo
@ 2014-12-11 18:19   ` Calvin Young
  2014-12-11 18:44     ` Jorge A. Alfaro-Murillo
  1 sibling, 1 reply; 10+ messages in thread
From: Calvin Young @ 2014-12-11 18:19 UTC (permalink / raw)
  To: Jorge A. Alfaro-Murillo; +Cc: emacs-orgmode

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

Jorge, thanks for the quick response!


>  * If the cursor is at the end of a list item, then "Return" should
>>  insert a new list item (i.e., automatically perform   org-meta-return)
>>
>
> M-<enter> does this. You do not want <enter> to do that because you when
> you want to finish the list <enter> finishes it.
>

I don't think I explained myself clearly the first time around. The
behavior I'm hoping to achieve (i.e., the default bulletting behavior in
Google Docs, OSX Notes, etc.) is as follows:

;; Starting with this setup:

- one
- two
 + a[CURSOR_HERE]

;; Hitting <enter> should produce:

- one
- two
 + a
 + [CURSOR_HERE]

;; Hitting <enter> again would then produce:

- one
- two
 + a
- [CURSOR_HERE]

;; And hitting <enter> one last time would produce:

- one
- two
 + a

[CURSOR_HERE]

I know we can already achieve this with some combination of M-<enter>,
<enter>, and M-S-<enter>, but this behavior has 2 distinct advantages:

1. The user only needs to remember one key to cycle between all of these
actions, rather than 3 key combinations.
2. This behavior is more consistent with the bulleting behavior in other
editors, which could make it feel more intuitive for new org-mode users.


>  * If the cursor is at the beginning of an empty list item, then
>>  "Return" should outdent the list item (or remove it if it's   already at
>> the outer-most indentation level)
>>
>
> I am not sure that I understand this but I assume that you would obtain
> the same with <tab>. It goes back and forth between levels of list so if
> you have
>
> - one
> - two
>  + a
>  + CURSOR_HERE
>
> and you hit <tab> then it changes to
> - one
> - two
>  + a
>    + CURSOR_HERE
>
> and then two times <tab> (or S-<tab> from the beginning) changes it to
>
> - one
> - two
>  + a
> - CURSOR_HERE
>

Yes, but for the reasons mentioned above, it'd be nice if we could use the
<enter> to outdent a new list entry as well.


>  * If the cursor is at the beginning of an empty list item, then
>>  "Backspace" should delete the list item and move my cursor to   the end of
>> the previous list item
>>
>
> I guess you could remap <backspace> to a function that checks if you are
> at the beginning of the list and when that is true it does what you want,
> otherwise it just calls `delete-backward-char'. But generally I would do
> C-a C-k <backspace>, just two more keystrokes.
>

Makes sense. This is an easy function to write -- just wanted to make sure
there wasn't something that already does this out-of-the-box.


>  * It'd be nice of these rules could be applied to checkboxes as well
>>
>
> M-S-<enter> inserts a check box.


In general, I *believe* a lot of folks use lists and checkboxs in similar
ways. I certainly do, and I frequently accidentally hit M-<enter> while
editing a checkbox when I really intend to insert a new checkbox entry. As
a result, it seems desirable to create an interface that treats them more
similarly (e.g., using a single <enter> keypress to auto-insert a new
entry).

If this doesn't exist yet, I'd be happy to roll it myself. But it'd be nice
to avoid re-inventing the wheel here if possible :)

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

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

* Re: Emulating list functionality from traditional GUI editors
  2014-12-11 18:19   ` Calvin Young
@ 2014-12-11 18:44     ` Jorge A. Alfaro-Murillo
  0 siblings, 0 replies; 10+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-12-11 18:44 UTC (permalink / raw)
  To: emacs-orgmode

Calvin Young writes:

> ;; Starting with this setup: 
> 
> - one - two + a[CURSOR_HERE] 
> 
> ;; Hitting <enter> should produce: 
> 
> - one - two + a + [CURSOR_HERE] 
> 
> ;; Hitting <enter> again would then produce: 
> 
> - one - two + a - [CURSOR_HERE] 
> 
> ;; And hitting <enter> one last time would produce: 
> 
> - one - two + a 
> 
> [CURSOR_HERE] 

I think there is a confusion here, my understanding is that org 
separates sublists by indentation so if you have:

- a
+ b[CURSOR]

and hit M-<enter> it should correct to:

- a
- b
- [CURSOR]

It is different if you have:

- a
  + b[CURSOR]

or

- a
  - b[CURSOR]

or 

1. a
   - b[CURSOR]
2. c

etc

> I know we can already achieve this with some combination of 
> M-<enter>, <enter>, and M-S-<enter>, but this behavior has 2 
> distinct advantages: 
> 
> 1. The user only needs to remember one key to cycle between all 
> of these actions, rather than 3 key combinations.

But the problem is that you lose the functionality of <enter> to 
exit the list. I want to have <enter> to finish a line and <enter> 
<enter> to finish a paragraph like I am used everywhere else.
 
> 2. This behavior is more consistent with the bulleting behavior 
> in other editors

We shouldn't aim to imitate other much inferior editors ;-)

> , which could make it feel more intuitive for new org-mode 
> users.  [...]
> Yes, but for the reasons mentioned above, it'd be nice if we 
> could use the <enter> to outdent a new list entry as well. 

I disagree, <tab> and S-<tab> for indenting is much more friendly 
than <enter>, most modes in emacs behave like that. A new user 
just has to understand that sublists are separated by indentation, 
and learn that M-<enter> is for lists, and M-S-<enter> is for 
check boxes.

> Jorge A. Alfaro-Murillo says:
>> I guess you could remap <backspace> to a function that checks 
>> if you are at the beginning of the list and when that is true 
>> it does what you want, otherwise it just calls 
>> `delete-backward-char'. But generally I would do C-a C-k 
>> <backspace>, just two more keystrokes.
> Makes sense. This is an easy function to write — just wanted to 
> make sure there wasn't something that already does this 
> out-of-the-box.

It should save around half a second per use, so if you use it five 
times a day you have about 1 hour to write it... minus the time it 
takes you to read this: http://xkcd.com/1205/ =)

> In general, I *believe* a lot of folks use lists and checkboxs 
> in similar ways. I certainly do, and I frequently accidentally 
> hit M-<enter> while editing a checkbox when I really intend to 
> insert a new checkbox entry. As a result, it seems desirable to 
> create an interface that treats them more similarly (e.g., using 
> a single <enter> keypress to auto-insert a new entry).
> 
> If this doesn't exist yet, I'd be happy to roll it myself. But 
> it'd be nice to avoid re-inventing the wheel here if possible :) 

Maybe, but you would lose the ability to have mixed check boxes 
and items lists. But you are right, it might be a nice 
configuration to allow M-<enter> to give you another item with 
check box if you are already in one (and then M-S-<enter> gives 
you a plain list item). But it might be even more confusing for a 
new user as to why the behavior is not consistent with M-<enter>, 
so probably it shouldn't be default.

Best,

-- 
Jorge.

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

* Re: Emulating list functionality from traditional GUI editors
  2014-12-11  8:14 Emulating list functionality from traditional GUI editors Calvin Young
@ 2014-12-11 19:48 ` Rasmus
  2014-12-12  4:48   ` Calvin Young
  0 siblings, 1 reply; 10+ messages in thread
From: Rasmus @ 2014-12-11 19:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Calvin Young <calvinwyoung@gmail.com> writes:

>    - If the cursor is at the end of a list item, then "Return" should
>    insert a new list item (i.e., automatically perform org-meta-return)

Maybe you can use org-element-at-point and advice org-return? 

>    - If the cursor is at the beginning of an empty list item, then "Return"
>    should outdent the list item (or remove it if it's already at the
>    outer-most indentation level)

I don't understand this.  Do you know M-{left,right}?  Again, you could
advice org-return.

In LO it removes the bullet.  Here you can use C-S-Backspace.  Bonus: it
works everywhere! 

>    - If the cursor is at the beginning of an empty list item, then
>    "Backspace" should delete the list item and move my cursor to the end of
>    the previous list item

This is like C-S-Backspace C-p C-e.  You could advice org-delete-backward.

>    - It'd be nice of these rules could be applied to checkboxes as well

It should be trivial to support using org-element-at-point.

> What I'm describing is really just the default behavior around bulleted /
> numbered lists in other GUI editors (e.g., Google Docs, Gmail, OSX Notes,
> etc.).

OK...

> Are there any options built in to org-mode that'd let me enable this?

No.  And I doubt it should be.  But Emacs is /your/ extensible editor.

—Rasmus

-- 
Need more coffee. . .

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

* Re: Emulating list functionality from traditional GUI editors
  2014-12-11 19:48 ` Rasmus
@ 2014-12-12  4:48   ` Calvin Young
  2014-12-12  8:37     ` Sebastien Vauban
  0 siblings, 1 reply; 10+ messages in thread
From: Calvin Young @ 2014-12-12  4:48 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

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

Makes sense! Just wanted to see how others felt about this :)

Anyway thanks for the consideration, and for the tip
about org-element-at-point -- really did make this trivial to implement.


On Thu, Dec 11, 2014 at 11:48 AM, Rasmus <rasmus@gmx.us> wrote:

> Hi,
>
> Calvin Young <calvinwyoung@gmail.com> writes:
>
> >    - If the cursor is at the end of a list item, then "Return" should
> >    insert a new list item (i.e., automatically perform org-meta-return)
>
> Maybe you can use org-element-at-point and advice org-return?
>
> >    - If the cursor is at the beginning of an empty list item, then
> "Return"
> >    should outdent the list item (or remove it if it's already at the
> >    outer-most indentation level)
>
> I don't understand this.  Do you know M-{left,right}?  Again, you could
> advice org-return.
>
> In LO it removes the bullet.  Here you can use C-S-Backspace.  Bonus: it
> works everywhere!
>
> >    - If the cursor is at the beginning of an empty list item, then
> >    "Backspace" should delete the list item and move my cursor to the end
> of
> >    the previous list item
>
> This is like C-S-Backspace C-p C-e.  You could advice org-delete-backward.
>
> >    - It'd be nice of these rules could be applied to checkboxes as well
>
> It should be trivial to support using org-element-at-point.
>
> > What I'm describing is really just the default behavior around bulleted /
> > numbered lists in other GUI editors (e.g., Google Docs, Gmail, OSX Notes,
> > etc.).
>
> OK...
>
> > Are there any options built in to org-mode that'd let me enable this?
>
> No.  And I doubt it should be.  But Emacs is /your/ extensible editor.
>
> --Rasmus
>
> --
> Need more coffee. . .
>
>
>

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

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

* Re: Emulating list functionality from traditional GUI editors
  2014-12-12  4:48   ` Calvin Young
@ 2014-12-12  8:37     ` Sebastien Vauban
  2014-12-13  9:47       ` Calvin Young
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastien Vauban @ 2014-12-12  8:37 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Calvin Young wrote:
> Makes sense! Just wanted to see how others felt about this :)
>
> Anyway thanks for the consideration, and for the tip
> about org-element-at-point -- really did make this trivial to implement.

Once your customizations are done, it would be nice if you'd publish
them on Worg, for future Org'ers who share your editing habits.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Emulating list functionality from traditional GUI editors
  2014-12-12  8:37     ` Sebastien Vauban
@ 2014-12-13  9:47       ` Calvin Young
  0 siblings, 0 replies; 10+ messages in thread
From: Calvin Young @ 2014-12-13  9:47 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

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

No problem, I've gone ahead and packaged my changes here:
https://github.com/calvinwyoung/org-autolist
I'll also submit this to melpa to make it easier to install.

I'd love hear how other Org'ers on this list feel about it. If folks find
it useful, I'd be happy to publish it on Worg as well.

Best,
Calvin

On Fri, Dec 12, 2014 at 12:37 AM, Sebastien Vauban <sva-news@mygooglest.com>
wrote:
>
> Calvin Young wrote:
> > Makes sense! Just wanted to see how others felt about this :)
> >
> > Anyway thanks for the consideration, and for the tip
> > about org-element-at-point -- really did make this trivial to implement.
>
> Once your customizations are done, it would be nice if you'd publish
> them on Worg, for future Org'ers who share your editing habits.
>
> Best regards,
>   Seb
>
> --
> Sebastien Vauban
>
>
>

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

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

end of thread, other threads:[~2014-12-13  9:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-11  8:14 Emulating list functionality from traditional GUI editors Calvin Young
2014-12-11 19:48 ` Rasmus
2014-12-12  4:48   ` Calvin Young
2014-12-12  8:37     ` Sebastien Vauban
2014-12-13  9:47       ` Calvin Young
  -- strict thread matches above, loose matches on Subject: below --
2014-12-11 17:05 Calvin Young
2014-12-11 17:34 ` Jorge A. Alfaro-Murillo
2014-12-11 17:41   ` Jorge A. Alfaro-Murillo
2014-12-11 18:19   ` Calvin Young
2014-12-11 18:44     ` Jorge A. Alfaro-Murillo

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