Klimi's new dotfiles with stow.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

127 rindas
4.0 KiB

pirms 4 gadiem
  1. ;;; hydra-ox.el --- Org mode export widget implemented in Hydra
  2. ;; Copyright (C) 2015 Free Software Foundation, Inc.
  3. ;; Author: Oleh Krehel
  4. ;; This file is part of GNU Emacs.
  5. ;; GNU Emacs is free software: you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; GNU Emacs is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;;
  17. ;; This shows how a complex dispatch menu can be built with Hydra.
  18. ;;; Code:
  19. (require 'hydra)
  20. (require 'org)
  21. (declare-function org-html-export-as-html 'ox-html)
  22. (declare-function org-html-export-to-html 'ox-html)
  23. (declare-function org-latex-export-as-latex 'ox-latex)
  24. (declare-function org-latex-export-to-latex 'ox-latex)
  25. (declare-function org-latex-export-to-pdf 'ox-latex)
  26. (declare-function org-ascii-export-as-ascii 'ox-ascii)
  27. (declare-function org-ascii-export-to-ascii 'ox-ascii)
  28. (defhydradio hydra-ox ()
  29. (body-only "Export only the body.")
  30. (export-scope "Export scope." [buffer subtree])
  31. (async-export "When non-nil, export async.")
  32. (visible-only "When non-nil, export visible only")
  33. (force-publishing "Toggle force publishing"))
  34. (defhydra hydra-ox-html (:color blue)
  35. "ox-html"
  36. ("H" (org-html-export-as-html
  37. hydra-ox/async-export
  38. (eq hydra-ox/export-scope 'subtree)
  39. hydra-ox/visible-only
  40. hydra-ox/body-only)
  41. "As HTML buffer")
  42. ("h" (org-html-export-to-html
  43. hydra-ox/async-export
  44. (eq hydra-ox/export-scope 'subtree)
  45. hydra-ox/visible-only
  46. hydra-ox/body-only) "As HTML file")
  47. ("o" (org-open-file
  48. (org-html-export-to-html
  49. hydra-ox/async-export
  50. (eq hydra-ox/export-scope 'subtree)
  51. hydra-ox/visible-only
  52. hydra-ox/body-only)) "As HTML file and open")
  53. ("b" hydra-ox/body "back")
  54. ("q" nil "quit"))
  55. (defhydra hydra-ox-latex (:color blue)
  56. "ox-latex"
  57. ("L" org-latex-export-as-latex "As LaTeX buffer")
  58. ("l" org-latex-export-to-latex "As LaTeX file")
  59. ("p" org-latex-export-to-pdf "As PDF file")
  60. ("o" (org-open-file (org-latex-export-to-pdf)) "As PDF file and open")
  61. ("b" hydra-ox/body "back")
  62. ("q" nil "quit"))
  63. (defhydra hydra-ox-text (:color blue)
  64. "ox-text"
  65. ("A" (org-ascii-export-as-ascii
  66. nil nil nil nil
  67. '(:ascii-charset ascii))
  68. "As ASCII buffer")
  69. ("a" (org-ascii-export-to-ascii
  70. nil nil nil nil
  71. '(:ascii-charset ascii))
  72. "As ASCII file")
  73. ("L" (org-ascii-export-as-ascii
  74. nil nil nil nil
  75. '(:ascii-charset latin1))
  76. "As Latin1 buffer")
  77. ("l" (org-ascii-export-to-ascii
  78. nil nil nil nil
  79. '(:ascii-charset latin1))
  80. "As Latin1 file")
  81. ("U" (org-ascii-export-as-ascii
  82. nil nil nil nil
  83. '(:ascii-charset utf-8))
  84. "As UTF-8 buffer")
  85. ("u" (org-ascii-export-to-ascii
  86. nil nil nil nil
  87. '(:ascii-charset utf-8))
  88. "As UTF-8 file")
  89. ("b" hydra-ox/body "back")
  90. ("q" nil "quit"))
  91. (defhydra hydra-ox ()
  92. "
  93. _C-b_ Body only: % -15`hydra-ox/body-only^^^ _C-v_ Visible only: %`hydra-ox/visible-only
  94. _C-s_ Export scope: % -15`hydra-ox/export-scope _C-f_ Force publishing: %`hydra-ox/force-publishing
  95. _C-a_ Async export: %`hydra-ox/async-export
  96. "
  97. ("C-b" (hydra-ox/body-only) nil)
  98. ("C-v" (hydra-ox/visible-only) nil)
  99. ("C-s" (hydra-ox/export-scope) nil)
  100. ("C-f" (hydra-ox/force-publishing) nil)
  101. ("C-a" (hydra-ox/async-export) nil)
  102. ("h" hydra-ox-html/body "Export to HTML" :exit t)
  103. ("l" hydra-ox-latex/body "Export to LaTeX" :exit t)
  104. ("t" hydra-ox-text/body "Export to Plain Text" :exit t)
  105. ("q" nil "quit"))
  106. (define-key org-mode-map (kbd "C-c C-,") 'hydra-ox/body)
  107. (provide 'hydra-ox)
  108. ;;; hydra-ox.el ends here