[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
debbugs-guix.el helper function
From: |
zimoun |
Subject: |
debbugs-guix.el helper function |
Date: |
Thu, 06 Oct 2022 11:11:56 +0200 |
Hi,
On mer., 05 oct. 2022 at 22:49, jbranso@dismail.de wrote:
> October 1, 2022 1:08 PM, "Ludovic Courtès" <ludo@gnu.org> wrote:
>> --8<---------------cut here---------------start------------->8---
>> (defun ludo-jump-to-guix-qa-url ()
>> "Jump to the QA page of the Debbugs issue at point."
>> (interactive)
>> (let ((url (concat "https://qa.guix.gnu.org/issue"
>> (number-to-string (debbugs-gnu-current-id)))))
>> (browse-url url)))
>>
>> (define-key debbugs-gnu-mode-map (kbd "C-M-j") 'ludo-jump-to-guix-qa-url)
>> --8<---------------cut here---------------end--------------->8---
>
> Would it make sense to add something like this to debbugs?
In the same spirit, I have:
--8<---------------cut here---------------start------------->8---
(defmacro defun-bug->url (name url &optional docstring)
"Macro returning yankage #bug URL.
The `interactive' function that the macro returns is then referred by NAME.
Please provide a DOCSTRING."
(let ((fun (intern (symbol-name name)))
(doc (concat docstring "\n\n"
(format "Yankable result: `%sNUMBER'." url))))
`(defun ,fun (number)
,doc
(interactive
(list
(progn
(when (not (boundp 'debbugs-gnu-bug-number))
(setq debbugs-gnu-bug-number -2))
(read-string
(format "Bug number (%s): " debbugs-gnu-bug-number)
nil nil debbugs-gnu-bug-number))))
(let ((str (format "%s%s" ,url number)))
(kill-new str)
(when current-prefix-arg
(browse-url str))
(message (format "%s killed." str))))))
(defun-bug->url my/guix-issues "http://issues.guix.gnu.org/issue/"
"Add URL of bug NUMBER to `kill-ring'.")
(defun-bug->url my/guix-debbugs "https://debbugs.gnu.org/cgi/bugreport.cgi?bug="
"Add (old) URL of bug NUMBER to `kill-ring'.")
(defun my/guix-data (package)
"Add URL of PACKAGE to `kill-ring'.
Yankable result:
`https://data.guix.gnu.org/repository/1/branch/master/package/PACKAGE/output-history'.
With `universal-argument', load URL using `browse-url'."
(interactive "sPackage: ")
(let ((url
(format
"https://data.guix.gnu.org/repository/1/branch/master/package/%s/output-history"
package)))
(kill-new url)
(when current-prefix-arg
(browse-url url))
(message (format "%s killed." url))))
--8<---------------cut here---------------end--------------->8---
And because I find Message-ID and public-inbox nice interface, I also
have:
--8<---------------cut here---------------start------------->8---
(defun my/public-inbox-insert (number)
"TODO"
(interactive "nBug number: ")
(let* ((meta (car (debbugs-get-status number)))
(inbox (car (debbugs-get-attribute meta 'package))) ;Probably
inaccurate for the general case
(raw (debbugs-get-attribute meta 'msgid))
(msgid (replace-regexp-in-string "<\\|>" "" raw)))
(message "Message-ID: %s from %s." msgid inbox)
(my/piem-inject-thread-into-maildir msgid inbox)
(notmuch-command-to-string "new" "--no-hooks")))
--8<---------------cut here---------------end--------------->8---
which can be adapted (by removing the part about emacs-piem, great
package BTW! and the part about emacs-notmuch).
Well, I have in my TODO list to implement the extraction of Message-ID
from Emacs-Debbugs. But it is not about debbugs.el and instead about
Gnus. It could be very helpful to have a way to stash to the kill-ring
the Message-ID of one specific message in the thread; and not only the
Message-ID of the first message in that thread.
Cheers,
simon