zsh-users
 help / color / mirror / code / Atom feed
* Re: PATCH: Re: NUMERIC_GLOB_SORT wish
@ 1999-11-03  8:13 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-11-03  8:13 UTC (permalink / raw)
  To: zsh-users


Bart Schaefer wrote:

> On Nov 1,  9:00am, Sven Wischnowsky wrote:
> } Subject: PATCH: Re: NUMERIC_GLOB_SORT wish
> }
> } The patch below implements [toggle numeric-glob-sort] for 3.1.6-bart-7
> } [...]. For now I took the letter `n'. This is a bit ugly
> } because all other qualifiers that locally set options use upper case
> } letters.
> 
> I think it's OK in this case; it's parallel with things like "sort -n"
> that use a lower-case `n' for numeric.
> 
> I'm not excited about the suggestion of using `0' (zero) because it's too
> easily confused with `O'.

That's exactly why I didn't produce a patch until now...

Bye
 Sven


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


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

* Re: PATCH: Re: NUMERIC_GLOB_SORT wish
  1999-11-01  8:00 Sven Wischnowsky
  1999-11-01  9:03 ` Nemeth Ervin
@ 1999-11-02 17:53 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 1999-11-02 17:53 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-users

On Nov 1,  9:00am, Sven Wischnowsky wrote:
} Subject: PATCH: Re: NUMERIC_GLOB_SORT wish
}
} The patch below implements [toggle numeric-glob-sort] for 3.1.6-bart-7
} [...]. For now I took the letter `n'. This is a bit ugly
} because all other qualifiers that locally set options use upper case
} letters.

I think it's OK in this case; it's parallel with things like "sort -n"
that use a lower-case `n' for numeric.

I'm not excited about the suggestion of using `0' (zero) because it's too
easily confused with `O'.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: PATCH: Re: NUMERIC_GLOB_SORT wish
  1999-11-01  8:00 Sven Wischnowsky
@ 1999-11-01  9:03 ` Nemeth Ervin
  1999-11-02 17:53 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Nemeth Ervin @ 1999-11-01  9:03 UTC (permalink / raw)
  To: zsh-users

>>>>> Sven Wischnowsky writes:

[...]

> Hm, it's a bit irritating that we can't do that yet, given that we can 
> set the other globbing specific options via qualifiers. It's quite
> easy to implement, though.

> To -workers:

> The patch below implements that for 3.1.6-bart-7 (it will not work for 
> any 3.0.x, I think). For now I took the letter `n'. This is a bit ugly
> because all other qualifiers that locally set options use upper case
> letters. The other free upper case letters are: BCFHJKPQVYZ. Any suggestions?

I agree that lowercase letters aren't suitable.

May I suggest the number 0 for this purpuse, if it doesn't confuse the parser?

Thanks for the patch, Sven, though it doesn't work for 3.0.*.

-- 
  ____                 ____________________________________________________
 /____| NEMETH, ERVIN |____________________________________________________|
//	< airwin @ inf.bme.hu >		http://www.inf.bme.hu/~airwin
||
||	"Nonsense.  All you have to do is say 'Engage'"
||					-- Patrick Stewart about warp theory


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

* PATCH: Re: NUMERIC_GLOB_SORT wish
@ 1999-11-01  8:00 Sven Wischnowsky
  1999-11-01  9:03 ` Nemeth Ervin
  1999-11-02 17:53 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-11-01  8:00 UTC (permalink / raw)
  To: zsh-users


