emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Using orgstruct-mode to structure source code
Date: Fri, 5 Sep 2008 11:07:30 +0200	[thread overview]
Message-ID: <60038CBF-4EEE-483E-8F72-3192F51D2CDB@uva.nl> (raw)
In-Reply-To: <87ej3zrpeu.fsf@thinkpad.tsdh.de>


On Sep 5, 2008, at 10:02 AM, Tassilo Horn wrote:

> Carsten Dominik <dominik@science.uva.nl> 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

  reply	other threads:[~2008-09-05  9:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-03  8:32 Using orgstruct-mode to structure source code Tassilo Horn
2008-09-03  9:36 ` Carsten Dominik
2008-09-03 10:20   ` Tassilo Horn
2008-09-03 14:39     ` Eric Schulte
2008-09-03 15:39       ` Tassilo Horn
2008-09-05  7:15     ` Carsten Dominik
2008-09-05  8:02       ` Tassilo Horn
2008-09-05  9:07         ` Carsten Dominik [this message]
2008-09-05  9:41           ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60038CBF-4EEE-483E-8F72-3192F51D2CDB@uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=tassilo@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).