From: "Eric Schulte" <schulte.eric@gmail.com>
To: Org-mode <emacs-orgmode@gnu.org>
Cc: LBorgman <lennart.borgman@gmail.com>
Subject: Using other modes in org-mode
Date: Wed, 10 Sep 2008 16:39:02 -0700 [thread overview]
Message-ID: <87iqt3zi3t.fsf@gmail.com> (raw)
Hi,
Here is some code for using other major modes inside of org-mode. It
uses blocks like the org-mode "#+BEGIN_SOURCE", "#+END_SOURCE" blocks.
This is sort of fun to play with but not necessarily stable. Thanks to
Lennart for showing me how the MuMaMo code works. Requires MuMaMo-mode
http://www.emacswiki.org/cgi-bin/wiki/MuMaMo
In order to try this out...
1) eval the following elisp forms (change the value of mumamo-org-modes
if you want to try other modes)
(require 'mumamo)
(defvar mumamo-org-modes
'(ruby-mode emacs-lisp-mode c-mode)
"Modes to include in org-files")
(defvar mumamo-org-chunk-functions
(mapcar
(lambda (mode)
(eval `(defun ,(intern (format "mumamo-chunk-org-%S" mode)) (pos min max)
,(format "%s support inside org BEGIN END blocks" mode)
(mumamo-quick-static-chunk
pos min max ,(format "#+BEGIN_%S" mode) ,(format "#+END_%S" mode)
t (quote ,mode) nil))))
mumamo-org-modes)
"The automatically defined mumamo-chunk-org-* functions for use
cramming other modes into org-mode. See `mumamo-org-modes'
`mumamo-quick-static-chunk'.")
(eval `(define-mumamo-multi-major-mode org-mumamo-mode
,(format "Turn on multiple major modes with main major mode org-mode.\n\n%s"
(mapconcat (lambda (el) (format "- %S" el))
mumamo-org-modes "\n"))
("Org Source Blocks Family" org-mode ,mumamo-org-chunk-functions)))
2) open a buffer containing something like the following
* testing this out
- regular org-mode in these lines
#+BEGIN_ruby-mode
# ruby-mode active in the block
def eric
# nothing else
end
#+END_ruby-mode
#+BEGIN_emacs-lisp-mode
(defun this-is-lisp ()
)
#+END_emacs-lisp-mode
3) M-x org-mumamo-mode
next reply other threads:[~2008-09-10 23:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-10 23:39 Eric Schulte [this message]
2008-09-10 23:43 ` Using other modes in org-mode Lennart Borgman (gmail)
2008-09-11 3:00 ` S.P.Tseng
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=87iqt3zi3t.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=lennart.borgman@gmail.com \
/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).