[ Sorry for sending a patch to -users, but it's quite small... ]

Nemeth Ervin wrote:

> Hi,
> 
> I don't know if zsh 3.1.* has this feature, but in 3.0.* it is not documented:
> 
> It would be splendid to turn on NUMERIC_GLOB_SORT in any globbing with a
> globbing qualifier.
> 
> What do you think?

Hm, it's a bit irritating that we can't do that yet, given that we can 
set the other globbing specific options via qualifiers. It's quite
easy to implement, though.

To -workers:

The patch below implements that for 3.1.6-bart-7 (it will not work for 
any 3.0.x, I think). For now I took the letter `n'. This is a bit ugly
because all other qualifiers that locally set options use upper case
letters. The other free upper case letters are: BCFHJKPQVYZ. Any suggestions?

Bye
 Sven

diff -u oldsrc/glob.c Src/glob.c
--- oldsrc/glob.c	Fri Oct 29 21:15:13 1999
+++ Src/glob.c	Fri Oct 29 20:56:26 1999
@@ -139,6 +139,7 @@
     int gd_qualct, gd_qualorct;
     int gd_range, gd_amc, gd_units;
     int gd_gf_nullglob, gd_gf_markdirs, gd_gf_noglobdots, gd_gf_listtypes;
+    int gd_gf_numsort;
     int gd_gf_follow, gd_gf_sorts, gd_gf_nsorts, gd_gf_sortlist[11];
 
     char *gd_glob_pre, *gd_glob_suf;
@@ -165,6 +166,7 @@
 #define gf_markdirs   (curglobdata.gd_gf_markdirs)
 #define gf_noglobdots (curglobdata.gd_gf_noglobdots)
 #define gf_listtypes  (curglobdata.gd_gf_listtypes)
+#define gf_numsort    (curglobdata.gd_gf_numsort)
 #define gf_follow     (curglobdata.gd_gf_follow)
 #define gf_sorts      (curglobdata.gd_gf_sorts)
 #define gf_nsorts     (curglobdata.gd_gf_nsorts)
@@ -899,6 +901,7 @@
     gf_markdirs = isset(MARKDIRS);
     gf_listtypes = gf_follow = 0;
     gf_noglobdots = unset(GLOBDOTS);
+    gf_numsort = isset(NUMERICGLOBSORT);
     gf_sorts = gf_nsorts = 0;
 
     /* Check for qualifiers */
@@ -1176,6 +1179,10 @@
 			/* Glob dots: match leading dots implicitly */
 			gf_noglobdots = sense & 1;
 			break;
+		    case 'n':
+			/* Numeric glob sort */
+			gf_numsort = !(sense & 1);
+			break;
 		    case 'a':
 			/* Access time in given range */
 			g_amc = 0;
@@ -1413,7 +1420,7 @@
 #ifndef HAVE_STRCOLL
     cmp = (int)STOUC(*c) - (int)STOUC(*d);
 #endif
-    if (isset(NUMERICGLOBSORT) && (idigit(*c) || idigit(*d))) {
+    if (gf_numsort && (idigit(*c) || idigit(*d))) {
 	for (; c > *b && idigit(c[-1]); c--, d--);
 	if (idigit(*c) && idigit(*d)) {
 	    while (*c == '0')
diff -u olddoc/Zsh/expn.yo Doc/Zsh/expn.yo
--- olddoc/Zsh/expn.yo	Fri Oct 29 21:15:35 1999
+++ Doc/Zsh/expn.yo	Fri Oct 29 21:02:07 1999
@@ -1598,6 +1598,10 @@
 sets the tt(GLOB_DOTS) option for the current pattern
 pindex(GLOB_DOTS, setting in pattern)
 )
+item(tt(n))(
+sets the tt(NUMERIC_GLOB_SORT) option for the current pattern
+pindex(NUMERIC_GLOB_SORT, setting in pattern)
+)
 item(tt(o)var(c))(
 specifies how the names of the files should be sorted. If var(c) is
 tt(n) they are sorted by name (the default), if it is tt(L) they

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


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

end of thread, other threads:[~1999-11-03  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-03  8:13 PATCH: Re: NUMERIC_GLOB_SORT wish Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-11-01  8:00 Sven Wischnowsky
1999-11-01  9:03 ` Nemeth Ervin
1999-11-02 17:53 ` 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).