GNU bug report logs - #41788
28.0.50; emacsclient -t doesn't work with vipe from moreutils

Previous Next

Package: emacs;

Reported by: Platon Pronko <platon7pronko <at> gmail.com>

Date: Wed, 10 Jun 2020 13:20:01 UTC

Severity: normal

Found in version 28.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 41788 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Platon Pronko <platon7pronko <at> gmail.com>, 41788 <at> debbugs.gnu.org
Subject: Re: bug#41788: 28.0.50; emacsclient -t doesn't work with vipe from
 moreutils
Date: Mon, 06 Jun 2022 16:49:38 +0200
Andreas Schwab <schwab <at> 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




This bug report was last modified 2 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.