emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Let tab do org-cycle only at special place.
@ 2007-05-23  9:56 Levin Du
  2007-05-23 14:20 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Levin Du @ 2007-05-23  9:56 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Let tab do org-cycle only at special place.
@ 2007-05-22  6:12 levin
  0 siblings, 0 replies; 3+ messages in thread
From: levin @ 2007-05-22  6:12 UTC (permalink / raw)
  To: emacs-orgmode

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

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

end of thread, other threads:[~2007-05-23 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-23  9:56 Let tab do org-cycle only at special place Levin Du
2007-05-23 14:20 ` Carsten Dominik
  -- strict thread matches above, loose matches on Subject: below --
2007-05-22  6:12 levin

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).