[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] gamegridd-add-score-insecure should use sort-fields
From: |
Jesper Harder |
Subject: |
[patch] gamegridd-add-score-insecure should use sort-fields |
Date: |
Sun, 10 Aug 2003 21:55:30 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
In GNU Emacs 21.3.50.13 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2003-08-09 on defun.localdomain
Hi,
`gamegridd-add-score-insecure' fails to sort the score buffer
correctly, because it uses `sort-numeric-fields' which interprets
numbers with leading 0's as octal.
Example:
(gamegrid-add-score "foo" 8)
(gamegrid-add-score "foo" 10)
(gamegrid-add-score "foo" 1)
Result:
,----
| 00010 Sun Aug 10 21:43:40 2003 Jesper Harder <address@hidden>
| 00001 Sun Aug 10 21:43:51 2003 Jesper Harder <address@hidden>
| 00008 Sun Aug 10 21:43:23 2003 Jesper Harder <address@hidden>
`----
Since the numbers are zero-padded, we can just use `sort-fields'
instead to solve the octal problem.
2003-08-10 Jesper Harder <address@hidden>
* play/gamegrid.el (gamegrid-add-score-insecure): Use sort-fields.
diff -c /usr/local/share/emacs/21.3.50/lisp/play/gamegrid.el\~
/usr/local/share/emacs/21.3.50/lisp/play/gamegrid.el
*** /usr/local/share/emacs/21.3.50/lisp/play/gamegrid.el~ Wed Apr 30
14:43:18 2003
--- /usr/local/share/emacs/21.3.50/lisp/play/gamegrid.el Sun Aug 10
21:49:40 2003
***************
*** 566,572 ****
((boundp 'user-mail-address)
user-mail-address)
(t ""))))
! (sort-numeric-fields 1 (point-min) (point-max))
(reverse-region (point-min) (point-max))
(goto-line (1+ gamegrid-score-file-length))
(delete-region (point) (point-max))
--- 566,572 ----
((boundp 'user-mail-address)
user-mail-address)
(t ""))))
! (sort-fields 1 (point-min) (point-max))
(reverse-region (point-min) (point-max))
(goto-line (1+ gamegrid-score-file-length))
(delete-region (point) (point-max))
Diff finished at Sun Aug 10 21:50:10
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [patch] gamegridd-add-score-insecure should use sort-fields,
Jesper Harder <=