]> code.delx.au - gnu-emacs-elpa/commitdiff
(debbugs-toggle-sort): Make sorting work again.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 3 Jul 2011 14:44:23 +0000 (16:44 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 3 Jul 2011 14:44:23 +0000 (16:44 +0200)
packages/debbugs/ChangeLog
packages/debbugs/debbugs-gnu.el

index 35cd68370f365d0dac70487a060e2a479eacab3d..22ec7e9888f28bc5c886331426a105a4d8073868 100644 (file)
@@ -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  <michael.albinus@gmx.de>
 
index 095b70dcbbbcc1c295d78bdb11b6c477d4fcf2a7..201c56af0753141ca4fc6d967c9ff9707ef9c77d 100644 (file)
@@ -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))