From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: eshell pipelines Date: Wed, 13 Aug 2008 15:15:29 +0200 Message-ID: <87iqu5jbta.fsf@tux.homenetwork> References: <577bf477-6877-4cab-b4c3-fb72b995a095@i20g2000prf.googlegroups.com> <66bf7b7c-8e2b-4266-812a-6531c93f9399@v1g2000pra.googlegroups.com> <87skta4py4.fsf@lion.rapttech.com.au> <48A17CAA.2060505@gmail.com> <48A1D923.1030001@gmail.com> <48A1DE3D.7070704@gmail.com> <87k5el497r.fsf@lion.rapttech.com.au> <873al9upnn.fsf@tux.homenetwork> <87abfhhzq4.fsf_-_@localhorst.mine.nu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1218633628 31539 80.91.229.12 (13 Aug 2008 13:20:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2008 13:20:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 13 15:21:20 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KTGHY-0005aT-6N for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Aug 2008 15:20:56 +0200 Original-Received: from localhost ([127.0.0.1]:34018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTGGb-0000OB-7y for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Aug 2008 09:19:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTGFD-000875-A0 for help-gnu-emacs@gnu.org; Wed, 13 Aug 2008 09:18:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTGFC-00086N-7M for help-gnu-emacs@gnu.org; Wed, 13 Aug 2008 09:18:30 -0400 Original-Received: from [199.232.76.173] (port=43651 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTGFB-000862-VG for help-gnu-emacs@gnu.org; Wed, 13 Aug 2008 09:18:29 -0400 Original-Received: from nf-out-0910.google.com ([64.233.182.187]:18153) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KTGFB-00010k-SF for help-gnu-emacs@gnu.org; Wed, 13 Aug 2008 09:18:30 -0400 Original-Received: by nf-out-0910.google.com with SMTP id c7so1164951nfi.26 for ; Wed, 13 Aug 2008 06:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=TCam4USPe+UCm44gJweEvr5uVNBNGYyNU4cO1sW5mTo=; b=ASPtDhKjlUyJBhHtYGI3p+kl0Y9i5FRLj2DQQQ7L4WJeoBMMm3qwyoisedne5kODUd wKAxVJwEFhYNwT5EnDFZKlwTfQF4OeqcJ/SI9fsvInMwPn6qbF1KNimog2AfbE0EBMxz dIbLJNfH3FCPiENeVmGsXPlk1hAeBxT26eJeE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; b=FWezdsDe9LQn3RjkyT4Z2uuQXF4awR3TdYjPmR/0RRnNYJl1XDpwgcZyFdqAiB+QZo sLUMlI6W9ciaxlsxisD3j5WFxcP3rPq/dLHyqniuaGWe82Gw8IDgGRNll8L4TIJcef9B 6MBEA/mj8ciB6YhxwEQhFbtmyyXaAL/8WfTeI= Original-Received: by 10.210.71.12 with SMTP id t12mr11903768eba.36.1218633508310; Wed, 13 Aug 2008 06:18:28 -0700 (PDT) Original-Received: from tux.homenetwork ( [77.197.77.211]) by mx.google.com with ESMTPS id b33sm333843ika.2.2008.08.13.06.18.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 13 Aug 2008 06:18:27 -0700 (PDT) In-Reply-To: <87abfhhzq4.fsf_-_@localhorst.mine.nu> (David Hansen's message of "Wed, 13 Aug 2008 14:21:55 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56558 Archived-At: David Hansen writes: > [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. After some quick tests that work fine. Thank you. > > *** 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) -- A + Thierry Volpiatto Location: Saint-Cyr-Sur-Mer - France