Created
October 27, 2011 20:10
-
-
Save milkypostman/1320727 to your computer and use it in GitHub Desktop.
markdown-mode additional functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun markdown-copy-html () | |
"process file with multimarkdown and save it accordingly" | |
(interactive) | |
(save-window-excursion | |
(flet ((markdown-output-standalone-p () t)) | |
(markdown)) | |
(kill-ring-save (point-min) (point-max)))) | |
(defun markdown-copy-rtf () | |
"render and copy as RTF" | |
(interactive) | |
(save-window-excursion | |
(flet ((markdown-output-standalone-p () t)) | |
(let ((markdown-command (concat markdown-command " -s -t rtf"))) | |
(message (prin1-to-string (markdown-output-standalone-p))) | |
(markdown) | |
(shell-command-on-region (point-min) (point-max) "pbcopy"))))) | |
(defun markdown-copy-paste-safari () | |
"process file with multimarkdown, copy it to the clipboard, and | |
paste in safari's selected textarea" | |
(interactive) | |
(markdown-copy-html) | |
(do-applescript "tell application \"Safari\" | |
activate | |
tell application \"System Events\" to keystroke \"a\" using {command down} | |
tell application \"System Events\" to keystroke \"v\" using {command down} | |
end tell")) | |
(eval-after-load 'markdown-mode | |
'(progn | |
(define-key markdown-mode-map (kbd "C-c r") 'markdown-copy-rtf) | |
(define-key markdown-mode-map (kbd "C-c c") 'markdown-copy-html) | |
(define-key markdown-mode-map (kbd "C-c s") 'markdown-copy-paste-safari))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment