[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)


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

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
   (lambda (mode)
     (eval `(defun ,(intern (format "mumamo-chunk-org-%S" mode)) (pos min max)
              ,(format "%s support inside org BEGIN END blocks" mode)
               pos min max ,(format "#+BEGIN_%S" mode) ,(format "#+END_%S" mode)
               t (quote ,mode) nil))))
  "The automatically defined mumamo-chunk-org-* functions for use
cramming other modes into org-mode.  See `mumamo-org-modes'

(eval `(define-mumamo-multi-major-mode org-mumamo-mode
         ,(format "Turn on multiple major modes with main major mode 
                  (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


  # ruby-mode active in the block
  def eric
    # nothing else


(defun this-is-lisp ()



3) M-x org-mumamo-mode

reply via email to

[Prev in Thread] Current Thread [Next in Thread]