htmlize-region-and-browse を書く流れ
ということで,region 版を書いてみたけど,
こういうの増やすのはどうやるのが正しいのか知らないので識者に期待する流れ.
;;; htmlize (add-to-list 'load-path (expand-file-name ".emacs.d/htmlize" home)) (require 'htmlize) ;;; http://www.kanasansoft.com/weblab/2011/07/htmlize-and-browse.html (defun htmlize-region-and-browse () (interactive) (defcustom htmlize-and-browse-directory-path temporary-file-directory "htmlize-and-browse-temporary-file-directory" :type 'string :group 'htmlize-and-browse) (setq htmlize-and-browse-buffer-file-name (concat "htmlize-and-browse-" (format-time-string "%Y%m%d%H%M%S" (current-time)) ".html")) (setq htmlize-and-browse-buffer-file-path (concat htmlize-and-browse-directory-path htmlize-and-browse-buffer-file-name)) (with-current-buffer (htmlize-region (region-beginning) (region-end)) (write-file htmlize-and-browse-buffer-file-path) (set-buffer-modified-p nil) (kill-buffer htmlize-and-browse-buffer-file-name) (shell-command (concat "open " htmlize-and-browse-buffer-file-path))))
;;; htmlize(add-to-list 'load-path (expand-file-name ".emacs.d/htmlize" home))
(require 'htmlize)
;;; http://www.kanasansoft.com/weblab/2011/07/htmlize-and-browse.html
(defun htmlize-region-and-browse ()
(interactive)
(defcustom
htmlize-and-browse-directory-path temporary-file-directory
"htmlize-and-browse-temporary-file-directory"
:type 'string
:group 'htmlize-and-browse)
(setq htmlize-and-browse-buffer-file-name
(concat "htmlize-and-browse-"
(format-time-string "%Y%m%d%H%M%S" (current-time))
".html"))
(setq htmlize-and-browse-buffer-file-path
(concat htmlize-and-browse-directory-path
htmlize-and-browse-buffer-file-naame))
(with-current-buffer (htmlize-region (region-beginning) (region-end))
(write-file htmlize-and-browse-buffer-file-path)
(set-buffer-modified-p nil)
(kill-buffer htmlize-and-browse-buffer-file-name)
(shell-command (concat "open " htmlize-and-browse-buffer-file-path))))