From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Optimal emacs shell for coding
Date: Wed, 13 Aug 2008 13:21:00 +0200 [thread overview]
Message-ID: <873al9upnn.fsf@tux.homenetwork> (raw)
In-Reply-To: <87k5el497r.fsf@lion.rapttech.com.au> (Tim X.'s message of "Wed, 13 Aug 2008 18:20:40 +1000")
Tim X <timx@nospam.dev.null> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> Date: Tue, 12 Aug 2008 21:02:21 +0200
>>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
>>> CC: help-gnu-emacs@gnu.org
>>>
>>> Eli Zaretskii wrote:
>>> >> Date: Tue, 12 Aug 2008 20:40:35 +0200
>>> >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
>>> >> CC: help-gnu-emacs@gnu.org
>>> >>
>>> >> Eli Zaretskii wrote:
>>> >>>> Date: Tue, 12 Aug 2008 14:06:02 +0200
>>> >>>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
>>> >>>> CC: help-gnu-emacs@gnu.org
>>> >>>>
>>> >>>> If you look carefully at the output you can see that what is not handled
>>> >>>> is the parameters to "ls". If you try "ls -1" it will work.
>>> >>> What "parameters to ls"? "ls" was invoked without any parameters.
>>> >> If you from a shell do
>>> >>
>>> >> ls | grep
>>> >>
>>> >> then normally ls implicitly gets the -1 parameter
>>> >
>>> > No, it doesn't. Please try and see for yourself (I just did).
>>>
>>>
>>> We are miscommunicating.
>>
>> Maybe you are; I am not ;-)
>>
>>> I am saying that if I from a shell outside of Emacs do
>>>
>>> ls
>>>
>>> than I get several files listed on each row while the output from
>>>
>>> ls | grep some-file
>>>
>>> implies that ls got the implicit argument -1 when used in the pipe.
>>
>> And I'm saying that you are wrong: -1 is not implied in a pipeline
>> from the shell prompt, either. Please try that and see for yourself.
>> I tried that both on GNU/Linux and in a Windows command prompt window,
>> and GNU `ls' does not imply -1 in either case.
>>
> Exactly. An you can do another test. Just do
>
> ls | less
>
> all the files are on one line each. this is standard behavior for ls if
> you pipe or redirect it away from a tty. It only formats multi-column
> output if the output device is a tty, unless you provide the switch to
> force single column output. Note also that usually, the number of
> columns is a function of the longest filename and the display width. The
> concept of 'width' has no meaning with respect to stdout or when
> redirecting via | or > etc.
>
> Note that this is 'normal' behavior - if programs output multiple items
> per line, it would screw up programs that you pipe into.
>
> Tim
Sorry, i insert again this reply here, i think i did a mistake and reply
on another topic.
As Lennart said you call ls with -1 arg or you can always call ls with
this arg setting it like that:
,----
| (setq eshell-ls-initial-args '(-1))
`----
now when you call for example "ls | wc -l" , you will have the
good number of lines.
It would be cool to have a function to call in some hook to call ls -1
only if there is a "|" after ls, this function do that but i need a hook
to call it:
,----
| (defun eshell-set-ls ()
| (let ((com-line
| (eshell-parse-arguments (re-search-backward "ls") (line-end-position))))
| (if (equal (nth 1 com-line) '(eshell-operator "|"))
| (setq eshell-ls-initial-args '(-1))
| (setq eshell-ls-initial-args nil))))
`----
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France
next prev parent reply other threads:[~2008-08-13 11:21 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.16366.1218454746.18990.help-gnu-emacs@gnu.org>
2008-08-11 13:30 ` Optimal emacs shell for coding Xah
2008-08-11 15:24 ` Lennart Borgman (gmail)
[not found] ` <mailman.16375.1218468298.18990.help-gnu-emacs@gnu.org>
2008-08-11 15:49 ` Xah
2008-08-11 16:47 ` Lennart Borgman (gmail)
[not found] ` <mailman.16385.1218473260.18990.help-gnu-emacs@gnu.org>
2008-08-12 8:06 ` Tim X
2008-08-12 12:06 ` Lennart Borgman (gmail)
2008-08-12 18:33 ` Eli Zaretskii
2008-08-12 18:40 ` Lennart Borgman (gmail)
2008-08-12 18:52 ` Eli Zaretskii
2008-08-12 19:02 ` Lennart Borgman (gmail)
2008-08-12 19:11 ` ken
2008-08-12 19:28 ` Lennart Borgman (gmail)
2008-08-12 19:16 ` Eli Zaretskii
[not found] ` <mailman.16490.1218568567.18990.help-gnu-emacs@gnu.org>
2008-08-13 1:01 ` Chris F.A. Johnson
2008-08-13 8:20 ` Tim X
2008-08-13 11:21 ` Thierry Volpiatto [this message]
2008-08-13 12:21 ` eshell pipelines (Was: Re: Optimal emacs shell for coding) David Hansen
2008-08-13 13:15 ` eshell pipelines Thierry Volpiatto
2008-08-13 16:09 ` Glenn Morris
2008-08-13 21:01 ` David Hansen
2008-08-12 18:30 ` Optimal emacs shell for coding Eli Zaretskii
2008-08-12 19:14 ` David Hansen
[not found] ` <mailman.16492.1218569015.18990.help-gnu-emacs@gnu.org>
2008-08-12 20:08 ` Rupert Swarbrick
2008-08-11 19:18 ` Eli Zaretskii
2008-08-12 8:02 ` Tim X
2008-08-15 9:38 ` M-x terminal-emulator vs M-x term (was: Re: Optimal emacs shell for coding) Jonathan Groll
2008-08-11 13:40 ` Optimal emacs shell for coding Mike Treseler
2008-08-11 16:44 ` weber
2008-08-12 6:33 ` Mike Treseler
2008-08-11 11:38 Jonathan Groll
2008-08-11 12:05 ` Peter Dyballa
2008-08-11 15:06 ` Thien-Thi Nguyen
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=873al9upnn.fsf@tux.homenetwork \
--to=thierry.volpiatto@gmail.com \
--cc=help-gnu-emacs@gnu.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.