unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: bokr@bokr.com
To: Joshua Branson <jbranso@dismail.de>
Cc: 58606@debbugs.gnu.org, Andrew Tropin <andrew@trop.in>
Subject: bug#58606: Emacs next pgtk crashes when pasting to other app
Date: Wed, 26 Oct 2022 15:37:47 +0200	[thread overview]
Message-ID: <20221026133747.GA5784@LionPure> (raw)
In-Reply-To: <87fsfcgeqj.fsf@dismail.de>

Hi Joshua,

On +2022-10-25 10:27:48 -0400, Joshua Branson via Bug reports for GNU Guix wrote:
> Andrew Tropin <andrew@trop.in> writes:
> 
> > On 2022-10-18 10:52, Andrew Tropin wrote:
> >
> >> Recently discovered a problem, which reproduces this way:
> >> - Open a new emacs instance.
> >> - Yank anything with M-w or select with mouse.
> >> - Paste yanked text to chromium/icecat.
> >>
> 
> I sometimes run two instances of Emacs.  I discovered today, that Emacs
> cannot yank from one and paste to another.  When I try to paste I get this
> mysterious warning message in Emacs:
> 
> "waiting for reply from selection owner."
> 
> 
> 

Disclaimer: Sharing newbie discovery, inviting risk commentary, no warranty :)

A hack to get around clipboarding hangs (which I won't go into here :)
is (if you are safely by yourself on your laptop) this:

Select what you want to copy-paste as usual
(Ctl-Space and move point to end of region)
but then don't copy it with  Mx w --
instead do shell-op on region like
--8<---------------cut here---------------start------------->8---
Esc |
tee /tmp/foo
--8<---------------cut here---------------end--------------->8---
that should write your region into /tmp/foo

Then switch to your other emacs instance and insert
foo contents at point using

--8<---------------cut here---------------start------------->8---
Ctl-x i
/tmp/foo
--8<---------------cut here---------------end--------------->8---

tee should not have added any newline unless you had it in
your selected region, and Ctl-x i should insert verbatim.
(well, probably modulo different encodings in various buffers. Idk :)

If you want to hop between gui and emacs -nw it should work
fine there too. I've tried that.

If you want to do like append-string, adding to the end of foo, use
...|tee -a /tmp/foo
or use separate files ad lib, of course: whatever|tee /tmp/bar

If you want to be a bit safer, it'd probably be good to make
a restricted temp dir like

--8<---------------cut here---------------start------------->8---
$ mktemp -d /tmp/joshclips.XXXXXX.d
/tmp/joshclips.rinY4L.d
$ ls -ltra /tmp/joshclips.rinY4L.d/
total 8
drwxrwxrwt 16 root root 4096 Oct 26 12:59 ..
drwx------  2 bokr bokr 4096 Oct 26 12:59 .
--8<---------------cut here---------------end--------------->8---
(note the restricted write perm just to user, not group)

and then tee to
/tmp/joshclips.rinY4L.d/foo

Of course, if you want to preserve your cutting room detritus,
you can use other directories than /tmp :)

BTW, you could of course plain write foo with Crl-x w
but then you'd get interaction that using tee and insert avoids.

Also you could use cat > or cat >> in place of tee and tee -a
respectively, but then your selected region would disappear
because redirected cat effectively returns '' as the filtered region,
unlike tee which makes no mod, just sneaks a copy.

Using cat you'd have to undo with Crl-underscore.
No big deal, but tee avoids it :)

Please excuse that this wasn't on the fseg topic. SFTN.
--
Regards,
Bengt Richter




  reply	other threads:[~2022-10-26 13:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  6:52 bug#58606: Emacs next pgtk crashes when pasting to other app Andrew Tropin
2022-10-20 17:00 ` Joshua Branson via Bug reports for GNU Guix
2022-10-23 19:12   ` Joshua Branson via Bug reports for GNU Guix
2022-10-22 10:40 ` Declan Tsien
2022-11-16 15:34   ` Joshua Branson via Bug reports for GNU Guix
2022-12-01  8:56     ` Andrew Tropin
2022-12-01 16:56       ` Joshua Branson via Bug reports for GNU Guix
2022-10-25  4:45 ` Andrew Tropin
2022-10-25 14:27   ` Joshua Branson via Bug reports for GNU Guix
2022-10-26 13:37     ` bokr [this message]
2023-03-20 10:39 ` Andrew Tropin

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20221026133747.GA5784@LionPure \
    --to=bokr@bokr.com \
    --cc=58606@debbugs.gnu.org \
    --cc=andrew@trop.in \
    --cc=jbranso@dismail.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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