Skip to content

Instantly share code, notes, and snippets.

@itiut
Created September 7, 2014 12:34
Show Gist options
  • Save itiut/c6efbe0db58e2d7470a6 to your computer and use it in GitHub Desktop.
Save itiut/c6efbe0db58e2d7470a6 to your computer and use it in GitHub Desktop.
;;; markdown-mode
(require 'markdown-mode)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
;; whitespaceのauto-cleanupをオフに
(add-hook 'markdown-mode-hook
'(lambda ()
(set (make-local-variable 'whitespace-action) nil)))
(define-key markdown-mode-map (kbd "C-c C-c p") 'my/toggle-markdown-preview)
(defun my/toggle-markdown-preview ()
"カレントバッファをmarkupでプレビュー/プレビューをやめる."
(interactive)
(let ((proc (get-buffer-process "*markup*")))
(if (and (processp proc)
(process-live-p proc))
(progn
(message "Finish markdown preview")
(kill-process proc))
(when (= (call-process-shell-command "which" nil nil nil "markup") 0)
(progn
(message "Start markdowp preview")
(start-process "markup" "*markup*" "markup" buffer-file-name)
(run-at-time 1 nil 'browse-url "http://localhost:3000"))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment