From: Tassilo Horn <tassilo@member.fsf.org>
To: emacs-orgmode@gnu.org
Subject: Using orgstruct-mode in programming language files
Date: Wed, 20 Aug 2008 18:33:22 +0200 [thread overview]
Message-ID: <87od3nfxyl.fsf@thinkpad.tsdh.de> (raw)
Hi,
I'd like to switch from outline-minor-mode to orgstruct-mode for various
programming language files. So for example shell scripts (sh-mode) a
headline looks like
#* Foobar
The fontlocking works for such headlines.
Now I've found out that org-context-p won't return t for that line, and
thus no org-mode command will be executed. So I've redefined
org-context-p 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
reply other threads:[~2008-08-20 16:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=87od3nfxyl.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=emacs-orgmode@gnu.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).