From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Using orgstruct-mode to structure source code Date: Wed, 3 Sep 2008 11:36:59 +0200 Message-ID: References: <87od35fx3a.fsf@thinkpad.tsdh.de> Mime-Version: 1.0 (Apple Message framework v926) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KaonY-0005e8-G5 for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 05:37:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KaonX-0005c3-BC for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 05:37:11 -0400 Received: from [199.232.76.173] (port=56502 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KaonW-0005bl-Ff for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 05:37:10 -0400 Received: from ug-out-1314.google.com ([66.249.92.171]:49629) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KaonW-0005gQ-F3 for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 05:37:10 -0400 Received: by ug-out-1314.google.com with SMTP id m2so2428766uge.17 for ; Wed, 03 Sep 2008 02:37:09 -0700 (PDT) In-Reply-To: <87od35fx3a.fsf@thinkpad.tsdh.de> 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: Tassilo Horn Cc: emacs-orgmode@gnu.org Hi Tassilo, "?..." is not a correct regular expression in Emacs. You are using wildcard synax, it seems. If you want to allow extra characters # and ; at the begin of the line, try something like "[;#]*..." I am not sure if this will work, in particular if it will make structure editing work. Give it a try and send us a report, ok? - Carsten On Sep 3, 2008, at 10:32 AM, Tassilo Horn wrote: > 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 > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode