1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-01 08:17:34 +00:00

org-copy-visible: Prevent Emacs storing primary-selection in kill-ring

* lisp/org.el (org-copy-visible): Make sure that the visible text is
the first entry in `kill-ring' upon exiting `org-copy-visible'.  This
was previously not the case when `select-enable-primary' is non-nil.

The fix only works in Emacs 29 after
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0ab572d5c991dee4818d364a65e004d20f1f45a1
See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57147

Fixes https://orgmode.org/list/25331.25617.528381.574211@gargle.gargle.HOWL
This commit is contained in:
Ihor Radchenko 2022-08-13 22:39:53 +08:00
parent 6ad65f3332
commit edf46425bb
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -16972,7 +16972,10 @@ this numeric value."
(let ((next (next-single-char-property-change beg 'invisible nil end)))
(setq result (concat result (buffer-substring beg next)))
(setq beg next))))
(setq deactivate-mark t)
;; 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.")))