all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Platon Pronko <platon7pronko@gmail.com>, 41788@debbugs.gnu.org
Subject: bug#41788: 28.0.50; emacsclient -t doesn't work with vipe from moreutils
Date: Mon, 06 Jun 2022 16:49:38 +0200	[thread overview]
Message-ID: <87leu9sv7h.fsf@gnus.org> (raw)
In-Reply-To: <87r141hmww.fsf@igel.home> (Andreas Schwab's message of "Mon, 06 Jun 2022 16:44:15 +0200")

Andreas Schwab <schwab@linux-m68k.org> writes:

> It's not emacsclient that is complaining, it just displays the error
> raised by emacs.  But it is hard to guess what's going on without
> knowing the exact command line.

/usr/bin/vipe is just a Perl script, so it's easy to hack.  Let's see...
it just calls:

emacsclient -t /tmp/KtLHpMIm4T

I've included the entire vipe script below.

#!/usr/bin/perl

use warnings;
use strict;
use File::Temp q{tempfile};
use Getopt::Long;

$/=undef;

my $suffix = "";
if (! GetOptions("suffix=s" => \$suffix)) {
	die "Usage: $0 [--suffix=extension]\n";
}
$suffix = ".$suffix" if $suffix =~ m/^[^.]/;

my ($fh, $tmp)=tempfile(UNLINK => 1, SUFFIX => $suffix);
die "cannot create tempfile" unless $fh;
if (! -t STDIN) {
	print ($fh <STDIN>) || die "write temp: $!";
}
close $fh;
close STDIN;
open(STDIN, "</dev/tty") || die "reopen stdin: $!";
open(OUT, ">&STDOUT") || die "save stdout: $!";
close STDOUT;
open(STDOUT, ">/dev/tty") || die "reopen stdout: $!";

my @editor="vi";
if (-x "/usr/bin/editor") {
	@editor="/usr/bin/editor";
}
if (exists $ENV{EDITOR}) {
	@editor=split(' ', $ENV{EDITOR});
}
if (exists $ENV{VISUAL}) {
	@editor=split(' ', $ENV{VISUAL});
}
my $ret=system(@editor, $tmp);
if ($ret != 0) {
	die "@editor exited nonzero, aborting\n";
}

open (IN, $tmp) || die "$0: cannot read $tmp: $!\n";
print (OUT <IN>) || die "write failure: $!";
close IN;


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2022-06-06 14:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10 13:19 bug#41788: 28.0.50; emacsclient -t doesn't work with vipe from moreutils Platon Pronko
2022-06-06 14:00 ` Lars Ingebrigtsen
2022-06-06 14:44   ` Andreas Schwab
2022-06-06 14:49     ` Lars Ingebrigtsen [this message]
2022-06-06 16:25       ` Andreas Schwab
2022-06-06 17:03         ` Eli Zaretskii
2022-06-06 17:43           ` Andreas Schwab
2022-06-14  4:38             ` Platon Pronko
2022-06-14 11:26               ` Eli Zaretskii
2022-06-06 17:07         ` Lars Ingebrigtsen
2022-06-06 17:40           ` Andreas Schwab

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

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

  git send-email \
    --in-reply-to=87leu9sv7h.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=41788@debbugs.gnu.org \
    --cc=platon7pronko@gmail.com \
    --cc=schwab@linux-m68k.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.
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.