emacs tip: inserting source code in org-mode

emacs tip: inserting source code in org-mode

When using org-mode, you can insert a snippet of proraming language code.

Type <s then Tab. It will insert this markup:

#+begin_src ▮


The above is the syntax for literal text. (similar to the concept of perl and PHP'S Heredoc.)

Then, type “emacs-lisp” so you have:

#+begin_src emacs-lisp


this tells org-mode this snippet is emacs-lisp code. The “emacs-lisp” there can be any mode. e.g. “html”, “perl”,“haskell”, etc. (technically: the value of the variable “major-mode”, then minus the “-mode” string at the end.)

orgmode.org 15.2 Easy Templates

For basics of org-mode, see: Emacs: outline-mode and org-mode tutorial.

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs