emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Making TAB a touch more magical


From: Carsten Dominik
Subject: Re: [Orgmode] Making TAB a touch more magical
Date: Sat, 17 Oct 2009 08:55:53 +0200


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.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten







reply via email to

[Prev in Thread] Current Thread [Next in Thread]