From mboxrd@z Thu Jan 1 00:00:00 1970 From: Levin Du Subject: Let tab do org-cycle only at special place. Date: Wed, 23 May 2007 17:56:52 +0800 Message-ID: <200705231756.53173.zsdjw@21cn.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HqncI-00038P-9N for emacs-orgmode@gnu.org; Wed, 23 May 2007 05:58:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hqnc5-00036B-Hj for emacs-orgmode@gnu.org; Wed, 23 May 2007 05:58:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hqnc5-000367-Cy for emacs-orgmode@gnu.org; Wed, 23 May 2007 05:58:37 -0400 Received: from [59.36.102.62] (helo=21cn.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hqnc3-0001Tz-1W for emacs-orgmode@gnu.org; Wed, 23 May 2007 05:58:36 -0400 Received: from 21cn.com (dgproxy1.inner-hermes.com [10.27.2.1]) by 21cn.com (HERMES) with ESMTP id 2FBA838085 for ; Wed, 23 May 2007 18:04:22 +0800 (CST) Received: from aisp1-smtp (unknown [202.105.45.9]) by 21cn.com (HERMES) with ESMTP for ; Wed, 23 May 2007 18:04:23 +0800 (CST) Received: from levcom([61.234.125.31]) by aisp1-smtp(Knowledge-based Antispam Gateway 2.125d2) with ESMTP id local2983.1179913325 for ; Wed May 23 17:42:05 2007 +0800 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