bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26654: 26.0.50; Request to add an option to make emacs not care if i


From: Kaushal Modi
Subject: bug#26654: 26.0.50; Request to add an option to make emacs not care if input is not coming from tty
Date: Wed, 26 Apr 2017 17:08:24 +0000

On Wed, Apr 26, 2017 at 6:13 AM Eli Zaretskii <address@hidden> wrote:

Then why not do something like below instead?

  echo "foo" && emacs -Q -nw

Well, my example was too simplified; I do care that "foo" gets into the emacs buffer, just not "how". At the moment emacs does not accept input from STDIN in non-batch mode. So I use a wrapper script ( https://raw.githubusercontent.com/kaushalmodi/eless/master/eless ) to save the STDIN into a temp file and then open that temp file in emacs. 
 
IOW, I don't understand what is the significance of the pipe in this
command.

The "man grep" is the best example.. I cannot control how man calls the $PAGER. If I set $PAGER as eless, man eventually does something like "blah blah | $PAGER".

The common use cases for eless are as follows:

    eless foo.txt                  # Open foo.txt in eless in terminal (-nw) mode by default.
    eless foo.txt -gui             # Open foo.txt in eless in GUI mode.
    echo 'foo' | eless             #
    echo 'foo' | eless -           # Same as above. The hyphen after eless does not matter; is anyways discarded.
    grep 'bar' foo.txt | eless     #
    PAGER=eless man grep           # Launches man pages in eless (terminal mode), if the environment variable PAGER is set to eless.
    PAGER=eless man grep -gui      # Launches man pages in eless (GUI mode), if the environment variable PAGER is set to eless.
    diff foo bar | eless           # Colored diff!
    eless .                        # Open dired in the current directory (enhanced 'ls')
    eless -h | eless               # See eless help ;-) 

> I have noticed that emacsclient does not care if input is not coming from tty.

The client doesn't interact with the user, it only instructs the
server to visit the file.  Emacs, OTOH, does need to interact.

That's alright, at the minimum it would be nice to have emacs not error out if it detects input coming from STDIN.. it does not have to worry, the bash script will take care of that (The best case if ofcourse if emacs can read in STDIN in non-batch mode too). 

For now, we use a workaround in eless that always starts emacs in a new sub-shell and that way the sub-shelled emacs always "thinks" that it not receiving anything from the stdin. But would like to get away from this limitation.

--

Kaushal Modi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]