* eshell pipelines (Was: Re: Optimal emacs shell for coding)
[not found] ` <873al9upnn.fsf@tux.homenetwork>
@ 2008-08-13 12:21 ` David Hansen
2008-08-13 16:09 ` eshell pipelines Glenn Morris
0 siblings, 1 reply; 3+ messages in thread
From: David Hansen @ 2008-08-13 12:21 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1533 bytes --]
[For emacs-devel:
In gnu.emacs.help there is a discussion about some little eshell,
eshell/ls bug. Processes in a pipeline get a TTY for IO (via
`start-process'). Quite some programs behave different whether they
have a TTY or not.
The other thing is that eshell/ls does not output one file per line
when in a pipeline (as the usual GNU ls does).]
On Wed, 13 Aug 2008 13:21:00 +0200 Thierry Volpiatto wrote:
> 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))))
> `----
Try the attached patch. It
* Starts subprocesses in a (eshell) pipeline using a pipe and not a TTY
(this should also give some performance boost).
* Appends "-1" to eshell/ls if ls is called in a pipeline.
At the time it's feature freeze for Emacs so it will probably take some
time to make it in there. Cc: anyways, maybe some old timer can approve
the two lines.
David
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1676 bytes --]
*** em-ls.el.~1.33.~ 2008-06-07 20:14:50.000000000 +0200
--- em-ls.el 2008-08-13 14:05:43.000000000 +0200
***************
*** 299,304 ****
--- 299,306 ----
(let ((insert-func 'eshell-buffered-print)
(error-func 'eshell-error)
(flush-func 'eshell-flush))
+ ;; In pipelines use the -1 switch.
+ (and eshell-in-pipeline-p (push "-1" args))
(eshell-do-ls args)))
(put 'eshell/ls 'eshell-no-numeric-conversions t)
*** esh-proc.el.~1.21.~ 2008-05-12 20:30:41.000000000 +0200
--- esh-proc.el 2008-08-13 14:20:38.000000000 +0200
***************
*** 249,260 ****
proc decoding encoding changed)
(cond
((fboundp 'start-process)
! (setq proc
! (apply 'start-process
! (file-name-nondirectory command) nil
! ;; `start-process' can't deal with relative
! ;; filenames
! (append (list (expand-file-name command)) args)))
(eshell-record-process-object proc)
(set-process-buffer proc (current-buffer))
(if (eshell-interactive-output-p)
--- 249,262 ----
proc decoding encoding changed)
(cond
((fboundp 'start-process)
! ;; Don't use a TTY for processes in a pipeline.
! (let ((process-connection-type (not eshell-in-pipeline-p)))
! (setq proc
! (apply 'start-process
! (file-name-nondirectory command) nil
! ;; `start-process' can't deal with relative
! ;; filenames
! (append (list (expand-file-name command)) args))))
(eshell-record-process-object proc)
(set-process-buffer proc (current-buffer))
(if (eshell-interactive-output-p)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: eshell pipelines
2008-08-13 12:21 ` eshell pipelines (Was: Re: Optimal emacs shell for coding) David Hansen
@ 2008-08-13 16:09 ` Glenn Morris
2008-08-13 21:01 ` David Hansen
0 siblings, 1 reply; 3+ messages in thread
From: Glenn Morris @ 2008-08-13 16:09 UTC (permalink / raw)
To: emacs-devel
David Hansen wrote:
> [For emacs-devel:
>
> In gnu.emacs.help there is a discussion about some little eshell,
> eshell/ls bug.
http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=699
(now on three separate mailing lists...)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: eshell pipelines
2008-08-13 16:09 ` eshell pipelines Glenn Morris
@ 2008-08-13 21:01 ` David Hansen
0 siblings, 0 replies; 3+ messages in thread
From: David Hansen @ 2008-08-13 21:01 UTC (permalink / raw)
To: emacs-devel
On Wed, 13 Aug 2008 12:09:07 -0400 Glenn Morris wrote:
> David Hansen wrote:
>
>> [For emacs-devel:
>>
>> In gnu.emacs.help there is a discussion about some little eshell,
>> eshell/ls bug.
>
> http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=699
>
> (now on three separate mailing lists...)
I find gmane.emacs.bug incredible "hard" to read. Threads seem to
randomly stop and start again (w/o gnus finding the parents) and purely
administrative messages pop up every now and then.
Back to the topic: not giving the pipelined processes a TTY will
prevent similar problems w/ non eshell builtins. And in most cases it
should be faster as well, e.g. GNU libc uses line buffering on a TTY.
But probably we should first find a way to disable this for the last
command in the pipeline. This is already done in
`eshell-do-pipelines-synchronously' (do we really need compat code for
Emacsen w/o `start-process'?). I'll try to figure out how to do it
right.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-13 21:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.16366.1218454746.18990.help-gnu-emacs@gnu.org>
[not found] ` <577bf477-6877-4cab-b4c3-fb72b995a095@i20g2000prf.googlegroups.com>
[not found] ` <mailman.16375.1218468298.18990.help-gnu-emacs@gnu.org>
[not found] ` <66bf7b7c-8e2b-4266-812a-6531c93f9399@v1g2000pra.googlegroups.com>
[not found] ` <mailman.16385.1218473260.18990.help-gnu-emacs@gnu.org>
[not found] ` <87skta4py4.fsf@lion.rapttech.com.au>
[not found] ` <48A17CAA.2060505@gmail.com>
[not found] ` <uljz2gk2q.fsf@gnu.org>
[not found] ` <48A1D923.1030001@gmail.com>
[not found] ` <ufxpagj6c.fsf@gnu.org>
[not found] ` <48A1DE3D.7070704@gmail.com>
[not found] ` <mailman.16490.1218568567.18990.help-gnu-emacs@gnu.org>
[not found] ` <87k5el497r.fsf@lion.rapttech.com.au>
[not found] ` <873al9upnn.fsf@tux.homenetwork>
2008-08-13 12:21 ` eshell pipelines (Was: Re: Optimal emacs shell for coding) David Hansen
2008-08-13 16:09 ` eshell pipelines Glenn Morris
2008-08-13 21:01 ` David Hansen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).