-
Notifications
You must be signed in to change notification settings - Fork 1
/
jmjeong-markdown.el
93 lines (81 loc) · 3.33 KB
/
jmjeong-markdown.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
;; markdown mode [2009-07-23]
(require 'markdown-mode)
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
;; (add-hook 'markdown-mode-hook
;; (let ((original-command (lookup-key markdown-mode-map [tab])))
;; `(lambda ()
;; (setq yas/fallback-behavior
;; '(apply ,original-command))
;; (auto-fill-mode)
;; (local-set-key [tab] 'yas/expand))))
(autoload 'gfm-mode "gfm-mode"
"Major mode for editing GitHub Flavored Markdown files" t)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
(add-to-list 'auto-mode-alist '("\\.text$" . markdown-mode))
;; (add-to-list 'auto-mode-alist '("\\.txt$" . markdown-mode))
(add-to-list 'auto-mode-alist '("md$" . markdown-mode))
(add-to-list 'auto-mode-alist '("markdown$" . markdown-mode))
(add-to-list 'auto-mode-alist '("README$" . markdown-mode))
(add-to-list 'auto-mode-alist '("readme$" . markdown-mode))
(defun markdown-preview-file ()
"run Marked on the current file and revert the buffer"
(interactive)
(save-buffer)
(async-shell-command
(format "open -a /Applications/Marked 2.app %s"
(shell-quote-argument (buffer-file-name))))
)
(setq markdown-open-command "/Users/jmjeong/bin/mark")
; markdown mode를 써보니 기존의 orgmode에 비해서 많이 불편하다.
; org-mode를 derive한 org-markdown-mode를 정의
;; (define-derived-mode org-markdown-mode org-mode "OrgMarkdown"
;; "Major mode for OrgMarkdown.
;; \\{org-mode-map}"
;; (setq case-fold-search nil)
;; (set (make-local-variable 'before-save-hook) '((lambda() (convert-to-markdown-mode))))
;; (set (make-local-variable 'after-save-hook) '((lambda() (convert-to-org-mode))))
;; ;; (setq after-save-hook 'convert-to-org-mode)
;; (setq org-indent-indentation-per-level 4)
;; ;; (org-indent-mode t)
;; (setq org-list-indent-offset 2)
;; ;; (longlines-mode)
;; )
;; (defun markdown-unset-tab ()
;; "markdown-mode-hook"
;; (define-key markdown-mode-map (kbd "<tab>") nil))
;; (add-hook 'markdown-mode-hook '(lambda() (markdown-unset-tab)))
;; (defun convert-to-markdown-mode ()
;; "Convert org format into markdown format(fix header)"
;; (interactive)
;; (save-excursion
;; (progn
;; (while (re-search-forward "^\\*\\*\\*\\*" nil t)
;; (replace-match "####"))
;; (goto-char (point-min))
;; (while (re-search-forward "^\\*\\*\\*" nil t)
;; (replace-match "###"))
;; (goto-char (point-min))
;; (while (re-search-forward "^\\*\\*" nil t)
;; (replace-match "##"))
;; (goto-char (point-min))
;; (while (re-search-forward "^\\*" nil t)
;; (replace-match "#")) )))
;; (defun convert-to-org-mode ()
;; "Convert markdown format into org format(fix header)"
;; (interactive)
;; (save-excursion
;; (progn
;; (while (re-search-forward "^####" nil t)
;; (replace-match "****"))
;; (goto-char (point-min))
;; (while (re-search-forward "^###" nil t)
;; (replace-match "***"))
;; (goto-char (point-min))
;; (while (re-search-forward "^##" nil t)
;; (replace-match "**"))
;; (goto-char (point-min))
;; (while (re-search-forward "^#" nil t)
;; (replace-match "*")) )))
;; (add-hook 'org-markdown-mode-hook '(lambda() (local-set-key "\C-cm" 'markdown-preview-file)))
;; (add-hook 'org-markdown-mode-hook '(lambda() (convert-to-org-mode)))