Function: org-edit-export-block

org-edit-export-block is an interactive and byte-compiled function defined in org-src.el.gz.

Signature

(org-edit-export-block)

Documentation

Edit export block at point.

A new buffer is created and the block is copied into it, and the buffer is switched into an appropriate major mode. See also org-src-lang-modes.

When done, exit with C-c ' (org-edit-src-exit). The edited text will then replace the area in the Org mode buffer.

Throw an error when not at an export block.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-src.el.gz
(defun org-edit-export-block ()
  "Edit export block at point.
\\<org-src-mode-map>
A new buffer is created and the block is copied into it, and the
buffer is switched into an appropriate major mode.  See also
`org-src-lang-modes'.

When done, exit with `\\[org-edit-src-exit]'.  The edited text \
will then replace
the area in the Org mode buffer.

Throw an error when not at an export block."
  (interactive)
  (let ((element (org-element-at-point)))
    (unless (and (org-element-type-p element 'export-block)
		 (org-src--on-datum-p element))
      (user-error "Not in an export block"))
    (let* ((lang-f-fallback #'fundamental-mode)
           (lang (or (if-let* ((lang
                                (org-element-property :type element)))
                         (downcase lang))
                     (replace-regexp-in-string
                      "-mode$" ""
                      (symbol-name lang-f-fallback))))
	   (lang-f (org-src-get-lang-mode-if-bound
                    lang
                    lang-f-fallback
                    t)))
      (org-src--edit-element
       element
       (org-src--construct-edit-buffer-name (buffer-name) lang)
       lang-f
       (lambda () (org-escape-code-in-region (point-min) (point-max)))))
    t))