Function: org-copy-visible

org-copy-visible is an interactive and byte-compiled function defined in org.el.gz.

Signature

(org-copy-visible BEG END)

Documentation

Copy the visible parts of the region.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-copy-visible (beg end)
  "Copy the visible parts of the region."
  (interactive "r")
  (let ((result ""))
    (while (/= beg end)
      (while (org-invisible-p beg)
	(setq beg (org-fold-next-visibility-change beg end)))
      (let ((next (org-fold-next-visibility-change beg end)))
	(setq result (concat result (buffer-substring beg next)))
	(setq beg next)))
    ;; Prevent Emacs from adding full selected text to `kill-ring'
    ;; when `select-enable-primary' is non-nil.  This special value of
    ;; `deactivate-mark' only works since Emacs 29.
    (setq deactivate-mark 'dont-save)
    (kill-new result)
    (message "Visible strings have been copied to the kill ring.")))