emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Let tab do org-cycle only at special place.


From: Carsten Dominik
Subject: Re: [Orgmode] Let tab do org-cycle only at special place.
Date: Wed, 23 May 2007 16:20:09 +0200

Yes, this is a good idea.

The org-mode implementation will use the variable org-cycle-emulate-tab, in the next version there will be an additional value for this option to get the bahavior you propose.

Thanks!

- Carsten

On May 23, 2007, at 11:56, Levin Du wrote:

I've my busy tab key set to a super expand/indent function:

   (global-set-key "\t" 'ext-super-tab)

Currently in org-mode, tab is only doing indent in none headline/special place. I'd like to use tab only at the beginning of headline or buffer. So I
put something like this in my org-conf.el :

(defun org-tab (&optional arg)
  "Do org-cycle only at the beginning of a headline, otherwise do
the job defined in global keymap."
  (interactive "P")
  (let* ((outline-regexp
          (if (and (org-mode-p) org-cycle-include-plain-lists)
              "\\(?:\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) \\)"
            outline-regexp))
         (bob-special (and org-cycle-global-at-bob (bobp)
                           (not (looking-at outline-regexp)))))
    (if (or bob-special
            (eq arg t)
            (integerp arg)
            (org-at-table-p 'any)
            (looking-at outline-regexp))
        (org-cycle arg)
      (call-interactively (global-key-binding "\t")))))

(define-key org-mode-map [(tab)] 'org-tab)

Hope this is useful for someone else.

Levin


_______________________________________________
Emacs-orgmode mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode



--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477





reply via email to

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