emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Making TAB a touch more magical
@ 2009-10-17  0:59 John Wiegley
  2009-10-17  6:55 ` Carsten Dominik
  2009-11-02 13:18 ` Carsten Dominik
  0 siblings, 2 replies; 6+ messages in thread
From: John Wiegley @ 2009-10-17  0:59 UTC (permalink / raw)
  To: Org-mode Mode

In most "power" outliners on the Mac, pressing TAB indents the outline  
level of the current item.  This lets you add subnotes very quickly by  
typing M-RET TAB.  (I find M-S-<right> way too cumbersome to use while  
typing).

Since pressing TAB on a new entry (one with no body) doesn't do  
anything right now, I think TAB in that case should do what M-S- 
<right> does.  This little snippet achieves that:

(defun org-indent-empty-items (arg)
   (when (eq arg 'empty)
     (goto-char (line-end-position))
     (cond
      ((org-at-item-p) (org-indent-item 1))
      ((org-on-heading-p) (org-demote-subtree)))))

(add-hook 'org-pre-cycle-hook 'org-indent-empty-items)

This also works for regular lists.

John

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

* Re: Making TAB a touch more magical
  2009-10-17  0:59 Making TAB a touch more magical John Wiegley
@ 2009-10-17  6:55 ` Carsten Dominik
  2009-11-02 13:18 ` Carsten Dominik
  1 sibling, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2009-10-17  6:55 UTC (permalink / raw)
  To: John Wiegley; +Cc: Org-mode Mode


On Oct 17, 2009, at 2:59 AM, John Wiegley wrote:

> In most "power" outliners on the Mac, pressing TAB indents the  
> outline level of the current item.  This lets you add subnotes very  
> quickly by typing M-RET TAB.  (I find M-S-<right> way too cumbersome  
> to use while typing).
>
> Since pressing TAB on a new entry (one with no body) doesn't do  
> anything right now, I think TAB in that case should do what M-S- 
> <right> does.  This little snippet achieves that:
>
> (defun org-indent-empty-items (arg)
>  (when (eq arg 'empty)
>    (goto-char (line-end-position))
>    (cond
>     ((org-at-item-p) (org-indent-item 1))
>     ((org-on-heading-p) (org-demote-subtree)))))
>
> (add-hook 'org-pre-cycle-hook 'org-indent-empty-items)

If going this crazy, how about (extension for plain list still missing)

(defun org-indent-empty-items (arg)
  (when (eq arg 'empty)
    (goto-char (line-end-position))
    (cond
     ((org-at-item-p) (org-indent-item 1))
     ((org-on-heading-p)
      (if (equal this-command last-command)
	 (condition-case nil
	     (org-promote-subtree)
	   (error
	    (save-excursion
	      (goto-char (point-at-bol))
	      (and (looking-at "\\*+") (replace-match ""))
	      (org-insert-heading)
	      (org-demote-subtree))))
        (org-demote-subtree))))))

(add-hook 'org-pre-cycle-hook 'org-indent-empty-items)




- carsten




>
> This also works for regular lists.
>
> John
>
>
> _______________________________________________
> 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

- Carsten

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

* Re: Making TAB a touch more magical
  2009-10-17  0:59 Making TAB a touch more magical John Wiegley
  2009-10-17  6:55 ` Carsten Dominik
@ 2009-11-02 13:18 ` Carsten Dominik
  2009-11-02 19:56   ` Samuel Wales
  2009-11-03  9:39   ` Carsten Dominik
  1 sibling, 2 replies; 6+ messages in thread
From: Carsten Dominik @ 2009-11-02 13:18 UTC (permalink / raw)
  To: John Wiegley; +Cc: Org-mode Mode


On Oct 17, 2009, at 2:59 AM, John Wiegley wrote:

> In most "power" outliners on the Mac, pressing TAB indents the  
> outline level of the current item.  This lets you add subnotes very  
> quickly by typing M-RET TAB.  (I find M-S-<right> way too cumbersome  
> to use while typing).
>
> Since pressing TAB on a new entry (one with no body) doesn't do  
> anything right now, I think TAB in that case should do what M-S- 
> <right> does.  This little snippet achieves that:
>
> (defun org-indent-empty-items (arg)
>  (when (eq arg 'empty)
>    (goto-char (line-end-position))
>    (cond
>     ((org-at-item-p) (org-indent-item 1))
>     ((org-on-heading-p) (org-demote-subtree)))))
>
> (add-hook 'org-pre-cycle-hook 'org-indent-empty-items)

Hi John,

this is not a bad idea, but it is a bit unstable because
the definition of empty entry is a bit unstable, it
depends on empty lines and how they are treated.

An alternative would be to activate this special feature only  
immediately
after starting a new entry, either by looking at last-command, or,  
maybe better,
by doing this in entries which only have the stars and maybe a TODO  
keyword, but
but no text yet.

Then, TAB could even walk you through a number of indentations, like  
child,
and then parent, grandparent,..., all the way to top level, and then  
back
to the initial level.

- Carsten

>
> This also works for regular lists.
>
> John
>
>
> _______________________________________________
> 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

- Carsten

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

* Re: Making TAB a touch more magical
  2009-11-02 13:18 ` Carsten Dominik
@ 2009-11-02 19:56   ` Samuel Wales
  2009-11-03  5:29     ` Carsten Dominik
  2009-11-03  9:39   ` Carsten Dominik
  1 sibling, 1 reply; 6+ messages in thread
From: Samuel Wales @ 2009-11-02 19:56 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org-mode Mode

On 2009-11-02, Carsten Dominik <carsten.dominik@gmail.com> wrote:
> Then, TAB could even walk you through a number of indentations, like
> child,
> and then parent, grandparent,..., all the way to top level, and then
> back
> to the initial level.

I proposed something similar recently, with some detail.  Will search
for it if you don't remember it.

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

* Re: Making TAB a touch more magical
  2009-11-02 19:56   ` Samuel Wales
@ 2009-11-03  5:29     ` Carsten Dominik
  0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2009-11-03  5:29 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Org-mode Mode

I do remember it, it is wating in my queue, and my reply to John was  
inspired by it.

- Carsten

On Nov 2, 2009, at 8:56 PM, Samuel Wales wrote:

> On 2009-11-02, Carsten Dominik <carsten.dominik@gmail.com> wrote:
>> Then, TAB could even walk you through a number of indentations, like
>> child,
>> and then parent, grandparent,..., all the way to top level, and then
>> back
>> to the initial level.
>
> I proposed something similar recently, with some detail.  Will search
> for it if you don't remember it.

- Carsten

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

* Re: Making TAB a touch more magical
  2009-11-02 13:18 ` Carsten Dominik
  2009-11-02 19:56   ` Samuel Wales
@ 2009-11-03  9:39   ` Carsten Dominik
  1 sibling, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2009-11-03  9:39 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org-mode Mode


On Nov 2, 2009, at 2:18 PM, Carsten Dominik wrote:

>
> On Oct 17, 2009, at 2:59 AM, John Wiegley wrote:
>
>> In most "power" outliners on the Mac, pressing TAB indents the  
>> outline level of the current item.  This lets you add subnotes very  
>> quickly by typing M-RET TAB.  (I find M-S-<right> way too  
>> cumbersome to use while typing).
>>
>> Since pressing TAB on a new entry (one with no body) doesn't do  
>> anything right now, I think TAB in that case should do what M-S- 
>> <right> does.  This little snippet achieves that:
>>
>> (defun org-indent-empty-items (arg)
>> (when (eq arg 'empty)
>>   (goto-char (line-end-position))
>>   (cond
>>    ((org-at-item-p) (org-indent-item 1))
>>    ((org-on-heading-p) (org-demote-subtree)))))
>>
>> (add-hook 'org-pre-cycle-hook 'org-indent-empty-items)
>
> Hi John,
>
> this is not a bad idea, but it is a bit unstable because
> the definition of empty entry is a bit unstable, it
> depends on empty lines and how they are treated.
>
> An alternative would be to activate this special feature only  
> immediately
> after starting a new entry, either by looking at last-command, or,  
> maybe better,
> by doing this in entries which only have the stars and maybe a TODO  
> keyword, but
> but no text yet.
>
> Then, TAB could even walk you through a number of indentations, like  
> child,
> and then parent, grandparent,..., all the way to top level, and then  
> back
> to the initial level.

This actually does work now, both in empty headlines, and in empty  
plain list items.
I find it *very* convenient.

>
> - Carsten
>
>>
>> This also works for regular lists.
>>
>> John
>>
>>
>> _______________________________________________
>> 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
>
> - Carsten
>
>
>

- Carsten

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

end of thread, other threads:[~2009-11-03  9:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-17  0:59 Making TAB a touch more magical John Wiegley
2009-10-17  6:55 ` Carsten Dominik
2009-11-02 13:18 ` Carsten Dominik
2009-11-02 19:56   ` Samuel Wales
2009-11-03  5:29     ` Carsten Dominik
2009-11-03  9:39   ` 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).