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* ((type (downcase (or (org-element-property :type element)
			       ;; Missing export-block type.  Fallback
			       ;; to default mode.
			       "fundamental")))
	   (mode (org-src-get-lang-mode type)))
      (unless (functionp mode) (error "No such language mode: %s" mode))
      (org-src--edit-element
       element
       (org-src--construct-edit-buffer-name (buffer-name) type)
       mode
       (lambda () (org-escape-code-in-region (point-min) (point-max)))))
    t))