summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2018-01-28 20:23:34 +0100
committerUlrich Müller <ulm@gentoo.org>2018-01-28 20:23:34 +0100
commitd2c797db29e3cf4f935f9a96189c71c60b267270 (patch)
treee8e6e777451a16417491d918dbf1301200e0d62d /glep-mode.el
parentAdd missing Content-Type to GLEP skeleton. (diff)
downloadebuild-mode-d2c797db29e3cf4f935f9a96189c71c60b267270.tar.gz
ebuild-mode-d2c797db29e3cf4f935f9a96189c71c60b267270.tar.bz2
ebuild-mode-d2c797db29e3cf4f935f9a96189c71c60b267270.zip
New command to format a GLEP as HTML.
* glep-mode.el (glep-mode-format-html): New command. (glep-mode-map): Bind to "C-c C-f". (glep-mode-menu): Add to menu.
Diffstat (limited to 'glep-mode.el')
-rw-r--r--glep-mode.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/glep-mode.el b/glep-mode.el
index 70fdaa9..095e526 100644
--- a/glep-mode.el
+++ b/glep-mode.el
@@ -168,6 +168,17 @@ to `font-lock-end'."
(ad-activate 'rst-classify-adornment)
+;;; Generate HTML from GLEP.
+
+;;;###autoload
+(defun glep-mode-format-html ()
+ (interactive)
+ "Generate HTML from reStructuredText GLEP file.
+Calls the external \"glep\" command."
+ (let* ((rst-file (file-relative-name buffer-file-name))
+ (html-file (concat (file-name-sans-extension rst-file) ".html")))
+ (compile (format "glep %s %s" rst-file html-file))))
+
;;; Skeleton support.
;; Header format, as specified by GLEP 1.
@@ -361,13 +372,15 @@ Attribution-ShareAlike 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by-sa/3.0/.
")
-(define-key glep-mode-map
- "\C-c\C-n" 'glep-mode-insert-skeleton)
+;; rst-mode already uses the following C-c C-<letter> keys: aclrt
+(define-key glep-mode-map "\C-c\C-n" 'glep-mode-insert-skeleton)
+(define-key glep-mode-map "\C-c\C-f" 'glep-mode-format-html)
(easy-menu-define glep-mode-menu glep-mode-map
"Menu for glep-mode."
`("GLEP"
- ["Insert skeleton" glep-mode-insert-skeleton]))
+ ["Insert skeleton" glep-mode-insert-skeleton]
+ ["Format as HTML" glep-mode-format-html]))
;;;###autoload
(add-to-list 'auto-mode-alist '("/glep.*\\.rst\\'" . glep-mode))