From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Using orgstruct-mode to structure source code Date: Fri, 5 Sep 2008 11:07:30 +0200 Message-ID: <60038CBF-4EEE-483E-8F72-3192F51D2CDB@uva.nl> References: <87od35fx3a.fsf@thinkpad.tsdh.de> <87k5dtfs3z.fsf@thinkpad.tsdh.de> <0E11839C-C0CE-41E8-A937-2CBCCB163BB1@uva.nl> <87ej3zrpeu.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 1KbXI3-0006fp-Hl for emacs-orgmode@gnu.org; Fri, 05 Sep 2008 05:07:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KbXI2-0006fC-Ib for emacs-orgmode@gnu.org; Fri, 05 Sep 2008 05:07:38 -0400 Received: from [199.232.76.173] (port=36247 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KbXI2-0006f4-8t for emacs-orgmode@gnu.org; Fri, 05 Sep 2008 05:07:38 -0400 Received: from ug-out-1314.google.com ([66.249.92.175]:26323) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KbXI0-0001da-GK for emacs-orgmode@gnu.org; Fri, 05 Sep 2008 05:07:37 -0400 Received: by ug-out-1314.google.com with SMTP id a2so37595ugf.17 for ; Fri, 05 Sep 2008 02:07:34 -0700 (PDT) In-Reply-To: <87ej3zrpeu.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 On Sep 5, 2008, at 10:02 AM, Tassilo Horn wrote: > Carsten Dominik writes: > > Hi Carsten, > >> I though a little bit about this, and using org-struct-mode in a >> commented block of text is going to be bumpy. No easy path. > > Too bad. I thought that it would be easy (at least for headlines) by > simply allowing `comment-start' before the headline. > >> What I do in such cases: >> >> I put tow markers into the buffer hat delimit the text I want to edit >> in orgstruct-mode. And then I have custom function that toggles the >> comment starters on an off, like so: >> >> ;; BEGIN ORGSTRUCT ";; " >> ;; * heading 1 >> ;; with text >> ;; * heading 2 >> ;; ** subheading >> ;; END ORGSTRUCT > > The problem with this is, that "with text" will be commented, too. > But > in my case this would be source code, which should not be commented. > > So now I think I'll stay with outline-minor-mode. The thing which is > much better with orgstruct-mode is that TAB has a special meaning > depending on the context point is on. So I'll use that feature to > make > outline-minor-mode do what I want. IMO this facility could be of > use in > may other places, too. I think it would be nice to rip that out of > org-mode into something more generic, like > > (define-context-key some-keymap (kbd "TAB") > 'foobar-context-p > 'do-foo). > > I played a bit with the code and tried to elicit how you get the > command > that normally would have been invoked if the stealing function wasn't > there, but I failed. Could you please enlighten me? I am explaining this in detail near the end of the google tech talk, with a code example. Basically, it works by temporarily turning of the minor mode that defines the command and doing a key lookup. - Carsten > > > All the best, > Tassilo