[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gui-set-selection does not set Emacs' internal clipboard
From: |
R. Diez |
Subject: |
gui-set-selection does not set Emacs' internal clipboard |
Date: |
Thu, 7 Sep 2023 13:55:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 |
Hi all:
I have recently upgraded to Emacs 29.1, but I do not know whether I am hitting
a new issue or regression, as I have always had Clipboard problems. Today I am
trying to understand and fix one specific issue with gui-set-selection.
I have compiled Emacs myself on Ubuntu MATE 22.04.3.
I want Emacs' clipboard to behave like Microsoft Windows, GEdit, Pluma, usw.,
so I have set these variables:
(setq select-enable-clipboard t)
(setq select-active-regions nil)
Say I select and copy a piece of text in Emacs. Then I can paste the text both
in Emacs and in an external editor like GEdit or Pluma. So far so good.
I have written an Emacs routine which converts something and places it in the X
clipboard like this:
(gui-set-selection 'CLIPBOARD result)
Say I type, select and copy the piece of text "manual-text" in Emacs, and I then run my
Emacs routine, which ends up placing in the clipboard the piece of text
"from-gui-set-selection".
If I now paste inside Emacs, I get "manual-text". However, if I paste inside GEdit,
Pluma, etc., I get "from-gui-set-selection".
That is, gui-set-selection is not updating Emacs' internal clipboard. Or
perhaps Emacs does not realise that the X clipboard has changed when it was
Emacs itself the one which just changed it.
If I now select a piece of text in GEdit, Pluma, etc. and copy it, then I can
paste it into Emacs without trouble. Well, mostly, but that is an issue for
another day.
I tried calling gui-set-selection again in my Emacs routine, but this time
passing nil, 'PRIMARY or 'SECONDARY, to no avail. I must admit that I do not
really understand how Emacs handles the clipboard.
Can somebody help?
Thanks in advance,
rdiez
- gui-set-selection does not set Emacs' internal clipboard,
R. Diez <=