zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: fix a few problems of "_pids -m pattern"
@ 2015-08-19 13:39 Jun T.
  2015-08-19 14:59 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Jun T. @ 2015-08-19 13:39 UTC (permalink / raw)
  To: zsh-workers

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=()




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: fix a few problems of "_pids -m pattern"
  2015-08-19 13:39 PATCH: fix a few problems of "_pids -m pattern" Jun T.
@ 2015-08-19 14:59 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2015-08-19 14:59 UTC (permalink / raw)
  To: zsh-workers

On Aug 19, 10:39pm, Jun T. wrote:
}
} (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').

This seems fine to me.  "ex" is the word on the line, it's what should
be used to (as precisely as possible) match the process name in ps.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-19 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-19 13:39 PATCH: fix a few problems of "_pids -m pattern" Jun T.
2015-08-19 14:59 ` Bart Schaefer

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).