mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 20:37:51 +00:00
Add `org-copy-visible' command proposed by Florian Beck
* lisp/org.el (org-copy-visible): New command.
This commit is contained in:
parent
c222e8f134
commit
7f742f12cf
14
lisp/org.el
14
lisp/org.el
|
@ -17664,6 +17664,20 @@ Depending on context, this does one of the following:
|
|||
((org-at-table-p) (call-interactively 'org-table-hline-and-move))
|
||||
(t (call-interactively 'org-insert-heading))))
|
||||
|
||||
(defun org-copy-visible (beg end)
|
||||
"Copy the visible parts of the region."
|
||||
(interactive "r")
|
||||
(let (snippets s)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(narrow-to-region beg end)
|
||||
(setq s (goto-char (point-min)))
|
||||
(while (not (= (point) (point-max)))
|
||||
(goto-char (org-find-invisible))
|
||||
(push (buffer-substring s (point)) snippets)
|
||||
(setq s (goto-char (org-find-visible))))))
|
||||
(kill-new (apply 'concat (nreverse snippets)))))
|
||||
|
||||
(defun org-copy-special ()
|
||||
"Copy region in table or copy current subtree.
|
||||
Calls `org-table-copy' or `org-copy-subtree', depending on context.
|
||||
|
|
Loading…
Reference in a new issue