zsh-workers
 help / color / mirror / code / Atom feed
* PATCH for _diff_options to allow argument to -u
@ 2005-04-19 20:59 Ulrik Haugen
  2005-04-25  8:13 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrik Haugen @ 2005-04-19 20:59 UTC (permalink / raw)
  To: zsh-workers

Hello!

I recently discovered that you can control the amount of context that
diff -u or -c gives you. Shortly thereafter it became very annoying
that the zsh completion sees characters (other than other option
characters) immediately following -u (or -c) as the original file name
and thus won't complete the new file once you get as far as "diff -u0
orig". The patch below makes the completion treat them the same way
the option handling in diff does.

This leaves the completion still thinking A is the original file name
if you type for instance "diff -wA orig" whereas diff complains that A
is an invalid option, but since diff will make you retype the command
anyway it's not necessarily worth fixing.

--- /usr/share/zsh/4.2.5/functions/Completion/Unix/_diff_options        2005-04-06 17:30:29.000000000 +0200
+++ init/zshfunctions/_diff_options     2005-03-25 01:09:27.000000000 +0100
@@ -56,4 +56,2 @@
-    "($of $oss)"{-C+,--context=-}'[output a context diff]:number of lines of copied context' \
-    "($of $oss)-c[output a context diff]" \
-    "($of $oss)"{-U+,--unified=-}'[output a unified diff]:number of lines of unified context' \
-    "($of $oss)-u[output a unified diff]" \
+    "($of $oss)"{-c-,-C+,--context=-}'[output a context diff]:number of lines of copied context' \
+    "($of $oss)"{-u-,-U+,--unified=-}'[output a unified diff]:number of lines of unified context' \


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

* Re: PATCH for _diff_options to allow argument to -u
  2005-04-19 20:59 PATCH for _diff_options to allow argument to -u Ulrik Haugen
@ 2005-04-25  8:13 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2005-04-25  8:13 UTC (permalink / raw)
  To: Ulrik Haugen; +Cc: zsh-workers

On 19 Apr, Ulrik Haugen wrote:
> Hello!
> 
> I recently discovered that you can control the amount of context that
> diff -u or -c gives you. Shortly thereafter it became very annoying
> that the zsh completion sees characters (other than other option
> characters) immediately following -u (or -c) as the original file name
> and thus won't complete the new file once you get as far as "diff -u0
> orig". The patch below makes the completion treat them the same way
> the option handling in diff does.

You should probably get used to using -U or --unified for specifying
lines of context. With diffutils 2.8.1 it works with -u but with
diffutils 2.8.4, I get this:

% diff -u0
diff: `-0' option is obsolete; use `-U 0'

The completion function is correct for the newer diffutils so I'll leave
the function as it is.

Oliver


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

end of thread, other threads:[~2005-04-25  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-19 20:59 PATCH for _diff_options to allow argument to -u Ulrik Haugen
2005-04-25  8:13 ` Oliver Kiddle

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