help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make most functions don't modify X CLIPBOARD?


From: doltes
Subject: Re: How to make most functions don't modify X CLIPBOARD?
Date: Sat, 16 Jan 2021 13:23:04 -0500
User-agent: mu4e 1.4.14; emacs 27.1

Stefan Monnier writes:

>> You want to avoid copying only to the X clipboard, or also to the X
>> selection?
>>
>> Depending on the answer, either change the value of
>> select-enable-clipboard or of interprogram-cut-function.
>
> Or `select-enable-primary`, of course.
>
>
>         Stefan

I tried setting "select-enable-clipboard" to "t". However, that made
all the mentioned functions, even "kill-ring-save" (M-w), not to
modify the X CLIPBOARD (i.e. a.k.a. "XA_CLIPBOARD" in the "xclip"
manual page).

Note that what I'm requesting is that the only function I want to be
able to modify the X CLIPBOARD is "kill-ring-save" (M-w).

Thanks to the information provided by Emanuel Berg, I was able to
accomplish what I'm requestion by doing. If any of you have some
feedback, I would appreciate it.

```
(setq select-enable-clipboard nil)

(defun my/kill-ring-save ()
  (interactive)
  (let ((select-enable-clipboard t))
    (call-interactively 'kill-ring-save)))

(global-set-key (kbd "M-w") 'my/kill-ring-save)
```

Regarding the other variables mentioned, I looked into them but they
didn't help because

+ "interprogram-cut-function" only defines the function which is
called for cutting.

+ "select-enable-primary" only defines whether the killed content
should be inserted into the PRIMARY clipboard.

Thanks for the help, everyone!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]