Add binding for Org export block
This commit is contained in:
parent
1a94e00712
commit
daf0a270af
16
init.org
16
init.org
|
@ -813,7 +813,8 @@ _u_: next word ^_l_: edit lines^ _s_: next whole symbol
|
||||||
("t" (my-org-insert-block "SRC" nil ":tangle test :load test") "Source test")
|
("t" (my-org-insert-block "SRC" nil ":tangle test :load test") "Source test")
|
||||||
("e" (my-org-insert-block "SRC" nil ":tangle no :load no") "Source example")
|
("e" (my-org-insert-block "SRC" nil ":tangle no :load no") "Source example")
|
||||||
("o" (my-org-insert-block "QUOTE") "quote")
|
("o" (my-org-insert-block "QUOTE") "quote")
|
||||||
("v" (my-org-insert-block "VERSE") "verse"))
|
("v" (my-org-insert-block "VERSE") "verse")
|
||||||
|
("x" (my-org-insert-block "EXPORT" nil nil t) "Export"))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
**** org navigation
|
**** org navigation
|
||||||
|
@ -3722,23 +3723,32 @@ TYPE should be an Org block type, e.g. SRC, QUOTE, etc.
|
||||||
|
|
||||||
If TYPE is SRC, LANG should be the name of the language as a string, e.g. \"emacs-lisp\".
|
If TYPE is SRC, LANG should be the name of the language as a string, e.g. \"emacs-lisp\".
|
||||||
|
|
||||||
|
If TYPE is EXPORT, LANG should be the name of the export format as a string, e.g. \"html\".
|
||||||
|
|
||||||
If LANG is not supplied, use the value of
|
If LANG is not supplied, use the value of
|
||||||
`my-org-src-default-lang'. If `my-org-src-default-lang' is nil,
|
`my-org-src-default-lang'. If `my-org-src-default-lang' is nil,
|
||||||
or with ASK, prompt the user for a language."
|
or with ASK, prompt the user for a language."
|
||||||
(let* ((src-block-p (equal type "SRC"))
|
(let* ((src-block-p (equal type "SRC"))
|
||||||
|
(export-block-p (equal type "EXPORT"))
|
||||||
|
(ask-lang-p (or (not lang) ask))
|
||||||
(lang (cond ((stringp lang) lang)
|
(lang (cond ((stringp lang) lang)
|
||||||
((and (bound-and-true-p my-org-src-default-lang)
|
((and (bound-and-true-p my-org-src-default-lang)
|
||||||
(stringp my-org-src-default-lang)
|
(stringp my-org-src-default-lang)
|
||||||
(not ask))
|
(not ask))
|
||||||
my-org-src-default-lang)
|
my-org-src-default-lang)
|
||||||
((and src-block-p (or (not lang) ask))
|
((and src-block-p ask-lang-p)
|
||||||
(completing-read "Source block language: "
|
(completing-read "Source block language: "
|
||||||
(mapcar #'cl-first org-src-lang-modes)))
|
(mapcar #'cl-first org-src-lang-modes)))
|
||||||
|
((and export-block-p ask-lang-p)
|
||||||
|
(completing-read "Export block format: "
|
||||||
|
(mapcar #'symbol-name org-export-backends)))
|
||||||
(t nil)))
|
(t nil)))
|
||||||
(column (- (point) (point-at-bol)))
|
(column (- (point) (point-at-bol)))
|
||||||
(indent (make-string column ?\s))
|
(indent (make-string column ?\s))
|
||||||
(start-string (format "#+BEGIN_%s %s%s\n" type
|
(start-string (format "#+BEGIN_%s %s%s\n" type
|
||||||
(if src-block-p lang "")
|
(if (or src-block-p export-block-p)
|
||||||
|
lang
|
||||||
|
"")
|
||||||
(if (and src-block-p header-args)
|
(if (and src-block-p header-args)
|
||||||
(format " %s" header-args)
|
(format " %s" header-args)
|
||||||
"")))
|
"")))
|
||||||
|
|
Loading…
Reference in New Issue