Brad Lucas

A blog mostly about programming
July 7, 2017

Insert Org Mode Line

If you use org-mode a lot you'll eventually look to a way to quickly setup a new file with your favorite settings. Here I use the following to quickly add the org mode line and a few favored settings.

(defconst *org-modeline*  "# -*- mode:org; -*-")
(defconst *org-mode-settings* "
#+STARTUP: showall
#+STARTUP: hidestars
#+OPTIONS: toc:nil
#+OPTIONS: skip:t
#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"./org.css\" />
#+OPTIONS: ^:nil

* HEADING
")

(defun insert-org-modeline ()
  (interactive)
  (save-excursion
    (beginning-of-buffer)
    (insert *org-modeline*)
    (insert *org-mode-settings*)
    (newline)
    (newline)
    )
  (end-of-buffer)
  (save-buffer))

Feel free to add or modify to make the above your own.


Tags: emacs