[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Using orgstruct-mode to structure source code
From: |
Tassilo Horn |
Subject: |
Re: [Orgmode] Using orgstruct-mode to structure source code |
Date: |
Fri, 05 Sep 2008 10:02:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Carsten Dominik <address@hidden> 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?
All the best,
Tassilo