From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Using orgstruct-mode in programming language files Date: Wed, 20 Aug 2008 18:33:22 +0200 Message-ID: <87od3nfxyl.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 1KVqeU-0002ov-Vb for emacs-orgmode@gnu.org; Wed, 20 Aug 2008 12:35:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KVqeS-0002lv-RS for emacs-orgmode@gnu.org; Wed, 20 Aug 2008 12:35:18 -0400 Received: from [199.232.76.173] (port=37580 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVqeS-0002lW-Hy for emacs-orgmode@gnu.org; Wed, 20 Aug 2008 12:35:16 -0400 Received: from main.gmane.org ([80.91.229.2]:36711 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 1KVqeS-0006dO-6b for emacs-orgmode@gnu.org; Wed, 20 Aug 2008 12:35:16 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KVqeO-0005og-SA for emacs-orgmode@gnu.org; Wed, 20 Aug 2008 16:35:12 +0000 Received: from 141.26.67.4 ([141.26.67.4]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Aug 2008 16:35:12 +0000 Received: from tassilo by 141.26.67.4 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Aug 2008 16:35:12 +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, I'd like to switch from outline-minor-mode to orgstruct-mode for various programming language files. So for example shell scripts (sh-mode) a headline looks like #* Foobar The fontlocking works for such headlines. Now I've found out that org-context-p won't return t for that line, and thus no org-mode command will be executed. So I've redefined org-context-p 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