[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e342c33 71/72: hydra-ox.el: Emulate org-mode export dispat
From: |
Oleh Krehel |
Subject: |
[elpa] master e342c33 71/72: hydra-ox.el: Emulate org-mode export dispatch |
Date: |
Fri, 06 Mar 2015 13:04:26 +0000 |
branch: master
commit e342c330807fdd09adba974611122d1c95bdf07d
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
hydra-ox.el: Emulate org-mode export dispatch
* hydra-ox.el (hydra-ox): New radiogroup.
(hydra-ox-html): New hydra.
(hydra-ox-latex): New hydra.
(hydra-ox-text): New hydra.
(hydra-ox): New hydra that includes the above three hydras.
(org-mode-map): Add test binding.
Re #66.
---
hydra-ox.el | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 118 insertions(+), 0 deletions(-)
diff --git a/hydra-ox.el b/hydra-ox.el
new file mode 100644
index 0000000..4053081
--- /dev/null
+++ b/hydra-ox.el
@@ -0,0 +1,118 @@
+;;; hydra-ox.el --- Org mode export widget implemented in Hydra
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author: Oleh Krehel
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; This shows how a complex dispatch menu can be built with Hydra.
+
+;;; Code:
+(require 'org)
+
+(defhydradio hydra-ox ()
+ (body-only)
+ (export-scope [buffer subtree])
+ (async-export)
+ (visible-only)
+ (force-publishing))
+
+(defhydra hydra-ox-html (:color blue)
+ "ox-html"
+ ("H" (org-html-export-as-html
+ hydra-ox/async-export
+ (eq hydra-ox/export-scope 'subtree)
+ hydra-ox/visible-only
+ hydra-ox/body-only)
+ "As HTML buffer")
+ ("h" (org-html-export-to-html
+ hydra-ox/async-export
+ (eq hydra-ox/export-scope 'subtree)
+ hydra-ox/visible-only
+ hydra-ox/body-only) "As HTML file")
+ ("o" (org-open-file
+ (org-html-export-to-html
+ hydra-ox/async-export
+ (eq hydra-ox/export-scope 'subtree)
+ hydra-ox/visible-only
+ hydra-ox/body-only)) "As HTML file and open")
+ ("b" hydra-ox/body "back")
+ ("q" nil "quit"))
+
+(defhydra hydra-ox-latex (:color blue)
+ "ox-latex"
+ ("L" org-latex-export-as-latex "As LaTeX buffer")
+ ("l" org-latex-export-to-latex "As LaTeX file")
+ ("p" org-latex-export-to-pdf "As PDF file")
+ ("o" (org-open-file (org-latex-export-to-pdf)) "As PDF file and open")
+ ("b" hydra-ox/body "back")
+ ("q" nil "quit"))
+
+(defhydra hydra-ox-text (:color blue)
+ "ox-text"
+ ("A" (org-ascii-export-as-ascii
+ nil nil nil nil
+ '(:ascii-charset ascii))
+ "As ASCII buffer")
+
+ ("a" (org-ascii-export-to-ascii
+ nil nil nil nil
+ '(:ascii-charset ascii))
+ "As ASCII file")
+ ("L" (org-ascii-export-as-ascii
+ nil nil nil nil
+ '(:ascii-charset latin1))
+ "As Latin1 buffer")
+ ("l" (org-ascii-export-to-ascii
+ nil nil nil nil
+ '(:ascii-charset latin1))
+ "As Latin1 file")
+ ("U" (org-ascii-export-as-ascii
+ nil nil nil nil
+ '(:ascii-charset utf-8))
+ "As UTF-8 buffer")
+ ("u" (org-ascii-export-to-ascii
+ nil nil nil nil
+ '(:ascii-charset utf-8))
+ "As UTF-8 file")
+ ("b" hydra-ox/body "back")
+ ("q" nil "quit"))
+
+(defhydra hydra-ox ()
+ "
+_C-b_ Body only: % -15`hydra-ox/body-only^^^ _C-v_ Visible only:
%`hydra-ox/visible-only
+_C-s_ Export scope: % -15`hydra-ox/export-scope _C-f_ Force publishing:
%`hydra-ox/force-publishing
+_C-a_ Async export: %`hydra-ox/async-export
+
+"
+ ("C-b" (hydra-ox/body-only) nil)
+ ("C-v" (hydra-ox/visible-only) nil)
+ ("C-s" (hydra-ox/export-scope) nil)
+ ("C-f" (hydra-ox/force-publishing) nil)
+ ("C-a" (hydra-ox/async-export) nil)
+ ("h" hydra-ox-html/body "Export to HTML" :exit t)
+ ("l" hydra-ox-latex/body "Export to LaTeX" :exit t)
+ ("t" hydra-ox-text/body "Export to Plain Text" :exit t)
+ ("q" nil "quit"))
+
+(define-key org-mode-map (kbd "C-c C-,") 'hydra-ox/body)
+
+(provide 'hydra-ox)
+
+;;; hydra-ox.el ends here
- [elpa] master 7de26d0 64/72: Add `hydra-repeat': hydra-specific `repeat', (continued)
- [elpa] master 7de26d0 64/72: Add `hydra-repeat': hydra-specific `repeat', Oleh Krehel, 2015/03/06
- [elpa] master f231dc0 55/72: Simplify the hint part of each head, Oleh Krehel, 2015/03/06
- [elpa] master 764f4b6 67/72: hydra.el (hydra--format): Amend key regex, Oleh Krehel, 2015/03/06
- [elpa] master 8e90037 65/72: Add some features for generating tables, Oleh Krehel, 2015/03/06
- [elpa] master 3040f45 61/72: hydra.el (hydra--format): Amend key regex, Oleh Krehel, 2015/03/06
- [elpa] master e1e2e3e 69/72: lv.el (lv-window): Bind `golden-ratio-mode' to nil, Oleh Krehel, 2015/03/06
- [elpa] master 8dec3cd 70/72: Allow for a %s(test) spec in docstring, Oleh Krehel, 2015/03/06
- [elpa] master 9fc928b 63/72: hydra.el (hydra--format): Amend key regex, Oleh Krehel, 2015/03/06
- [elpa] master 989ed95 53/72: Rename compat toggle - :nonheads -> :foreign-keys, Oleh Krehel, 2015/03/06
- [elpa] master 9c68e0a 68/72: Add :timeout option to hydra body, Oleh Krehel, 2015/03/06
- [elpa] master e342c33 71/72: hydra-ox.el: Emulate org-mode export dispatch,
Oleh Krehel <=
- [elpa] master 6d6bbd4 62/72: hydra.el (hydra-key-format-spec): set default to "%s", Oleh Krehel, 2015/03/06
- [elpa] master 26c3fee 60/72: Remove hydra-exit, Oleh Krehel, 2015/03/06
- [elpa] master 41f98bd 66/72: Don't wrap `hydra-repeat', Oleh Krehel, 2015/03/06
- [elpa] master 3222b0c 72/72: Merge commit 'e342c330807fdd09adba974611122d1c95bdf07d' from hydra, Oleh Krehel, 2015/03/06