emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using other modes in org-mode
@ 2008-09-10 23:39 Eric Schulte
  2008-09-10 23:43 ` Lennart Borgman (gmail)
  2008-09-11  3:00 ` S.P.Tseng
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Schulte @ 2008-09-10 23:39 UTC (permalink / raw)
  To: Org-mode; +Cc: LBorgman

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using other modes in org-mode
  2008-09-10 23:39 Using other modes in org-mode Eric Schulte
@ 2008-09-10 23:43 ` Lennart Borgman (gmail)
  2008-09-11  3:00 ` S.P.Tseng
  1 sibling, 0 replies; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-10 23:43 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org-mode

Eric Schulte wrote:
> (eval `(define-mumamo-multi-major-mode org-mumamo-mode

How nice you get it working!

Jost a note: I use to drop "-mode" at the end because the defined
command is not a major mode, it is a multi major mode (and that is what
"-mumamo" tells).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using other modes in org-mode
  2008-09-10 23:39 Using other modes in org-mode Eric Schulte
  2008-09-10 23:43 ` Lennart Borgman (gmail)
@ 2008-09-11  3:00 ` S.P.Tseng
  1 sibling, 0 replies; 3+ messages in thread
From: S.P.Tseng @ 2008-09-11  3:00 UTC (permalink / raw)
  To: emacs-orgmode


That will be very cool, if this feature will be part of org-mode. It can
correctly indent, font-lock and easy edit source code in native org-mode.

By the way, I can not stop special mark "[[xxx][xx]] *xxxx*" to be explain with
SRC block, however ":" can do that.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-11  3:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-10 23:39 Using other modes in org-mode Eric Schulte
2008-09-10 23:43 ` Lennart Borgman (gmail)
2008-09-11  3:00 ` S.P.Tseng

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