emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: John Wiegley <jwiegley@gmail.com>
Cc: Org-mode Mode <emacs-orgmode@gnu.org>
Subject: Re: Making TAB a touch more magical
Date: Sat, 17 Oct 2009 08:55:53 +0200	[thread overview]
Message-ID: <53E70D7A-DCAC-4CFB-8CD1-5D43A73B8C08@gmail.com> (raw)
In-Reply-To: <F423AE52-4791-478E-AE96-5B80B088FF30@gmail.com>


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

  reply	other threads:[~2009-10-17  6:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-17  0:59 Making TAB a touch more magical John Wiegley
2009-10-17  6:55 ` Carsten Dominik [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53E70D7A-DCAC-4CFB-8CD1-5D43A73B8C08@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jwiegley@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).