zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug#99095: Process completion for gdb
       [not found]       ` <20010530204009.C3810@alcor.net>
@ 2001-05-31 14:07         ` Clint Adams
  2001-05-31 15:26           ` Sven Wischnowsky
  0 siblings, 1 reply; 5+ messages in thread
From: Clint Adams @ 2001-05-31 14:07 UTC (permalink / raw)
  To: zsh-workers; +Cc: Matt Zimmerman, 99095-forwarded

> This works for me.  In fact, I've set:
> 
> zstyle ':completion:*:complete:*:*:processes' command 'ps ux'
> 
> Since this is usually what I want (and the information from 'ps u' makes it
> easier to find the desired process)
> 
> For gdb specifically, this isn't as useful as it might be.  Since filenames are
> completed as well, the process list will often scroll off the screen when run
> from a directory full of source code and object files.  Maybe the filename
> match should be restricted to '{,*.}core'?

We could do this to _gdb

50c50
<     _alternative 'files:: _files' "processes:: _pids -m ${w[1]:t}"
---
>     _alternative "core-files:: _files -g '*core'" 'files:: _files' "processes:: _pids -m ${w[1]:t}"

and then you could set zstyle ':completion:*:complete:gdb:*' tag-order 'processes core-files'

What do people think?

> Or perhaps to have some portable and extensible mechanism for selecting
> processes.  I would say that at least these should be supported:
> 
> - All of a user's processes (ps x, ps -u user), for most uses
> - All of everyone's processes (ps ax, ps -e), for root
> - Some formatting options (ps u, ps -f) for more verbosity

The problem is accurately determining whether ps is SYSV- or BSD-style or
something else entirely.


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

* Re: Bug#99095: Process completion for gdb
  2001-05-31 14:07         ` Bug#99095: Process completion for gdb Clint Adams
@ 2001-05-31 15:26           ` Sven Wischnowsky
  2001-05-31 17:58             ` Clint Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2001-05-31 15:26 UTC (permalink / raw)
  To: zsh-workers

Clint Adams wrote:

> ...
> 
> We could do this to _gdb
> 
> 50c50
> <     _alternative 'files:: _files' "processes:: _pids -m ${w[1]:t}"
> ---
> >     _alternative "core-files:: _files -g '*core'" 'files:: _files' "processes:: _pids -m ${w[1]:t}"
> 
> and then you could set zstyle ':completion:*:complete:gdb:*' tag-order 'processes core-files'
> 
> What do people think?

I thought about something like that when I wrote _gdb.  The problem is
if there is no file matching *core.  Then the first would complete all
files (or directories), too.  And since they may be in different groups,
they would be shown twice.

Obviously, I didn't find a solution...

> > Or perhaps to have some portable and extensible mechanism for selecting
> > processes.  I would say that at least these should be supported:
> > 
> > - All of a user's processes (ps x, ps -u user), for most uses
> > - All of everyone's processes (ps ax, ps -e), for root
> > - Some formatting options (ps u, ps -f) for more verbosity
> 
> The problem is accurately determining whether ps is SYSV- or BSD-style or
> something else entirely.

Indeed.


Bye
  Sven


-- 
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: Bug#99095: Process completion for gdb
  2001-05-31 15:26           ` Sven Wischnowsky
@ 2001-05-31 17:58             ` Clint Adams
  2001-06-01  7:30               ` Sven Wischnowsky
  0 siblings, 1 reply; 5+ messages in thread
From: Clint Adams @ 2001-05-31 17:58 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-workers, 99095

> I thought about something like that when I wrote _gdb.  The problem is
> if there is no file matching *core.  Then the first would complete all
> files (or directories), too.  And since they may be in different groups,
> they would be shown twice.
> 
> Obviously, I didn't find a solution...

One could rely on the output of file(1), but that's ridiculously expensive.
Why not an option to _path_files that doesn't add any matches if the
pattern is not met?


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

* Re: Bug#99095: Process completion for gdb
  2001-05-31 17:58             ` Clint Adams
@ 2001-06-01  7:30               ` Sven Wischnowsky
  2001-06-01 12:13                 ` PATCH: gdb corefile completion [was Re: Bug#99095: Process completion for gdb] Clint Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2001-06-01  7:30 UTC (permalink / raw)
  To: zsh-workers

Clint Adams wrote:

> > I thought about something like that when I wrote _gdb.  The problem is
> > if there is no file matching *core.  Then the first would complete all
> > files (or directories), too.  And since they may be in different groups,
> > they would be shown twice.
> > 
> > Obviously, I didn't find a solution...
> 
> One could rely on the output of file(1), but that's ridiculously expensive.
> Why not an option to _path_files that doesn't add any matches if the
> pattern is not met?

That's what _path_files always does, only _files will re-try with
directories and all files.

_gdb is rather old and because we've added all that tag-order and
file-patterns stuff in the meantime, I would almost suggest to just use
the `_files -g "*core"' you suggested.  Users can then always use the
two styles to change that if they want (we could add a comment to _gdb
about that, asking users to tell us why they need it -- if the way their
systems handle core dumps is the reason for it).  Of course, they can
now use the file-patterns style to change it to use that pattern, too.

As I said, I had thought about these things when I wrote _gdb, I just
wasn't sure if `*core' is a good enough pattern for all systems.  And I
probably didn't ask back then.

So, I would be happy if you choose to change the call to _files, and
since noone complained that that would break core file completion on
their system...


Bye
  Sven


-- 
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* PATCH: gdb corefile completion [was Re: Bug#99095: Process completion for gdb]
  2001-06-01  7:30               ` Sven Wischnowsky
@ 2001-06-01 12:13                 ` Clint Adams
  0 siblings, 0 replies; 5+ messages in thread
From: Clint Adams @ 2001-06-01 12:13 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-workers

> So, I would be happy if you choose to change the call to _files, and
> since noone complained that that would break core file completion on
> their system...

Well, here it is.

Index: Completion/Unix/Command/_gdb
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_gdb,v
retrieving revision 1.1
diff -u -r1.1 _gdb
--- Completion/Unix/Command/_gdb	2001/04/02 11:51:19	1.1
+++ Completion/Unix/Command/_gdb	2001/06/01 12:11:27
@@ -47,7 +47,7 @@
   done
 
   if [[ $#w -gt 1 ]]; then
-    _alternative 'files:: _files' "processes:: _pids -m ${w[1]:t}"
+    _alternative "files:: _files -g '*core'" "processes:: _pids -m ${w[1]:t}"
   else
     _description files expl executable
     _files "$expl[@]" -g '*(-*)'


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

end of thread, other threads:[~2001-06-01 12:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010528201016.A16176@alcor.net>
     [not found] ` <20010529104252.B403@dman.com>
     [not found]   ` <20010529134715.R27012@alcor.net>
     [not found]     ` <20010530104751.A28439@dman.com>
     [not found]       ` <20010530204009.C3810@alcor.net>
2001-05-31 14:07         ` Bug#99095: Process completion for gdb Clint Adams
2001-05-31 15:26           ` Sven Wischnowsky
2001-05-31 17:58             ` Clint Adams
2001-06-01  7:30               ` Sven Wischnowsky
2001-06-01 12:13                 ` PATCH: gdb corefile completion [was Re: Bug#99095: Process completion for gdb] Clint Adams

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