all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to make most functions don't modify X CLIPBOARD?
@ 2021-01-15 22:31 doltes
  2021-01-15 23:13 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-01-16  7:13 ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: doltes @ 2021-01-15 22:31 UTC (permalink / raw)
  To: help-gnu-emacs

System information

+ OS: Arch Linux
+ Display server: X Window System
+ Emacs version: GNU Emacs 27.1

I've noticed that the following functions insert the killed content to
the CLIPBOARD.

+ kill-region (C-w)
+ kill-line (C-k)
+ kill-word (M-d)
+ backward-kill-word (M-DEL)

The only function I want to be able to modify the CLIPBOARD is
"kill-ring-save" (M-w).

The reason I want to do this is because I suppose that whenever one of
those functions (presented in the list above) is executed, the content
is copied to both the "kill ring" and the CLIPBOARD, and I don't want my
computer to use resources inserting something, into the X clipboard,
which is not going to be pasted to another application.

Is there any way to do this?

P.S.: This is my first time participating in a mailing list. Please, let
me know if I've done something wrong.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to make most functions don't modify X CLIPBOARD?
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-01-15 23:13 UTC (permalink / raw)
  To: help-gnu-emacs

doltes wrote:

> I've noticed that the following functions insert the killed content to
> the CLIPBOARD.
>
> + kill-region (C-w)
> + kill-line (C-k)
> + kill-word (M-d)
> + backward-kill-word (M-DEL)

Really? That doesn't seem to happen for me...

> The reason I want to do this is because I suppose that
> whenever one of those functions (presented in the list
> above) is executed, the content is copied to both the "kill
> ring" and the CLIPBOARD, and I don't want my computer to use
> resources inserting something, into the X clipboard, which
> is not going to be pasted to another application.

Try

  (setq select-enable-clipboard nil)

perhaps?

But I don't know since I have that t and it still doesn't
happen for me :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to make most functions don't modify X CLIPBOARD?
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-01-16  7:13 UTC (permalink / raw)
  To: help-gnu-emacs

> From: doltes <doltes512@gmail.com>
> Date: Fri, 15 Jan 2021 17:31:09 -0500
> 
> I've noticed that the following functions insert the killed content to
> the CLIPBOARD.
> 
> + kill-region (C-w)
> + kill-line (C-k)
> + kill-word (M-d)
> + backward-kill-word (M-DEL)
> 
> The only function I want to be able to modify the CLIPBOARD is
> "kill-ring-save" (M-w).
> 
> The reason I want to do this is because I suppose that whenever one of
> those functions (presented in the list above) is executed, the content
> is copied to both the "kill ring" and the CLIPBOARD, and I don't want my
> computer to use resources inserting something, into the X clipboard,
> which is not going to be pasted to another application.
> 
> Is there any way to do this?

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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to make most functions don't modify X CLIPBOARD?
  2021-01-16  7:13 ` Eli Zaretskii
@ 2021-01-16 13:59   ` Stefan Monnier
  2021-01-16 18:23     ` doltes
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2021-01-16 13:59 UTC (permalink / raw)
  To: help-gnu-emacs

> 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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to make most functions don't modify X CLIPBOARD?
  2021-01-16 13:59   ` Stefan Monnier
@ 2021-01-16 18:23     ` doltes
  2021-01-16 18:32       ` Eli Zaretskii
  2021-01-16 21:06       ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 8+ messages in thread
From: doltes @ 2021-01-16 18:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs


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!



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to make most functions don't modify X CLIPBOARD?
  2021-01-16 18:23     ` doltes
@ 2021-01-16 18:32       ` Eli Zaretskii
  2021-01-16 21:06       ` moasenwood--- via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-01-16 18:32 UTC (permalink / raw)
  To: help-gnu-emacs

> From: doltes <doltes512@gmail.com>
> Date: Sat, 16 Jan 2021 13:23:04 -0500
> Cc: help-gnu-emacs@gnu.org
> 
> + "interprogram-cut-function" only defines the function which is
> called for cutting.

If you set this to nil, it will disable copying killed text into the
clipboard and the X primary selection.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to make most functions don't modify X CLIPBOARD?
  2021-01-16 18:23     ` doltes
  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
  1 sibling, 1 reply; 8+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-01-16 21:06 UTC (permalink / raw)
  To: help-gnu-emacs

doltes wrote:

> Thanks to the information provided by Emanuel Berg

Heh, my pleasure...

> 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)

I don't know if it makes sense trying to set up an identical
interface so it can (hopefully) be used transparently?

Perhaps something like this

(setq select-enable-clipboard nil)

(defun kill-ring-save-x (beg end &optional region)
  (interactive (list (mark) (point)
                     (prefix-numeric-value current-prefix-arg) ))
  (let ((select-enable-clipboard t))
    (if (called-interactively-p 'interactive)
        (call-interactively #'kill-ring-save)
      (kill-ring-save beg end region) )))

(global-set-key "\M-w" #'kill-ring-save-x)

?

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 8+ messages in thread

* name change (was: Re: How to make most functions don't modify X CLIPBOARD?)
  2021-01-16 21:06       ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-01-16 21:10         ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 8+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-01-16 21:10 UTC (permalink / raw)
  To: help-gnu-emacs

moasenwood--- via Users list for the GNU Emacs text editor wrote

Okay, why am I called this all of a sudden?

I sent a mail to myself and it said "Emanuel Berg".

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-16 21:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.