From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2928 invoked by alias); 19 Aug 2015 13:39:19 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36243 Received: (qmail 19827 invoked from network); 19 Aug 2015 13:39:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Biglobe-Sender: From: "Jun T." Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: PATCH: fix a few problems of "_pids -m pattern" Message-Id: <2C7B5A5B-EF10-4474-94A7-34BF531D2D28@kba.biglobe.ne.jp> Date: Wed, 19 Aug 2015 22:39:08 +0900 To: zsh-workers@zsh.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) X-Biglobe-Spnum: 60758 I noticed that, on Mac OS X, % gdb /path/to/zsh completes only core files, not PIDs of currently running zsh. The following patch takes account of (1) the numeric PID may be at the beginning of the line without any preceding white spaces, (2) the command name may be preceded by a '-' if it is a login shell (i.e., '-zsh'). (3) The patch also replaces the '${2}*' by '${2}([[:blank:]]*|)' so that, for example, % gdb /path/to/ex does not completes the PIDs of running 'expect' (or 'expand'). If a user really need all the PIDs of ex, expect, expand, ... then he/she can use '_pids -m "ex*"' instead of '_pids -m ex'. Is this OK? diff --git a/Completion/Unix/Type/_pids b/Completion/Unix/Type/_pids index dd8ef44..8edb335 100644 --- a/Completion/Unix/Type/_pids +++ b/Completion/Unix/Type/_pids @@ -9,7 +9,7 @@ _tags processes || return 1 =20 if [[ "$1" =3D -m ]]; then all=3D() - = match=3D"*[[:blank:]]${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*[/[:blank:]]${2}*= " + = match=3D"(*[[:blank:]]|)${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*(/|[[:blank:]]= -(#c,1))${2}([[:blank:]]*|)" shift 2 elif [[ "$PREFIX$SUFFIX" =3D ([%-]*|[0-9]#) ]]; then all=3D()