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: Wed, 3 Sep 2008 11:36:59 +0200	[thread overview]
Message-ID: <A08442C1-E228-4EEF-9C4B-A63B89583C86@uva.nl> (raw)
In-Reply-To: <87od35fx3a.fsf@thinkpad.tsdh.de>

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

  reply	other threads:[~2008-09-03  9:37 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 [this message]
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
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=A08442C1-E228-4EEF-9C4B-A63B89583C86@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).