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

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

[elpa] master d41489a: Debbugs code cleanup


From: Michael Albinus
Subject: [elpa] master d41489a: Debbugs code cleanup
Date: Sun, 23 Aug 2020 13:11:08 -0400 (EDT)

branch: master
commit d41489afd1693448a90bdfaec63fb6823b79dfa3
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Debbugs code cleanup
    
    * debbugs-gnu.el (debbugs-gnu-marked): Fix docstring.
    (debbugs-gnu-dump-persistency-file): Dump readable form.
    (debbugs-gnu-toggle-tag,debbugs-gnu-toggle-mark):
    Simplify implementation.
    (debbugs-gnu--update-tag-mark-face): New defun, derived from ...
    (debbugs-gnu--update-tag-face, debbugs-gnu--update-mark-face): Remove.
    
    * debbugs-org.el (debbugs-org-mode-map): Add "C-c # m".
    
    * debbugs-ug.texi (Tabulated Lists, TODO Items): Describe local marks.
    Mention `debbugs-gnu-persistency-file'.
---
 packages/debbugs/debbugs-gnu.el  | 113 +++++++++++++--------------
 packages/debbugs/debbugs-org.el  |   4 +-
 packages/debbugs/debbugs-ug.info | 160 ++++++++++++++++++++++-----------------
 packages/debbugs/debbugs-ug.texi |  23 ++++++
 4 files changed, 175 insertions(+), 125 deletions(-)

diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el
index c569990..9f7f809 100644
--- a/packages/debbugs/debbugs-gnu.el
+++ b/packages/debbugs/debbugs-gnu.el
@@ -83,7 +83,8 @@
 ;;   RET: Show corresponding messages in Gnus/Rmail
 ;;   "C": Send a control message
 ;;   "E": Make (but don't yet send) a control message
-;;   "t": Mark the bug locally as tagged
+;;   "t": Tag the bug locally
+;;   "m": Mark the bug locally
 ;;   "b": Show bugs this bug is blocked by
 ;;   "B": Show bugs this bug is blocking
 ;;   "d": Show bug attributes
@@ -363,7 +364,7 @@ If this is `rmail', use Rmail instead."
   "Face for reports that have been tagged locally.")
 
 (defface debbugs-gnu-marked '((t (:background "DarkGrey")))
-  "Face for reports that have been tagged locally.")
+  "Face for reports that have been marked locally.")
 
 (defvar debbugs-gnu-local-tags nil
   "List of bug numbers tagged locally, and kept persistent.")
@@ -379,12 +380,13 @@ If this is `rmail', use Rmail instead."
   "Function to store debbugs variables persistently."
   (with-temp-file debbugs-gnu-persistency-file
     (insert
+     ;; This could be `lisp-data' once we depend on Emacs 28+.
      ";; -*- emacs-lisp -*-\n"
