emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/debbugs c3f0eb7 026/311: (debbugs-toggle-sort): Use `de


From: Stefan Monnier
Subject: [elpa] externals/debbugs c3f0eb7 026/311: (debbugs-toggle-sort): Use `debbugs-current-id'.
Date: Sun, 29 Nov 2020 18:41:33 -0500 (EST)

branch: externals/debbugs
commit c3f0eb77bdd5ce803d6b15b437250294ed0c6876
Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
Commit: Lars Magne Ingebrigtsen <larsi@gnus.org>

    (debbugs-toggle-sort): Use `debbugs-current-id'.
---
 ChangeLog      |  1 +
 debbugs-gnu.el | 12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 22ec7e9..d280416 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
        (debbugs-widget-map): New keymap.
        (debbugs-emacs): Use it.
        (debbugs-toggle-sort): Make sorting work again.
+       (debbugs-toggle-sort): Use `debbugs-current-id'.
 
 2011-07-03  Michael Albinus  <michael.albinus@gmx.de>
 
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 3c1c975..e8496d0 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -256,8 +256,7 @@ The following commands are available:
   (beginning-of-line)
   (let ((buffer-read-only nil)
        (before-change-functions nil)
-       (current-bug (and (not (eobp))
-                         (buffer-substring (point) (+ (point) 5)))))
+       (current-bug (debbugs-current-id t)))
     (setq debbugs-sort-state
          (if (eq debbugs-sort-state 'number)
              'state
@@ -282,21 +281,22 @@ The following commands are available:
        nil (lambda () (forward-line 1)) 'end-of-line
        (lambda ()
         (if (eq debbugs-sort-state 'number)
-            (string-to-number (buffer-substring (point) (+ (point) 5)))
+            (debbugs-current-id)
           (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))
-      (re-search-forward (concat "^" current-bug) nil t))))
+      (re-search-forward (format "^%d" current-bug) nil t))))
 
 (defvar debbugs-bug-number nil)
 
-(defun debbugs-current-id ()
+(defun debbugs-current-id (&optional noerror)
   (or (cdr (assq 'id (get-text-property (line-beginning-position)
                                        'debbugs-status)))
-      (error "No bug on the current line")))
+      (and (not noerror)
+          (error "No bug on the current line"))))
 
 (defun debbugs-display-status (id)
   "Display the status of the report on the current line."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]