unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: doltes <doltes512@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to make most functions don't modify X CLIPBOARD?
Date: Sat, 16 Jan 2021 13:23:04 -0500	[thread overview]
Message-ID: <87turgwxkn.fsf@gmail.com> (raw)
In-Reply-To: <jwv35z1m1b4.fsf-monnier+emacs@gnu.org>


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	other threads:[~2021-01-16 18:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 22:31 How to make most functions don't modify X CLIPBOARD? doltes
2021-01-15 23:13 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-01-16  7:13 ` Eli Zaretskii
2021-01-16 13:59   ` Stefan Monnier
2021-01-16 18:23     ` doltes [this message]
2021-01-16 18:32       ` Eli Zaretskii
2021-01-16 21:06       ` moasenwood--- via Users list for the GNU Emacs text editor
2021-01-16 21:10         ` name change (was: Re: How to make most functions don't modify X CLIPBOARD?) moasenwood--- via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87turgwxkn.fsf@gmail.com \
    --to=doltes512@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).