From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Using orgstruct-mode to structure source code Date: Wed, 03 Sep 2008 10:32:57 +0200 Message-ID: <87od35fx3a.fsf@thinkpad.tsdh.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kanpa-0005Ai-07 for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 04:35:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KanpX-00059g-UP for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 04:35:13 -0400 Received: from [199.232.76.173] (port=59035 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KanpX-00059d-QX for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 04:35:11 -0400 Received: from main.gmane.org ([80.91.229.2]:49591 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KanpX-0000Vu-JR for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 04:35:11 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KanpO-0006al-1K for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 08:35:02 +0000 Received: from dhcp188.uni-koblenz.de ([141.26.71.188]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Sep 2008 08:35:02 +0000 Received: from tassilo by dhcp188.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Sep 2008 08:35:02 +0000 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@gnu.org Hi, this is a resend of my message from <2008-08-20 Wed>. So far nobody answered and since Carsten is back now, I thought I may try again. I'd like to switch from outline-minor-mode to orgstruct-mode for various source code files, because the outline keybindings are not really quick nor easy to remember. For example in shell scripts (sh-mode) a headline looks like #* Foobar and in an elisp file it would be ;;* Foobar Now I've found out that `org-context-p' returns nil for these lines, and thus no org-mode command will be executed. So I've redefined it to this version: --8<---------------cut here---------------start------------->8--- (defun org-context-p (&rest contexts) "Check if local context is and of CONTEXTS. Possible values in the list of contexts are `table', `headline', and `item'." (let ((pos (point)) (comment-starter (replace-regexp-in-string "[ ]+$" "" (or comment-start "")))) (goto-char (point-at-bol)) (prog1 (or (and (memq 'table contexts) (looking-at (concat comment-starter "?[ \t]*|"))) (and (memq 'headline contexts) (looking-at (concat comment-starter "?\\*+"))) (and (memq 'item contexts) (looking-at (concat comment-starter "?[ \t]*\\([-+*] \\|[0-9]+[.)] \\)")))) (goto-char pos)))) --8<---------------cut here---------------end--------------->8--- Now it does return t for headlines like above, but still no org-mode command is issued. What do I have to do to get that working correctly? Bye, Tassilo