[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: |
Mon, 08 Mar 2004 12:20:56 +0100 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
I sent this patch a while ago, but it seems to have been lost:
-------------------- Start of forwarded message --------------------
Subject: [patch] gamegridd-add-score-insecure should use sort-fields
From: Jesper Harder <address@hidden>
Date: Sun, 10 Aug 2003 21:55:30 +0200
`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
-------------------- End of forwarded message --------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [patch] gamegridd-add-score-insecure should use sort-fields,
Jesper Harder <=