Function: clipetty-cut
clipetty-cut is a natively compiled function defined in clipetty.el.
Signature
(clipetty-cut ORIG-FUN STRING)
Documentation
If in a terminal frame, convert STRING to a series of OSC 52 messages.
Since this is intended to be used with add-function, ORIG-FUN is
the original interprogram-cut-function that we're advising.
Source Code
;; Defined in /nix/store/7jgingzby054id3d9x64ir7i7a509mkl-emacs-packages-deps/share/emacs/site-lisp/elpa/clipetty-20200327.2241/clipetty.el
(defun clipetty-cut (orig-fun string)
"If in a terminal frame, convert STRING to a series of OSC 52 messages.
Since this is intended to be used with `add-function', ORIG-FUN is
the original `interprogram-cut-function' that we're advising."
(unless (display-graphic-p)
;; An exclamation mark is an invalid base64 string. This signals to the
;; Kitty terminal emulator to reset the clipboard. Other terminals will
;; simply ignore this.
;;
;; TODO: Support longer than `clipetty--max-cut' length messages in Kitty.
(clipetty--emit (clipetty--osc "!"))
(clipetty--emit (clipetty--osc string t)))
;; Always chain to the original cut function.
(funcall orig-fun string))