-     ";; Debbugs tags connection history.  Don't change this file.\n\n"
-     (format "(setq debbugs-gnu-local-tags '%S)"
-            (sort (copy-sequence debbugs-gnu-local-tags) #'>))
-     (format "(setq debbugs-gnu-local-marks '%S)"
-            (sort (copy-sequence debbugs-gnu-local-marks) #'>)))))
+     ";; Debbugs tags and marks history.  Don't change this file.\n\n"
+     (format
+      "(setq debbugs-gnu-local-tags '%S\n      debbugs-gnu-local-marks '%S)\n"
+      (sort (copy-sequence debbugs-gnu-local-tags) #'>)
+      (sort (copy-sequence debbugs-gnu-local-marks) #'>)))))
 
 (defvar debbugs-gnu-current-query nil
   "The query object of the current search.
@@ -887,10 +889,11 @@ are taken from the cache instead."
             (propertize
              (or subject "")
              'face
-             ;; Mark owned bugs.
              (cond
+              ;; Marked bugs.
               ((memq id debbugs-gnu-local-marks)
                'debbugs-gnu-marked)
+              ;; Mark owned bugs.
               ((and (stringp owner)
                     (string-equal owner user-mail-address))
                'debbugs-gnu-tagged)
@@ -1337,65 +1340,63 @@ Subject fields."
 If a report is tagged locally, it is presumed to be of little
 interest to you."
   (interactive)
-  (save-excursion
-    (beginning-of-line)
-    (let ((inhibit-read-only t)
-         (id (debbugs-gnu-current-id)))
-      (if (memq id debbugs-gnu-local-tags)
-         (progn
-           (setq debbugs-gnu-local-tags (delq id debbugs-gnu-local-tags))
-           (put-text-property (point) (+ (point) 5) 'face 'default))
-       (add-to-list 'debbugs-gnu-local-tags id)
-       (put-text-property
-        (+ (point) (- 5 (length (number-to-string id)))) (+ (point) 5)
-        'face 'debbugs-gnu-tagged))
-      (debbugs-gnu--update-tag-face id)))
+  (let ((id (debbugs-gnu-current-id)))
+    (if (memq id debbugs-gnu-local-tags)
+       (setq debbugs-gnu-local-tags (delq id debbugs-gnu-local-tags))
+      (add-to-list 'debbugs-gnu-local-tags id))
+    (debbugs-gnu--update-tag-mark-face id)
+    ;; FIXME: Use `debbugs-gnu-print-entry'?
+    (tabulated-list-init-header)
+    (tabulated-list-print)
+    (when id
+      (debbugs-gnu-goto id)))
   (debbugs-gnu-dump-persistency-file))
 
-(defun debbugs-gnu--update-tag-face (id)
+(defun debbugs-gnu--update-tag-mark-face (id)
   (dolist (entry tabulated-list-entries)
     (when (equal (alist-get 'id (car entry)) id)
-      (aset (cadr entry) 0
-           (propertize
-            (format "%5d" id)
-            'face
-            ;; Mark tagged bugs.
-            (if (memq id debbugs-gnu-local-tags)
-                'debbugs-gnu-tagged
-              'default))))))
+      (let ((owner (if (alist-get 'owner (car entry))
+                      (car (debbugs-gnu--split-address
+                            (decode-coding-string
+                             (alist-get 'owner (car entry)) 'utf-8))))))
+       (aset (cadr entry) 0
+             (propertize
+              (format "%5d" id)
+              'face
+              ;; Mark tagged bugs.
+              (if (memq id debbugs-gnu-local-tags)
+                  'debbugs-gnu-tagged
+                'default)))
+       (aset (cadr entry) 3
+             (propertize
+              (or (alist-get 'subject (car entry)) "")
+              'face
+              (cond
+               ;; Marked bugs.
+               ((memq id debbugs-gnu-local-marks)
+                'debbugs-gnu-marked)
+               ;; Mark owned bugs.
+               ((and (stringp owner) (string-equal owner user-mail-address))
+                'debbugs-gnu-tagged)
+               (t 'default))))))))
 
 (defun debbugs-gnu-toggle-mark ()
   "Toggle the local mark of the report in the current line.
 If a report is marked locally, it is presumed to be very
-intersting to you."
+interesting to you."
   (interactive)
-  (save-excursion
-    (beginning-of-line)
-    (let ((inhibit-read-only t)
-         (id (debbugs-gnu-current-id)))
-      (if (memq id debbugs-gnu-local-marks)
-         (progn
-           (setq debbugs-gnu-local-marks (delq id debbugs-gnu-local-marks))
-           (put-text-property (+ (point) 32) (line-end-position)
-                              'face 'default))
-       (add-to-list 'debbugs-gnu-local-marks id)
-       (put-text-property (+ (point) 32) (line-end-position)
-                          'face 'debbugs-gnu-marked))
-      (debbugs-gnu--update-mark-face id)))
+  (let ((id (debbugs-gnu-current-id)))
+    (if (memq id debbugs-gnu-local-marks)
+       (setq debbugs-gnu-local-marks (delq id debbugs-gnu-local-marks))
+      (add-to-list 'debbugs-gnu-local-marks id))
+    (debbugs-gnu--update-tag-mark-face id)
+    ;; FIXME: Use `debbugs-gnu-print-entry'?
+    (tabulated-list-init-header)
+    (tabulated-list-print)
+    (when id
+      (debbugs-gnu-goto id)))
   (debbugs-gnu-dump-persistency-file))
 
-(defun debbugs-gnu--update-mark-face (id)
-  (dolist (entry tabulated-list-entries)
-    (when (equal (alist-get 'id (car entry)) id)
-      (aset (cadr entry) 3
-           (propertize
-            (alist-get 'subject (car entry))
-            'face
-            ;; Mark tagged bugs.
-            (if (memq id debbugs-gnu-local-marks)
-                'debbugs-gnu-marked
-              'default))))))
-
 (defun debbugs-gnu-toggle-suppress ()
   "Suppress bugs marked in `debbugs-gnu-suppress-bugs'."
   (interactive)
diff --git a/packages/debbugs/debbugs-org.el b/packages/debbugs/debbugs-org.el
index d0b0fb5..31107bf 100644
--- a/packages/debbugs/debbugs-org.el
+++ b/packages/debbugs/debbugs-org.el
@@ -75,7 +75,8 @@
 
 ;;   "C-c # C": Send a debbugs control message
 ;;   "C-c # E": Make (but don't yet send) a debbugs control message
-;;   "C-c # t": Mark the bug locally as tagged
+;;   "C-c # t": Tag the bug locally
+;;   "C-c # m": Mark the bug locally
 ;;   "C-c # d": Show bug attributes
 
 ;; The last entry in a TODO record is the link [[Messages]].  If you
@@ -299,6 +300,7 @@ the corresponding buffer (e.g. by closing Emacs)."
 (defconst debbugs-org-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "C-c # t") #'debbugs-gnu-toggle-tag)
+    (define-key map (kbd "C-c # m") #'debbugs-gnu-toggle-mark)
     (define-key map (kbd "C-c # C") #'debbugs-gnu-send-control-message)
     (define-key map (kbd "C-c # E") #'debbugs-gnu-make-control-message)
     (define-key map (kbd "C-c # d") #'debbugs-gnu-display-status)
diff --git a/packages/debbugs/debbugs-ug.info b/packages/debbugs/debbugs-ug.info
index d598faa..0527db8 100644
--- a/packages/debbugs/debbugs-ug.info
+++ b/packages/debbugs/debbugs-ug.info
@@ -1,4 +1,4 @@
-This is debbugs-ug.info, produced by makeinfo version 6.6 from
+This is debbugs-ug.info, produced by makeinfo version 6.7 from
 debbugs-ug.texi.
 
 Copyright (C) 2015-2020 Free Software Foundation, Inc.
@@ -368,6 +368,9 @@ MidnightBlue ('debbugs-gnu-pending', the bug is pending), 
orange
 DarkGrey ('debbugs-gnu-done', the bug is closed).  Archived bugs are
 shown with inverse face ('debbugs-gnu-archived').
 
+   A DarkGrey background color ('debbugs-gnu-marked') in the title
+column shows bugs which have been marked locally.
+
    The minor mode 'debbugs-gnu-mode' is active in bug report buffers.
 This enables the following key strokes:
 
@@ -415,6 +418,9 @@ This enables the following key strokes:
 't'            'debbugs-gnu-toggle-tag'
                Toggle local tag of bugs.
                
+'m'            'debbugs-gnu-toggle-mark'
+               Toggle local mark of bugs.
+               
 'x'            'debbugs-gnu-toggle-suppress'
                Toggle showing of closed bugs.
                
@@ -430,6 +436,13 @@ This enables the following key strokes:
 visible you are working on.  The command 'debbugs-gnu-tagged' shows
 all locally tagged bugs in a list.
 
+   Marking a bug locally via 'm' is meant for single sessions.  This
+is a mean to mark bugs for different reasons, like marking a bug in a
+list you have processed already during a bug triage.
+
+   Both tagged and marked bugs are kept persistent in the file
+'debbugs-gnu-persistency-file'.
+
    The user option 'debbugs-gnu-suppress-closed' controls whether
 closed bugs are shown in the initial list.
 
@@ -464,6 +477,9 @@ This enables the following key strokes:
 'C-c # t'   'debbugs-gnu-toggle-tag'
             Toggle local tag of bugs.
             
+'C-c # m'   'debbugs-gnu-toggle-mark'
+            Toggle local mark of bugs.
+            
 'C-c # C'   'debbugs-gnu-send-control-message'
             Send a control message for this bug, *note Control Messages::.
             
@@ -783,10 +799,11 @@ Variable Index
 * debbugs-gnu-default-suppress-bugs:     Retrieving Bugs.   (line  50)
 * debbugs-gnu-git-remote-info-alist:     Customizing debbugs-gnu-pick-commits.
                                                             (line   6)
-* debbugs-gnu-mail-backend:              Tabulated Lists.   (line  91)
+* debbugs-gnu-mail-backend:              Tabulated Lists.   (line 104)
+* debbugs-gnu-persistency-file:          Tabulated Lists.   (line  98)
 * debbugs-gnu-read-commit-range-hook:    Posting Patches.   (line  11)
 * debbugs-gnu-send-mail-function:        Control Messages.  (line 133)
-* debbugs-gnu-suppress-closed:           Tabulated Lists.   (line  88)
+* debbugs-gnu-suppress-closed:           Tabulated Lists.   (line 101)
 * debbugs-gnu-trunk-directory:           Applying Patches.  (line  18)
 * debbugs-org-severity-priority:         TODO Items.        (line  10)
 * debbugs-show-progress:                 Retrieving Bugs.   (line 123)
@@ -800,29 +817,31 @@ Key Index
 [index]
 * Menu:
 
-* /:                                     Tabulated Lists.    (line 41)
-* A:                                     Tabulated Lists.    (line 33)
-* B:                                     Tabulated Lists.    (line 62)
-* b:                                     Tabulated Lists.    (line 63)
-* C:                                     Tabulated Lists.    (line 76)
-* C-c # C:                               TODO Items.         (line 25)
-* C-c # d:                               TODO Items.         (line 19)
-* C-c # E:                               TODO Items.         (line 28)
-* C-c # t:                               TODO Items.         (line 22)
-* d:                                     Tabulated Lists.    (line 38)
-* E:                                     Tabulated Lists.    (line 80)
-* g:                                     Tabulated Lists.    (line 57)
-* M-m:                                   Applying Patches.   (line 10)
-* <mouse-1>:                             Tabulated Lists.    (line 30)
-* <mouse-2>:                             Tabulated Lists.    (line 31)
-* R:                                     Tabulated Lists.    (line 47)
-* <RET>:                                 Tabulated Lists.    (line 29)
-* <RET> <1>:                             Tabulated Lists.    (line 91)
-* s:                                     Tabulated Lists.    (line 67)
-* t:                                     Tabulated Lists.    (line 70)
-* <TAB>:                                 TODO Items.         (line 16)
-* w:                                     Tabulated Lists.    (line 54)
-* x:                                     Tabulated Lists.    (line 73)
+* /:                                     Tabulated Lists.   (line  44)
+* A:                                     Tabulated Lists.   (line  36)
+* B:                                     Tabulated Lists.   (line  65)
+* b:                                     Tabulated Lists.   (line  66)
+* C:                                     Tabulated Lists.   (line  82)
+* C-c # C:                               TODO Items.        (line  28)
+* C-c # d:                               TODO Items.        (line  19)
+* C-c # E:                               TODO Items.        (line  31)
+* C-c # m:                               TODO Items.        (line  25)
+* C-c # t:                               TODO Items.        (line  22)
+* d:                                     Tabulated Lists.   (line  41)
+* E:                                     Tabulated Lists.   (line  86)
+* g:                                     Tabulated Lists.   (line  60)
+* m:                                     Tabulated Lists.   (line  76)
+* M-m:                                   Applying Patches.  (line  10)
+* <mouse-1>:                             Tabulated Lists.   (line  33)
+* <mouse-2>:                             Tabulated Lists.   (line  34)
+* R:                                     Tabulated Lists.   (line  50)
+* <RET>:                                 Tabulated Lists.   (line  32)
+* <RET> <1>:                             Tabulated Lists.   (line 104)
+* s:                                     Tabulated Lists.   (line  70)
+* t:                                     Tabulated Lists.   (line  73)
+* <TAB>:                                 TODO Items.        (line  16)
+* w:                                     Tabulated Lists.   (line  57)
+* x:                                     Tabulated Lists.   (line  79)
 
 
 File: debbugs-ug.info,  Node: Mail Command Index,  Prev: Key Index,  Up: Top
@@ -1177,47 +1196,52 @@ Ref: Searching Bugs-Footnote-112730
 Ref: Searching Bugs-Footnote-212818
 Node: Presenting Bugs12909
 Node: Tabulated Lists13575
-Node: TODO Items17830
-Node: Control Messages19148
-Node: Applying Patches22663
-Node: Posting Patches24045
-Node: Customizing debbugs-gnu-pick-commits26530
-Node: Minor Mode27230
-Node: Command Index28504
-Node: Variable Index29774
-Node: Key Index31290
-Node: Mail Command Index33069
-Ref: Mail Command Index: reassign33222
-Ref: Mail Command Index: reopen33988
-Ref: Mail Command Index: found35142
-Ref: Mail Command Index: notfound36223
-Ref: Mail Command Index: fixed36632
-Ref: Mail Command Index: notfixed37078
-Ref: Mail Command Index: submitter37701
-Ref: Mail Command Index: forwarded38095
-Ref: Mail Command Index: notforwarded38713
-Ref: Mail Command Index: retitle38914
-Ref: Mail Command Index: severity39298
-Ref: Mail Command Index: clone39629
-Ref: Mail Command Index: merge40393
-Ref: Mail Command Index: forcemerge41780
-Ref: Mail Command Index: unmerge42224
-Ref: Mail Command Index: tags42927
-Ref: Mail Command Index: block43993
-Ref: Mail Command Index: unblock44030
-Ref: Mail Command Index: close44515
-Ref: Mail Command Index: package45165
-Ref: Mail Command Index: owner45777
-Ref: Mail Command Index: noowner46140
-Ref: Mail Command Index: archive46313
-Ref: Mail Command Index: unarchive46454
-Ref: Mail Command Index: #46747
-Ref: Mail Command Index: quit47007
-Ref: Mail Command Index: stop47014
-Ref: Mail Command Index: thank47021
-Ref: Mail Command Index: thanks47029
-Ref: Mail Command Index: thankyou47038
-Ref: Mail Command Index: thank you47049
-Ref: Mail Command Index: --47061
+Node: TODO Items18336
+Node: Control Messages19744
+Node: Applying Patches23259
+Node: Posting Patches24641
+Node: Customizing debbugs-gnu-pick-commits27126
+Node: Minor Mode27826
+Node: Command Index29100
+Node: Variable Index30370
+Node: Key Index31957
+Node: Mail Command Index33878
+Ref: Mail Command Index: reassign34031
+Ref: Mail Command Index: reopen34797
+Ref: Mail Command Index: found35951
+Ref: Mail Command Index: notfound37032
+Ref: Mail Command Index: fixed37441
+Ref: Mail Command Index: notfixed37887
+Ref: Mail Command Index: submitter38510
+Ref: Mail Command Index: forwarded38904
+Ref: Mail Command Index: notforwarded39522
+Ref: Mail Command Index: retitle39723
+Ref: Mail Command Index: severity40107
+Ref: Mail Command Index: clone40438
+Ref: Mail Command Index: merge41202
+Ref: Mail Command Index: forcemerge42589
+Ref: Mail Command Index: unmerge43033
+Ref: Mail Command Index: tags43736
+Ref: Mail Command Index: block44802
+Ref: Mail Command Index: unblock44839
+Ref: Mail Command Index: close45324
+Ref: Mail Command Index: package45974
+Ref: Mail Command Index: owner46586
+Ref: Mail Command Index: noowner46949
+Ref: Mail Command Index: archive47122
+Ref: Mail Command Index: unarchive47263
+Ref: Mail Command Index: #47556
+Ref: Mail Command Index: quit47816
+Ref: Mail Command Index: stop47823
+Ref: Mail Command Index: thank47830
+Ref: Mail Command Index: thanks47838
+Ref: Mail Command Index: thankyou47847
+Ref: Mail Command Index: thank you47858
+Ref: Mail Command Index: --47870
 
 End Tag Table
+
+
+Local Variables:
+coding: utf-8
+End:
diff --git a/packages/debbugs/debbugs-ug.texi b/packages/debbugs/debbugs-ug.texi
index e1e9a79..4538894 100644
--- a/packages/debbugs/debbugs-ug.texi
+++ b/packages/debbugs/debbugs-ug.texi
@@ -388,6 +388,9 @@ touched for a while), and DarkGrey 
(@code{debbugs-gnu-done}, the bug
 is closed).  Archived bugs are shown with inverse face
 (@code{debbugs-gnu-archived}).
 
+A DarkGrey background color (@code{debbugs-gnu-marked}) in the title
+column shows bugs which have been marked locally.
+
 The minor mode @code{debbugs-gnu-mode} is active in bug report
 buffers.  This enables the following key strokes:
 
@@ -471,6 +474,12 @@ Toggle sorting order of bugs.
 Toggle local tag of bugs.
 
 @item
+@kindex @kbd{m}
+@kbd{m} @tab
+@code{debbugs-gnu-toggle-mark} @*
+Toggle local mark of bugs.
+
+@item
 @kindex @kbd{x}
 @kbd{x} @tab
 @code{debbugs-gnu-toggle-suppress} @*
@@ -494,6 +503,14 @@ Tagging a bug locally via @kbd{t} is an efficient way to 
keep bugs
 visible you are working on.  The command @code{debbugs-gnu-tagged}
 shows all locally tagged bugs in a list.
 
+Marking a bug locally via @kbd{m} is meant for single sessions.  This
+is a mean to mark bugs for different reasons, like marking a bug in a
+list you have processed already during a bug triage.
+
+@vindex debbugs-gnu-persistency-file
+Both tagged and marked bugs are kept persistent in the file
+@code{debbugs-gnu-persistency-file}.
+
 @vindex debbugs-gnu-suppress-closed
 The user option @code{debbugs-gnu-suppress-closed} controls whether
 closed bugs are shown in the initial list.
@@ -543,6 +560,12 @@ Show all bug attributes.
 Toggle local tag of bugs.
 
 @item
+@kindex @kbd{C-c # m}
+@kbd{C-c # m} @tab
+@code{debbugs-gnu-toggle-mark} @*
+Toggle local mark of bugs.
+
+@item
 @kindex @kbd{C-c # C}
 @kbd{C-c # C} @tab
 @code{debbugs-gnu-send-control-message} @*



reply via email to

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