소스 검색

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
Ihor Radchenko 2 년 전
부모
커밋
edf46425bb
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      lisp/org.el

+ 4 - 1
lisp/org.el

@@ -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.")))