lisp/my-markdown.el
author Fabien Ninoles <fabien@tzone.org>
Sat, 03 Jan 2015 11:21:36 -0500
changeset 9 56e80afa3e1c
parent 1 a234a7579958
permissions -rw-r--r--
Only start sloppy timer on a mouse_enter. This avoid a bug when the focus is stolen by another window.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     1
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     2
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     3
(setq ditaa-cmd "ditaa")
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     4
(defun ditaa-generate (start end)
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     5
  (interactive "r")
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     6
  (let ((tmpfile (make-temp-file "ditaa")))
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     7
    (write-region start end tmpfile)
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     8
    (shell-command
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
     9
     (concat ditaa-cmd " " tmpfile " " (concat buffer-file-name ".png")))))
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
    10
a234a7579958 Add Emacs lisp files.
Fabien Ninoles <fabien@tzone.org>
parents:
diff changeset
    11
(provide 'my-markdown)