[comp.emacs] bug in sort-numeric-fields

rep@genrad.com (Pete Peterson) (12/15/90)

In GNU Emacs 18.55, sort-numeric-fields does not work properly if some of
the fields contain negative numbers.  The offending line in sort.el says:
'(skip-chars-forward "[0-9]")'.  It appears to work properly if this is
changed to: '(skip-chars-forward "0-9-")'.  I'm not sure why the brackets
were included in the original string. 

Note that '(skip-chars-forward "[\-0-9]")' didn't work (even ignoring that
brackets shouldn't be part of a numeric field).  I was unable to make "\-",
"\^", or "\\" in CHARS work as the docstring for skip-chars-forward claimed
it would work.  I would have expected "[\-0-9]" to skip digits, brackets,
and "-".  I would have expected "0-9\-\^\\" skip digits, "-", "^" and
backslashes, but it didn't work that way.  Explanations would be welcomed!

Were the brackets included in the original string because somebody was
thinking regexp character classes?  The docstring for skip-chars-forward
explicitly claims that brackets are not special.

*** /usr/local/gnuemacs/lisp/sort.el	Fri Dec 14 17:28:59 1990
--- /usr/local/gnuemacs/lisp/sort.el.bak	Mon May 30 17:53:34 1988
***************
*** 217,221 ****
  			        (point)
  				(save-excursion
! 				  (skip-chars-forward "0-9-")
  				  (point))))))
  		 nil))
--- 217,221 ----
  			        (point)
  				(save-excursion
! 				  (skip-chars-forward "[0-9]")
  				  (point))))))
  		 nil))