zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: _a2ps completion
@ 2000-01-19 16:16 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 2000-01-19 16:16 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> ...
> 
> Preferably it should allow you to specify the tag you want altered,
> i.e. you may want to alter just globbed-files, leaving all-files doing its
> thing, or for special effects you might want all-files not to live up to
> its name (e.g., I want to get rm to complete discardable files like *.o by
> default (globbed-files), otherwise anything else (all-files), but I've
> decide I never want it to complete vmlinuz). In which case, I suppose
> `file-pattern' is the better name, since it can apply to all *files tags.
> You could argue it should be `selected-files' to go with `ignored-files',
> but I don't think they're really similar enough for that.

This adds the file-patterns style. It can be used to override
glob-patterns used by completion functions and -- if the function uses 
_files -- to make it use the globbed-files and directories tags even
if the calling function doesn't say so.

I can only hope that the manual is clear enough.

> I suppose I'm going to have to include Clint's patch in 9333.

Yep.

Bye
 Sven

diff -ru ../z.old/Completion/Core/_files Completion/Core/_files
--- ../z.old/Completion/Core/_files	Wed Jan 19 10:07:55 2000
+++ Completion/Core/_files	Wed Jan 19 16:53:13 2000
@@ -1,16 +1,19 @@
 #autoload
 
-local opts opt type=file glob group
+local opts opt type=file glob group gopts dopts aopts tmp _file_pat_checked=yes
 
 opts=()
 group=()
+gopts=()
+dopts=(-/)
+aopts=(-f)
 while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:12n" opt; do
   case "$opt" in
-  /)      type="${type}dir"                   ;;
-  g)      type="${type}glob"; glob="$OPTARG"  ;;
-  [qn12]) opts=("$opts[@]" "-$opt"          ) ;;
-  [JV])   group=(          "-$opt" "$OPTARG") ;;
-  [^f])   opts=("$opts[@]" "-$opt" "$OPTARG") ;;
+  /)      type="${type}dir"                        ;;
+  g)      type="${type}glob"; gopts=(-g "$OPTARG") ;;
+  [qn12]) opts=("$opts[@]" "-$opt"          )      ;;
+  [JV])   group=(          "-$opt" "$OPTARG")      ;;
+  [^f])   opts=("$opts[@]" "-$opt" "$OPTARG")      ;;
   esac
 done
 
@@ -19,11 +22,37 @@
   group=()
 fi
 
+if zstyle -s ":completion${curcontext}:all-files" file-patterns tmp &&
+   [[ -n "$tmp" ]]; then
+  aopts=(-g "$tmp")
+fi
+if zstyle -s ":completion${curcontext}:directories" file-patterns tmp &&
+   [[ -n "$tmp" ]]; then
+  dopts=(-g "$tmp")
+  if [[ "$type" = (*dir*glob*|*glob*dir*) ]]; then
+    type=glob
+  elif [[ "$type" != *(dir|glob)* ]]; then
+    type="${type}dir"
+  fi
+fi
+if zstyle -s ":completion${curcontext}:globbed-files" file-patterns tmp &&
+   [[ -n "$tmp" ]]; then
+  gopts=(-g "$tmp")
+  if [[ "$type" != (*dir*glob*|*glob*dir*) ]]; then
+    if [[ "$type" = *(dir|glob)* ]]; then
+      type=glob
+    else
+      type=globall
+    fi
+  fi
+fi
+
 case "$type" in
-*dir*glob*|*glob*dir) _tags globbed-files all-files             ;;
-*glob*)               _tags globbed-files directories all-files ;;
-*dir*)                _tags directories all-files               ;;
-*)                    _tags all-files                           ;;
+*dir*glob*|*glob*dir*) _tags globbed-files all-files             ;;
+*all*glob*|*glob*all*) _tags globbed-files all-files             ;;
+*glob*)                _tags globbed-files directories all-files ;;
+*dir*)                 _tags directories all-files               ;;
+*)                     _tags all-files                           ;;
 esac
 
 while _tags; do
@@ -32,7 +61,7 @@
       group[2]=all-files
       _setup all-files
     fi
-    _path_files "$opts[@]" -f
+    _path_files "$opts[@]" "$aopts[@]"
     return
   elif _requested directories; then
     if _requested globbed-files; then
