From mboxrd@z Thu Jan 1 00:00:00 1970 From: levin Subject: Let tab do org-cycle only at special place. Date: Tue, 22 May 2007 14:12:17 +0800 Message-ID: <200705221412.17179.zslevin@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HqNck-0004n6-37 for emacs-orgmode@gnu.org; Tue, 22 May 2007 02:13:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HqNch-0004mD-Qx for emacs-orgmode@gnu.org; Tue, 22 May 2007 02:13:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HqNch-0004m5-L9 for emacs-orgmode@gnu.org; Tue, 22 May 2007 02:13:31 -0400 Received: from py-out-1112.google.com ([64.233.166.178]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HqNch-0004tC-Ep for emacs-orgmode@gnu.org; Tue, 22 May 2007 02:13:31 -0400 Received: by py-out-1112.google.com with SMTP id u52so308614pyb for ; Mon, 21 May 2007 23:13:30 -0700 (PDT) Content-Disposition: inline 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: 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