Skip to content

Commit

Permalink
the check for being in emacs to be more like bash (#28)
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroo HAYASHI <[email protected]>
  • Loading branch information
hirooih committed Dec 30, 2024
1 parent 0ef528c commit 2619a68
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Gnu.pm
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,15 @@ BEGIN {
$ENV{TERM} = 'dumb' unless defined($ENV{TERM});

# Use Term::ReadLine::Stub in Emacs
# as bash does not do line-editing in the case. (cf. bash-5.2/shell.c)
# as bash does not do line-editing in the case.
# https://rt.cpan.org/Ticket/Display.html?id=123398
# https://github.com/hirooih/perl-trg/issues/11
if ($ENV{TERM} eq "emacs" || defined($ENV{EMACS}) || defined($ENV{INSIDE_EMACS})) {
# https://github.com/hirooih/perl-trg/issues/28
# https://git.savannah.gnu.org/cgit/bash.git/tree/shell.c#n595
my $in_emacs = defined($ENV{INSIDE_EMACS})
|| (defined($ENV{EMACS})
&& ($ENV{EMACS} =~ / \(term:/ || $ENV{EMACS} eq "t"));
if ($ENV{TERM} eq "emacs" || $in_emacs && $ENV{TERM} eq "dumb") {
croak "Use Term::ReadLine::Stub.";
}
}
Expand Down

0 comments on commit 2619a68

Please sign in to comment.