From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19298 invoked by alias); 22 Aug 2017 16:04:26 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22849 Received: (qmail 27344 invoked by uid 1010); 22 Aug 2017 16:04:26 -0000 X-Qmail-Scanner-Diagnostics: from nm8-vm1.bullet.mail.ir2.yahoo.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(212.82.96.135):SA:0(-4.7/5.0):. Processed in 2.851925 secs); 22 Aug 2017 16:04:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1503417483; bh=IYTxhqhEMY+Wl/xuLtqqDr24n+4yB3upxnNp1D/glEQ=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=SBJqVZsoYdD/52AX0PhLUmxi/8MrDRLkyv7x3Yo1/iUfxx/AKtrAekCHJEOBVf0g7/TSsnsfYfbJ1msYYp8REF5Y4HV3NK9mObWv5KWgNrvtpqqMxAyO5tCvQDnmKKzemnsHykonrTXnTgUvDpE4Zvh6B46eZ7kfCBHpfM/5+DIPKQroerAs/t50F06lqWAhE6ea0Ih2HdS/ITu25ltHm9CaU62Cx4cTsbM4Ba/0jwzdjGsbQDwodszAw3dt4dCf/O8p7B+ssirIzGoK/7Rbc0di13XezTPFQtn52YYC++5sqKq3mNow2ybk4Ne73zltANooNPDyt7xHkmsXKwDvrg== X-Yahoo-Newman-Id: 582901.3162.bm@smtp113.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: u2JQOm4VM1nFUExcv5.OdjZDPvFjdhr6IibYi.r7hTWRPJ4 FU4DkvAa4A4m67gTrH2lpfCIwoeL9wNYgcNJdmIH_64nggKYGEwRrsT_Hus5 IJNUi.cBTkoA6fiFbekZ3bJTWOLAIFvhhsC6I0zYVGKDq2_0GM9AAR_xiBgc .zVnh9bjxxUEo587mJroStD_FItDSqOL6rJPqO62ObIpgxCSVchgEPyHP4yd Vj2ArV.v8my1t2qH3YsbhSLY0p9r8VkOuMpcH0XjLyWZ4IEL31dn4VM5WwwG hTgLk2qA23rPtMeZwAETrrAsiNJ6egZomW1y0jPKiBORELkeJpug4TxjHTxw wNcmVOvzn1P1EBnnKJKYzqh731HMG6thbzIVyEPhbX6KxXTkWEJvdiPj6vi3 53RHT9no7RgHuPkOLuz3f81n6Iag8iKlxDb3ul4jLlomBtNFGbR08heBfY24 ktxZr6SDlz_OHxVVukugULFXdcC7OlRgb4AB.1wNm2ZFiYw-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: zsh-users@zsh.org In-reply-to: <20170822111229.GA28217@localhost> From: Oliver Kiddle References: <20170822111229.GA28217@localhost> To: Oliver Schmidhauser Subject: Re: _mpc breaks when folder contains spaces MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29907.1503417477.1@thecus.kiddle.eu> Date: Tue, 22 Aug 2017 17:57:57 +0200 Message-ID: <29908.1503417477@thecus.kiddle.eu> Oliver Schmidhauser wrote: > > I have a problem with mpc and the completion function. > mpc add Electronic/Laserkraft\ 3D/mpd error: No such directory > I've attached a .patch for _mpc which fixes this issue, as in it > replaced `\ ` with ` ` before it is being passed to `mpc tab`. This > probably doesn't fix the root of the issue, why `$word[CURRENT]` > contains "Electronic/Laserkraft\ 3D" instead of "Electronic/Laserkraft > 3D". It probably also breaks when a folder actually contains `\ `. It looks like you forgot to include the attachment. Does it resemble the following patch? I believe it is the correct fix. > The second issue I have is `mpc tab` outputing errors while I am > trying to autocomplete, breaking the current prompt so that I have to > `Ctrl+C` and restart. I'll take a look at that and post a patch to -workers later. The mpc function should be using _call_program in the many places when calling out to mpc. That takes care of redirecting stderr among other things. Oliver diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc index e0c6888b0..d4073c3cd 100644 --- a/Completion/Unix/Command/_mpc +++ b/Completion/Unix/Command/_mpc @@ -147,7 +147,7 @@ _mpc_helper_files() { list=( ${${(f)"$(mpc listall)"}%%/*}) _wanted files expl file compadd -qS/ -a list else - list=(${(f)"$(mpc tab $words[CURRENT])"}) + list=(${(f)"$(mpc tab ${(Q)words[CURRENT]})"}) _wanted files expl file _multi_parts / list fi }