branch: externals/debbugs
commit 42525fc0e4fc3f7220b8097b97cc3e0b28e962f8
Author: Michael Albinus <[email protected]>
Commit: Michael Albinus <[email protected]>
Improve bookmarks integration
* debbugs-bookmarks.el: Set copyright to FSF.
(debbugs-gnu-show-reports, debbugs-gnu-current-print-function)
(debbugs-gnu-local-print-function): Remove declaration.
(debbugs-gnu, debbugs-gnu-show-reports)
(debbugs-org-show-reports, debbugs-gnu-show-reports-function): Declare.
(debbugs-gnu-bookmark-name): Fix docstring.
(debbugs-gnu-bookmark-make-record, debbugs-gnu-bookmark-jump):
Use `debbugs-gnu-show-reports-function' but
`debbugs-gnu-current-print-function'. Call `debbugs-gnu' but
`debbugs-gnu-show-reports'.
* debbugs-gnu.el (debbugs-gnu-display-status): Fix typo.
* debbugs-org.el (bookmark-make-record-function): Declare.
(debbugs-org-mode): Set local `debbugs-gnu-local-suppress' and
`bookmark-make-record-function'.
* test/debbugs-gnu-tests.el
(debbugs-test-gnu-search-with-submitter-and-package): Use "me" as
submitter address.
---
debbugs-bookmarks.el | 28 +++++++++++++++-------------
debbugs-gnu.el | 4 ++--
debbugs-org.el | 5 +++++
test/debbugs-gnu-tests.el | 6 +++---
4 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/debbugs-bookmarks.el b/debbugs-bookmarks.el
index 897bd24307..6cc53167c6 100644
--- a/debbugs-bookmarks.el
+++ b/debbugs-bookmarks.el
@@ -1,6 +1,6 @@
;;; debbugs-bookmarks.el --- Bookmark support for debbugs -*-
lexical-binding: t; -*-
-;; Copyright (C) 2025 Matthias Meulien
+;; Copyright (C) 2025 Free Software Foundation, Inc.
;; Author: Matthias Meulien <[email protected]>
;; Keywords: convenience
@@ -38,23 +38,24 @@
(declare-function bookmark-default-handler "bookmark" (bmk))
(declare-function bookmark-get-bookmark-record "bookmark" (bmk))
-(declare-function debbugs-gnu-show-reports "debbugs-gnu" (&optional offline))
+(declare-function debbugs-gnu "debbugs-gnu")
+(declare-function debbugs-gnu-show-reports "debbugs-gnu")
+(declare-function debbugs-org-show-reports "debbugs-org")
(defvar debbugs-gnu-current-buffer)
(defvar debbugs-gnu-current-filter)
-(defvar debbugs-gnu-current-print-function)
(defvar debbugs-gnu-current-query)
(defvar debbugs-gnu-current-suppress)
(defvar debbugs-gnu-local-query)
(defvar debbugs-gnu-local-filter)
-(defvar debbugs-gnu-local-print-function)
(defvar debbugs-gnu-local-suppress)
+(defvar debbugs-gnu-show-reports-function)
(defun debbugs-gnu-bookmark-name (query)
"Candidate for bookmark name.
-The name depends on whether the query specifies bug identifiers or a
-phrase. When a phrase is specified, the subject may override the phrase
-and packages if any are mentionned.
+The name depends on whether QUERY specifies bug identifiers or a phrase.
+When a phrase is specified, the subject may override the phrase and
+packages if any are mentioned.
Examples of generated names follows:
- Bug #20777
@@ -64,8 +65,7 @@ Examples of generated names follows:
- Bugs with subject \"display\" in packages emacs,org
- Bugs about \"something\" reported by [email protected]
- Tagged bugs
-- Bugs
-"
+- Bugs"
(let* ((bugs (cdr (assq 'bugs query)))
(bug-count (length bugs))
(bugs-substring
@@ -118,9 +118,11 @@ such buffers."
(filename . nil)
(handler . debbugs-gnu-bookmark-jump)
(debbugs-gnu-current-filter . ,debbugs-gnu-local-filter)
- (debbugs-gnu-current-print-function . ,debbugs-gnu-local-print-function)
(debbugs-gnu-current-query . ,debbugs-gnu-local-query)
- (debbugs-gnu-current-suppress . ,debbugs-gnu-local-suppress))))
+ (debbugs-gnu-current-suppress . ,debbugs-gnu-local-suppress)
+ (debbugs-gnu-show-reports-function
+ . ,(if (eq major-mode 'debbugs-gnu-mode)
+ #'debbugs-gnu-show-reports #'debbugs-org-show-reports)))))
(put 'debbugs-gnu-bookmark-jump 'bookmark-handler-type "Debbugs")
@@ -130,11 +132,11 @@ such buffers."
This implements the `handler' function interface for the record
type returned by `debbugs-gnu-bookmark-make-record'."
(let* ((debbugs-gnu-current-filter (bookmark-prop-get bmk
'debbugs-gnu-current-filter))
- (debbugs-gnu-current-print-function (bookmark-prop-get bmk
'debbugs-gnu-current-print-function))
(debbugs-gnu-current-query (bookmark-prop-get bmk
'debbugs-gnu-current-query))
(debbugs-gnu-current-suppress (bookmark-prop-get bmk
'debbugs-gnu-current-suppress))
+ (debbugs-gnu-show-reports-function (bookmark-prop-get bmk
'debbugs-gnu-show-reports-function))
(buf (progn ;; Don't use save-window-excursion (bug#39722)
- (debbugs-gnu-show-reports)
+ (debbugs-gnu nil)
debbugs-gnu-current-buffer)))
(bookmark-default-handler
`("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk)))))
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 8a5fbd11b7..3961c48a70 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -1751,10 +1751,10 @@ interesting to you."
nil t)
(put-text-property
(match-beginning 0) (match-end 0)
- 'face 'debbugs-gnu-marked))
+ 'face 'debbugs-gnu-marked)
(put-text-property
(match-beginning 1) (match-end 1)
- 'help-echo "Client-side attribute")
+ 'help-echo "Client-side attribute"))
(goto-char (point-min)))
(set-buffer-modified-p nil)
(special-mode))
diff --git a/debbugs-org.el b/debbugs-org.el
index 6cfe8b2a44..0e6f0e38bb 100644
--- a/debbugs-org.el
+++ b/debbugs-org.el
@@ -332,6 +332,7 @@ the corresponding buffer (e.g. by closing Emacs)."
;; Make byte-compiler quiet.
(defvar gnus-posting-styles)
+(defvar bookmark-make-record-function)
;;;###autoload
(define-minor-mode debbugs-org-mode
@@ -342,6 +343,9 @@ the corresponding buffer (e.g. by closing Emacs)."
(set (make-local-variable 'debbugs-gnu-local-query)
debbugs-gnu-current-query)
(set (make-local-variable 'debbugs-gnu-local-filter)
debbugs-gnu-current-filter)
+ ;; Needed for bookmarks only.
+ (set (make-local-variable 'debbugs-gnu-local-suppress)
+ debbugs-gnu-current-suppress)
;; FIXME: Does not show any effect.
(set (make-local-variable 'org-priority-faces) debbugs-org-priority-faces)
(set (make-local-variable 'gnus-posting-styles)
@@ -357,6 +361,7 @@ the corresponding buffer (e.g. by closing Emacs)."
;; `gnus-posting-styles' is eval'ed after
;; `message-simplify-subject'. So we cannot use m-s-s.
(setq subject ,debbugs-gnu-subject)))))))
+ (setq-local bookmark-make-record-function #'debbugs-gnu-bookmark-make-record)
(debbugs-org-regenerate-status))
;;;###autoload
diff --git a/test/debbugs-gnu-tests.el b/test/debbugs-gnu-tests.el
index ca12e3472b..8469c1bd38 100644
--- a/test/debbugs-gnu-tests.el
+++ b/test/debbugs-gnu-tests.el
@@ -52,9 +52,9 @@
(debbugs-gnu-current-query nil))
(should
(equal '(nil nil nil)
- (debbugs-gnu-search nil '((submitter . "Phineas") (package .
"emacs")) nil nil nil)))
- (should (equal debbugs-gnu-current-query '((package . "emacs") (submitter
. "Phineas"))))
- (should (equal (debbugs-gnu-bookmark-name debbugs-gnu-current-query) "Bugs
reported by Phineas in emacs package"))))
+ (debbugs-gnu-search nil '((submitter . "me") (package . "emacs"))
nil nil nil)))
+ (should (equal debbugs-gnu-current-query '((package . "emacs") (submitter
. "me"))))
+ (should (equal (debbugs-gnu-bookmark-name debbugs-gnu-current-query) "Bugs
reported by me in emacs package"))))
(ert-deftest--debbugs debbugs-test-gnu-search-tagged-bugs ()
"Test `debbugs-gnu-search' on tagged bugs."