unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "R. Diez" <rdiezmail-emacs@yahoo.de>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: gui-set-selection does not set Emacs' internal clipboard
Date: Thu, 7 Sep 2023 13:55:00 +0200	[thread overview]
Message-ID: <9b8182a1-afc5-41ae-9bca-873795921705@yahoo.de> (raw)
In-Reply-To: 9b8182a1-afc5-41ae-9bca-873795921705.ref@yahoo.de

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



       reply	other threads:[~2023-09-07 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9b8182a1-afc5-41ae-9bca-873795921705.ref@yahoo.de>
2023-09-07 11:55 ` R. Diez [this message]
2023-09-07 12:12   ` gui-set-selection does not set Emacs' internal clipboard Po Lu

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=9b8182a1-afc5-41ae-9bca-873795921705@yahoo.de \
    --to=rdiezmail-emacs@yahoo.de \
    --cc=help-gnu-emacs@gnu.org \
    /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).