@@ -40,13 +69,13 @@
         group[2]=globbed-files
 	_setup globbed-files
       fi
-      _path_files "$opts[@]" -/g "$glob" && return 0
+      _path_files "$opts[@]" "$dopts[@]" "$gopts[@]" && return 0
     else
       if (( $#group )); then
         group[2]=directories
 	_setup directories
       fi
-      _path_files "$opts[@]" -/ && return 0
+      _path_files "$opts[@]" "$dopts[@]" && return 0
     fi
   elif _requested globbed-files; then
     if (( $#group )); then
@@ -54,9 +83,9 @@
       _setup globbed-files
     fi
     if [[ "$type" = (*dir*glob*|*glob*dir*) ]]; then
-      _path_files "$opts[@]" -/g "$glob" && return 0
+      _path_files "$opts[@]" "$dopts[@]" "$gopts[@]" && return 0
     else
-      _path_files "$opts[@]" -g "$glob" && return 0
+      _path_files "$opts[@]" "$gopts[@]" && return 0
     fi
   fi
 done
diff -ru ../z.old/Completion/Core/_path_files Completion/Core/_path_files
--- ../z.old/Completion/Core/_path_files	Wed Jan 19 10:07:56 2000
+++ Completion/Core/_path_files	Wed Jan 19 10:35:04 2000
@@ -81,6 +81,20 @@
   esac
 done
 
+if [[ -z "$_file_pat_checked" ]] &&
+   zstyle -s ":completion${curcontext}:files" file-patterns tmp1 &&
+   [[ -n "$tmp1" ]]; then
+  if [[ "$tmp1" = '*(-/)' ]]; then
+    gopt=''
+    sopt=-/
+  else
+    gopt='-g'
+    sopt=-
+  fi
+  pats=( $=tmp1 )
+  haspats=yes
+fi
+
 if (( ! ( $#group + $#expl ) )); then
   if [[ -z "$gopt" && "$sopt" = -/ ]]; then
     _description directories expl directory
diff -ru ../z.old/Doc/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- ../z.old/Doc/Zsh/compsys.yo	Wed Jan 19 10:07:36 2000
+++ Doc/Zsh/compsys.yo	Wed Jan 19 17:13:02 2000
@@ -720,6 +720,39 @@
 this will also cycle through the names of the files in pathname
 components after the first ambiguous one.
 )
+item(tt(file-patterns))(
+The completion system uses two functions to complete filenames,
+tt(_files) and tt(_path_files), with one of them calling the other,
+but this second one is sometimes also called directly. Depending on
+how it is called, the first one uses the tags tt(globbed-files),
+tt(directories) and tt(all-files). The second one, when called
+directly, uses the tag tt(files).
+
+Using this style one can specify which filenames should be completed
+in certain contexts. It is tested by tt(_files) and, if called
+directly, tt(_path_files) with the tags mentioned above. If it is set
+for these tags, the value is taken as a list of glob-patterns that
+should be used to select filenames when completing for the tag. Note
+that with tt(_files), calling completion function may specify that
+all files are to be completed. Normally this would make tt(_files) use 
+only the tt(all-files) tag, but if this style is set for any of the
+other two tags (tt(globbed-files) and tt(directories)), these tags
+will be used, too, in the normal order given above (unless the user
+specified another order to be used with the tt(tag-order) style).
+
+For example, to make the completion system first try only filenames
+matching the pattern tt(*.o) for the tt(rm) command, one would use:
+
+example(zstyle ':completion:*::rm*:globbed-files' file-patterns '*.o')
+
+With this, using only filenames ending in tt(.o) will be the first
+choice and other filenames will only be used if what is on the line
+matches none of the tt(.o) files (or if there are none).
+
+Note also that during the execution of completion functions, the
+tt(EXTENDED_GLOB) option is in effect, so the characters `tt(#)',
+`tt(~)' and `tt(^)' have special meanings in the patterns.
+)
 item(tt(format))(
 If this is set for the tt(descriptions) tag, its value is used as a
 string to display above matches in completion lists. The sequence
@@ -841,6 +874,10 @@
 patterns will be ignored as long as there are other matches not
 matched by any of the patterns.  It is a more configurable version
 of the shell parameter tt($fignore).
+
+Note that during the execution of completion functions, the
+tt(EXTENDED_GLOB) option is in effect, so the characters `tt(#)',
+`tt(~)' and `tt(^)' have special meanings in the patterns.
 )
 item(tt(insert-unambiguous))(
 This is used by the tt(_match) and tt(_approximate) completer

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


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

* Re: PATCH: _a2ps completion
  2000-01-18 13:17 Sven Wischnowsky
@ 2000-01-18 20:00 ` Peter Stephenson
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Stephenson @ 2000-01-18 20:00 UTC (permalink / raw)
  To: zsh-workers

Sven Wischnowsky wrote:
> Is this a valid reason to add a `glob-pattern' (or `file-pattern')
> style that is tested in _files and used to replace a function-supplied 
> pattern if there is any or to make _files use the pattern even if he
> calling function did not use -g? Or is this a case of `if you want
> that behaviour, copy and modify the completion function'?

I vaguely thought about this (i.e. asking you to do it :-)).  The only
reason I didn't mention it was that I vaguely thought there wouldn't be
enough context information.  But this turns out to be nonsense:

% a2ps ^Xh
tags in context :complete::a2ps::argument-rest
...

should be precise enough for anyone.

In fact, my original idea was for `glob-override', which would only modify
things if you already specified -g.  But as long as it doesn't mess up
completion of anything other than ordinary files --- i.e. it shouldn't
spoil directory completions, just alter things with the tags files,
globbed-files, or all-files --- it should be OK to use a more general
facility.

Preferably it should allow you to specify the tag you want altered,
i.e. you may want to alter just globbed-files, leaving all-files doing its
thing, or for special effects you might want all-files not to live up to
its name (e.g., I want to get rm to complete discardable files like *.o by
default (globbed-files), otherwise anything else (all-files), but I've
decide I never want it to complete vmlinuz). In which case, I suppose
`file-pattern' is the better name, since it can apply to all *files tags.
You could argue it should be `selected-files' to go with `ignored-files',
but I don't think they're really similar enough for that.

I suppose I'm going to have to include Clint's patch in 9333.

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>


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

* Re: PATCH: _a2ps completion
@ 2000-01-18 13:17 Sven Wischnowsky
  2000-01-18 20:00 ` Peter Stephenson
  0 siblings, 1 reply; 12+ messages in thread
From: Sven Wischnowsky @ 2000-01-18 13:17 UTC (permalink / raw)
  To: zsh-workers


[ Akim not CC'ed, this is zsh-internal. ]

Zefram wrote:

> Sven Wischnowsky wrote:
> >Ok, I wasn't aware of the possibilities of *newer versions* of GNU
> >a2ps. So I change my statement to: I'm very much against completing
> >all files unconditionally. We should do that only if the a2ps is a
> >newer GNU version that supports automatic conversion and whatnot. Ok?
> 
> I too didn't know a2ps had changed to do this stuff.  Considering
> only older versions, I'm still in favour of completing all files
> unconditionally.  PostScript (and HTML, and TeX) files are perfectly
> valid text files, and therefore perfectly valid subjects for all commands
> that deal with text files, including a program that renders plain text
> in PostScript.

I can't stop thinking about this...

The advantage of using a glob-pattern over using ignored-patterns is
the automatic fall back first on only directories and then all files
(or whatever you have configured).

Is this a valid reason to add a `glob-pattern' (or `file-pattern')
style that is tested in _files and used to replace a function-supplied 
pattern if there is any or to make _files use the pattern even if he
calling function did not use -g? Or is this a case of `if you want
that behaviour, copy and modify the completion function'?

Bye
 Sven


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


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

* Re: PATCH: _a2ps completion
@ 2000-01-18 12:06 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 2000-01-18 12:06 UTC (permalink / raw)
  To: zsh-workers; +Cc: Akim Demaille


Zefram wrote:

> Sven Wischnowsky wrote:
> >Ok, I wasn't aware of the possibilities of *newer versions* of GNU
> >a2ps. So I change my statement to: I'm very much against completing
> >all files unconditionally. We should do that only if the a2ps is a
> >newer GNU version that supports automatic conversion and whatnot. Ok?
> 
> I too didn't know a2ps had changed to do this stuff.  Considering
> only older versions, I'm still in favour of completing all files
> unconditionally.  PostScript (and HTML, and TeX) files are perfectly
> valid text files, and therefore perfectly valid subjects for all commands
> that deal with text files, including a program that renders plain text
> in PostScript.
> 
> >My a2ps (4.10.1) at least produces only pages containing the
> >PostScript code for PostScript files. And since only few people will
> >probably want that, I still think PostScript files shouldn't be
> >completed for such a version by default.
> 
> If we go the way you suggest, we might as well not complete *.c as
> an argument to gcc -o.  Or one's own username as an argument to su.
> Or /vmunix as an argument to rm.

Hey, good idea... ;-)

>  Where does it end?  Least surprise is
> the key.

Depends on what surprises you and what not, obviously.

But to repeat: since I can easily configure my setup, I won't start
crying if the patch makes it into the base. And I'm outvoted already...

Bye
 Sven


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


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

* Re: PATCH: _a2ps completion
  2000-01-18 11:30 Sven Wischnowsky
  2000-01-18 11:46 ` Zefram
@ 2000-01-18 11:50 ` Akim Demaille
  1 sibling, 0 replies; 12+ messages in thread
From: Akim Demaille @ 2000-01-18 11:50 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-workers

>>>>> "Sven" == Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

Sven> My a2ps (4.10.1) at least produces only pages containing the
Sven> PostScript code for PostScript files.

I am very much surprised.  Delegations are in a2ps since 4.9.7 (but
you should upgrade, you know :).  What must happen is that you didn't
have the psutils installed so your a2ps can't handle PS files.

But anyway, it seemed to me that zsh is supporting more recent a2pses
than older, which seems better to me anyway.  There are still a few
people running 4.10.{3,4}, I just discovered people using 4.10.1 ;),
but most people are running a recent version.  

If you still *need* a switch, you can depend upon:

/tmp/a2ps-4.12h % LANG=C a2ps --list=delegations                 nostromo 12:45
Applications configured for delegation
Delegation `Acrobat', from pdf to ps
        #{del.acroread} < '$f' | #{del.psselnup}
Delegation `Groff', from roff to ps
        eval `grog -Tps '$f'` | fixps #?V!!-q! | #{del.psselnup}
Delegation `ImageMagick', from gif to ps
        #{del.imagick} 'gif:$f' ps:- | #{del.psselnup}
Delegation `ImageMagick', from xpm to ps
        #{del.imagick} 'xpm:$f' ps:- | #{del.psselnup}
Delegation `ImageMagick', from xbm to ps
        #{del.imagick} 'xbm:$f' ps:- | #{del.psselnup}
Delegation `ImageMagick', from jpeg to ps
        #{del.imagick} 'jpeg:$f' ps:- | #{del.psselnup}
Delegation `ImageMagick', from png to ps
        #{del.imagick} 'png:$f' ps:- | #{del.psselnup}
Delegation `Netscape', from html to ps
        rm -f #f0;   if echo '$f' | grep '^/' >/dev/null 2>&1; then     ${NETSCAPE:-netscape} -noraise -remote 'openfile($f)';   else     ${NETSCAPE:-netscape} -noraise -remote 'openfile(%d/$f)';   fi &&   ${NETSCAPE:-netscape} -noraise -remote 'saveas(#f0,postscript)' &&   #{del.psselect} #f0 | #{del.psnup}
Delegation `PsNup', from ps to ps
        fixps #?V||-q| '$f' | #{del.psselnup}
Delegation `bzip2-a2ps', from bzip2 to ps
        bzip2 -cd '$f' | #{del.a2ps}
Delegation `dvips', from dvi to ps
        if strings '$f' | sed 10q | fgrep landscape > /dev/null 2>&1; then      #{del.dvips} -T#hpt,#wpt '$f' -o #f0 && #?o|cat|#{del.psnup} -r| #f0;    else      #{del.dvips} '$f' -o #f0 && #{del.psnup} #f0;    fi
Delegation `gzip-a2ps', from compress to ps
        gzip -cd '$f' | #{del.a2ps}
Delegation `gzip-a2ps', from gzip to ps
        gzip -cd '$f' | #{del.a2ps}
Delegation `texi2dvi', from texinfo to ps
        #{del.texi2dvi} -e -l texinfo '$f' && mv $N.dvi #f0 && #{del.dvips} -f #f0 | #{del.psnup}
Delegation `texi2dvi', from tex to ps
        #{del.texi2dvi} -l latex '$f' && mv $N.dvi #f0 && #{del.dvips} -f #f0 | #{del.psnup}

But seriously, you don't need this.

Akim


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

* Re: PATCH: _a2ps completion
  2000-01-18 11:30 Sven Wischnowsky
@ 2000-01-18 11:46 ` Zefram
  2000-01-18 11:50 ` Akim Demaille
  1 sibling, 0 replies; 12+ messages in thread
From: Zefram @ 2000-01-18 11:46 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-workers, Akim Demaille

Sven Wischnowsky wrote:
>Ok, I wasn't aware of the possibilities of *newer versions* of GNU
>a2ps. So I change my statement to: I'm very much against completing
>all files unconditionally. We should do that only if the a2ps is a
>newer GNU version that supports automatic conversion and whatnot. Ok?

I too didn't know a2ps had changed to do this stuff.  Considering
only older versions, I'm still in favour of completing all files
unconditionally.  PostScript (and HTML, and TeX) files are perfectly
valid text files, and therefore perfectly valid subjects for all commands
that deal with text files, including a program that renders plain text
in PostScript.

>My a2ps (4.10.1) at least produces only pages containing the
>PostScript code for PostScript files. And since only few people will
>probably want that, I still think PostScript files shouldn't be
>completed for such a version by default.

If we go the way you suggest, we might as well not complete *.c as
an argument to gcc -o.  Or one's own username as an argument to su.
Or /vmunix as an argument to rm.  Where does it end?  Least surprise is
the key.

-zefram


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

* Re: PATCH: _a2ps completion
  2000-01-18 11:00 Akim Demaille
@ 2000-01-18 11:32 ` Akim Demaille
  0 siblings, 0 replies; 12+ messages in thread
From: Akim Demaille @ 2000-01-18 11:32 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-workers


Hi!

I realize my message was probably too short, and was not showing why
it would be an error to limit the features a2ps from within zsh.

When you give a2ps a PostScript file (or virtually any kind of file),
you can use it just as if it were a plain file.  In particular you
still can use --pages to select the pages to print, -1, -2, -4
etc. for 2up and so one, insert special requests (Duplex, ManualFeed
etc.).  It will not print the PostScript source, nor the HTML source
by default: you have to tell it you know what you're doing, and it
will obey.

You don't need to put soft corners around a2ps from zsh: they're
builtin already.

Please, the fact that a2ps behaves properly, and actually even *very
well* with non text files is one of its major features, it is part of
its identity.  If zsh removes this from a2ps it would be like
condemning Leonardo da Vinci to painting (am I being clear? ;)

Thanks!

                    Akim


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

* Re: PATCH: _a2ps completion
@ 2000-01-18 11:30 Sven Wischnowsky
  2000-01-18 11:46 ` Zefram
  2000-01-18 11:50 ` Akim Demaille
  0 siblings, 2 replies; 12+ messages in thread
From: Sven Wischnowsky @ 2000-01-18 11:30 UTC (permalink / raw)
  To: zsh-workers; +Cc: Akim Demaille


Akim Demaille wrote:

> Hi People, I'm the author of a2ps (*Any* to PostScript, not ASCII),
> and I'm the one who complained to Clint.  Please, keep me in CC, I'm
> not member of the list.
> 
> | Clint Adams wrote:
> |      
> | > I have been informed that a2ps can be just as useful on PostScript
> | > files as any other file, and that *.(#i)(ps|eps) should not be
> | > excluded from completion.  Perhaps a context-based switch would
> | > be more appropriate.
> | > ...
> | > -_arguments '*:text file:_files -g \*\~\*.\(\#i\)\(ps\|eps\)' -- \
> | > +_arguments '*:input file:_files' -- \
> |      
> | I'm against this change. Very much so. At least in this form.
> 
> I'm very much in favor of this.

Ok, I wasn't aware of the possibilities of *newer versions* of GNU
a2ps. So I change my statement to: I'm very much against completing
all files unconditionally. We should do that only if the a2ps is a
newer GNU version that supports automatic conversion and whatnot. Ok?

My a2ps (4.10.1) at least produces only pages containing the
PostScript code for PostScript files. And since only few people will
probably want that, I still think PostScript files shouldn't be
completed for such a version by default.

But I'd like to hear other people's opinion, since, of course, I can
easily add the ignored-patterns stuff to my setup if everyone else
thinks that the default should be changed.


Bye
 Sven


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


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

* Re: PATCH: _a2ps completion
@ 2000-01-18 11:00 Akim Demaille
  2000-01-18 11:32 ` Akim Demaille
  0 siblings, 1 reply; 12+ messages in thread
From: Akim Demaille @ 2000-01-18 11:00 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-workers, Akim Demaille


Hi People, I'm the author of a2ps (*Any* to PostScript, not ASCII),
and I'm the one who complained to Clint.  Please, keep me in CC, I'm
not member of the list.

| Clint Adams wrote:
|      
| > I have been informed that a2ps can be just as useful on PostScript
| > files as any other file, and that *.(#i)(ps|eps) should not be
| > excluded from completion.  Perhaps a context-based switch would
| > be more appropriate.
| > ...
| > -_arguments '*:text file:_files -g \*\~\*.\(\#i\)\(ps\|eps\)' -- \
| > +_arguments '*:input file:_files' -- \
|      
| I'm against this change. Very much so. At least in this form.

I'm very much in favor of this.

| I'm very much in favour of the second suggestion because I guess that
| only few people want to use a2ps on postscript files and using
| completion on a prefix where no non-postscript file matches gives one
| postscript files as matches anyway (that's why we use _files, after
| all).

You completely miss the point of using a2ps on PostScript files.
*Many* people do it.  Let me give you a piece of the ANNOUNCE file of
a2ps so that you understand why it'd be a mistake to remove the
completion for PostScript files and *any* other kind of files.

If you want to still remove PostScript files, then this should not be
the default anyway.  People who really know a2ps use *only* a2ps to
print just everything.

Regards,

                    Akim

Description
===========

GNU a2ps is an Any to PostScript filter.  Of course it processes plain
text files, but also pretty prints quite a few popular languages.

Its slogan is precisely `` Do The Right Thing '', which means that
though it is highly configurable, everything was made so that a novice
user can do complicated PostScript manipulations.  For instance, it
has the ability to delegate the processing of some files to other
filters (such as groff, texi2dvi, dvips, gzip etc.), what allows a
uniform treatment (n-up, page selection, duplex etc.) of heterogeneous
files.

As an example:

| $ a2ps mill.1.ps.gz a2ps.gif NEWS a2ps.texi index.html -o demo.ps
| [mill.1.ps.gz (compressed, delegated to Gzip-a2ps): 17 pages on 9 sheets]
| [a2ps.gif (gif, delegated to ImageMagick): 3 pages on 2 sheets]
| [NEWS (plain): 12 pages on 6 sheets]
| [a2ps.texi (texinfo, delegated to texi2dvi): 89 pages on 45 sheets]
| [index.html (html, delegated to Netscape): 13 pages on 7 sheets]
| [Total: 132 pages on 66 sheets] saved into the file `demo.ps'

Want to print a LaTeX file in Duplex?

| $ a2ps paper.tex -s2 -P margot
| [paper.tex (tex, delegated to texi2dvi): 33 pages on 9 sheets]
| request id is margot-129 (standard input)
| [Total: 34 pages on 9 sheets] sent to the printer `margot'

(Bibtex, makeindex, and latex were run as many times as needed.)

Or maybe you want to print the documentation as a booklet?

| $ a2ps -P margot -=book doc/a2ps.texi
| [doc/a2ps.texi (texinfo, delegated to texi2dvi): 109 pages on 109 sheets]
| request id is margot-128 (standard input)
| [Total: 109 pages on 109 sheets] sent to the printer `margot'


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

* Re: PATCH: _a2ps completion
@ 2000-01-18 10:17 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 2000-01-18 10:17 UTC (permalink / raw)
  To: zsh-workers


[ Our name-server was down this morning, and the answer I sent to this 
  seems to have disappeared. Sorry if it re-appears and you get this
  twice. ]

Clint Adams wrote:

> I have been informed that a2ps can be just as useful on PostScript
> files as any other file, and that *.(#i)(ps|eps) should not be
> excluded from completion.  Perhaps a context-based switch would
> be more appropriate.
> 
> ...
>  
> -_arguments '*:text file:_files -g \*\~\*.\(\#i\)\(ps\|eps\)' -- \
> +_arguments '*:input file:_files' -- \

I'm really, really against this change. 

After all, we use _files to be able to 1) restrict the types of files
matched to some sensible subset and to 2) still be able to complete
other files as a default. And since in many (I think: most) cases one
won't want to a2ps postscript files, we should definitely keep the old 
form.

*And* for exactly this kind of stuff we added the tags mechanism,
dammit. So, if RTM isn't clear, someone should document (at the top of 
_a2ps?) that one can easily say that one wants to complete all files
for a2ps (or any other command) by just saying:

  zstyle ':completion:*::a2ps:*' tag-order all-files


Bye
 Sven


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


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

* Re: PATCH: _a2ps completion
@ 2000-01-18  8:08 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 2000-01-18  8:08 UTC (permalink / raw)
  To: zsh-workers


Clint Adams wrote:

> I have been informed that a2ps can be just as useful on PostScript
> files as any other file, and that *.(#i)(ps|eps) should not be
> excluded from completion.  Perhaps a context-based switch would
> be more appropriate.
> ...
> -_arguments '*:text file:_files -g \*\~\*.\(\#i\)\(ps\|eps\)' -- \
> +_arguments '*:input file:_files' -- \

I'm against this change. Very much so. At least in this form.

There are two acceptable possibilities I can see:

- use the patch and suggest (where?) that people who don't want to see 
  the ps files use

    zstyle ':completion:*::a2ps:*' ignored-patterns '*.(#i)(ps|eps)'

  or

- don't use the patch and document (at the top of _a2ps?) that people
  who want to complete all files should RTM and use the standard
  mechanism of the tag-order style:

    zstyle ':completion:*::a2ps:*' tag-order all-files

  cause that's what it's there for, dammit.

I'm very much in favour of the second suggestion because I guess that
only few people want to use a2ps on postscript files and using
completion on a prefix where no non-postscript file matches gives one
postscript files as matches anyway (that's why we use _files, after
all).


Bye
 Sven


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


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

* PATCH: _a2ps completion
@ 2000-01-17 15:28 Clint Adams
  0 siblings, 0 replies; 12+ messages in thread
From: Clint Adams @ 2000-01-17 15:28 UTC (permalink / raw)
  To: zsh-workers

I have been informed that a2ps can be just as useful on PostScript
files as any other file, and that *.(#i)(ps|eps) should not be
excluded from completion.  Perhaps a context-based switch would
be more appropriate.

Index: Completion/User/_a2ps
===================================================================
RCS file: /cvs/zsh/zsh/Completion/User/_a2ps,v
retrieving revision 1.1.1.8
diff -u -r1.1.1.8 _a2ps
--- Completion/User/_a2ps	2000/01/07 14:42:44	1.1.1.8
+++ Completion/User/_a2ps	2000/01/17 15:16:11
@@ -22,7 +22,7 @@
   )
 fi
 
-_arguments '*:text file:_files -g \*\~\*.\(\#i\)\(ps\|eps\)' -- \
+_arguments '*:input file:_files' -- \
            '*\*:toggle:(yes no)' \
            '*=DIRECTION:direction:(rows columns)' \
            '*=TYPE:type:(r n nr rn any)' \


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

end of thread, other threads:[~2000-01-19 16:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-19 16:16 PATCH: _a2ps completion Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-01-18 13:17 Sven Wischnowsky
2000-01-18 20:00 ` Peter Stephenson
2000-01-18 12:06 Sven Wischnowsky
2000-01-18 11:30 Sven Wischnowsky
2000-01-18 11:46 ` Zefram
2000-01-18 11:50 ` Akim Demaille
2000-01-18 11:00 Akim Demaille
2000-01-18 11:32 ` Akim Demaille
2000-01-18 10:17 Sven Wischnowsky
2000-01-18  8:08 Sven Wischnowsky
2000-01-17 15:28 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).