From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Making TAB a touch more magical Date: Sat, 17 Oct 2009 08:55:53 +0200 Message-ID: <53E70D7A-DCAC-4CFB-8CD1-5D43A73B8C08@gmail.com> References: Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mz3Cs-0003dG-Rq for emacs-orgmode@gnu.org; Sat, 17 Oct 2009 02:56:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mz3Cn-0003XC-QM for emacs-orgmode@gnu.org; Sat, 17 Oct 2009 02:56:02 -0400 Received: from [199.232.76.173] (port=33891 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mz3Cn-0003X9-NH for emacs-orgmode@gnu.org; Sat, 17 Oct 2009 02:55:57 -0400 Received: from mail-ew0-f228.google.com ([209.85.219.228]:50676) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mz3Cn-0001p8-6K for emacs-orgmode@gnu.org; Sat, 17 Oct 2009 02:55:57 -0400 Received: by ewy28 with SMTP id 28so2767235ewy.42 for ; Fri, 16 Oct 2009 23:55:56 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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- 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- > 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