[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Using other modes in org-mode
From: |
Eric Schulte |
Subject: |
[Orgmode] Using other modes in org-mode |
Date: |
Wed, 10 Sep 2008 16:39:02 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
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
- [Orgmode] Using other modes in org-mode,
Eric Schulte <=