From: Lars Magne Ingebrigtsen Date: Sun, 3 Jul 2011 14:44:23 +0000 (+0200) Subject: (debbugs-toggle-sort): Make sorting work again. X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/adfac336324b3676947492b46f577fa90d0e24bc (debbugs-toggle-sort): Make sorting work again. --- diff --git a/packages/debbugs/ChangeLog b/packages/debbugs/ChangeLog index 35cd68370..22ec7e988 100644 --- a/packages/debbugs/ChangeLog +++ b/packages/debbugs/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 diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el index 095b70dcb..201c56af0 100644 --- a/packages/debbugs/debbugs-gnu.el +++ b/packages/debbugs/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))