branch: externals/debbugs
commit 55886e2a5440959f725b4b5f20c1b51a35b4207f
Author: Lars Magne Ingebrigtsen <[email protected]>
Commit: Lars Magne Ingebrigtsen <[email protected]>
(debbugs-toggle-sort): Make sorting work again.
---
ChangeLog | 1 +
debbugs-gnu.el | 34 +++++++++++++++++++++++++---------
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 35cd683..22ec7e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
(debbugs-display-status): New command and keystroke.
(debbugs-widget-map): New keymap.
(debbugs-emacs): Use it.
+ (debbugs-toggle-sort): Make sorting work again.
2011-07-03 Michael Albinus <[email protected]>
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 095b70d..201c56a 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -255,21 +255,37 @@ The following commands are available:
(interactive)
(beginning-of-line)
(let ((buffer-read-only nil)
+ (before-change-functions nil)
(current-bug (and (not (eobp))
(buffer-substring (point) (+ (point) 5)))))
- (goto-char (point-min))
(setq debbugs-sort-state
(if (eq debbugs-sort-state 'number)
'state
'number))
- (sort-subr
- nil (lambda () (forward-line 1)) 'end-of-line
- (lambda ()
- (if (eq debbugs-sort-state 'number)
- (string-to-number (buffer-substring (point) (+ (point) 5)))
- (or (cdr (assq (get-text-property (+ (point) 7) 'face)
- debbugs-state-preference))
- 10))))
+ (goto-char (point-min))
+ (while (and (not (eobp))
+ (not (get-text-property (point) 'debbugs-status)))
+ (forward-line 1))
+ (save-restriction
+ (narrow-to-region
+ (point)
+ (progn
+ (goto-char (point-max))
+ (beginning-of-line)
+ (while (and (not (bobp))
+ (not (get-text-property (point) 'debbugs-status)))
+ (forward-line -1))
+ (forward-line 1)
+ (point)))
+ (goto-char (point-min))
+ (sort-subr
+ nil (lambda () (forward-line 1)) 'end-of-line
+ (lambda ()
+ (if (eq debbugs-sort-state 'number)
+ (string-to-number (buffer-substring (point) (+ (point) 5)))
+ (or (cdr (assq (get-text-property (+ (point) 7) 'face)
+ debbugs-state-preference))
+ 10)))))
(if (not current-bug)
(goto-char (point-max))
(goto-char (point-min))