zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: PATCH: fix a few problems of "_pids -m pattern"
Date: Wed, 19 Aug 2015 22:39:08 +0900	[thread overview]
Message-ID: <2C7B5A5B-EF10-4474-94A7-34BF531D2D28@kba.biglobe.ne.jp> (raw)

I noticed that, on Mac OS X,

% gdb /path/to/zsh <TAB>

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 <TAB>

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
 
 if [[ "$1" = -m ]]; then
   all=()
-  match="*[[:blank:]]${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*[/[:blank:]]${2}*"
+  match="(*[[:blank:]]|)${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*(/|[[:blank:]]-(#c,1))${2}([[:blank:]]*|)"
   shift 2
 elif [[ "$PREFIX$SUFFIX" = ([%-]*|[0-9]#) ]]; then
   all=()




             reply	other threads:[~2015-08-19 13:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19 13:39 Jun T. [this message]
2015-08-19 14:59 ` Bart Schaefer

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=2C7B5A5B-EF10-4474-94A7-34BF531D2D28@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.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 public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).