unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: jbranso@dismail.de, "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: debbugs-guix.el helper function
Date: Thu, 06 Oct 2022 11:11:56 +0200	[thread overview]
Message-ID: <87a669uxib.fsf@gmail.com> (raw)
In-Reply-To: <20a86654f42bf996c4f3bacaa4ed89e9@dismail.de>

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






  reply	other threads:[~2022-10-06  9:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 10:11 Progress with automating testing of patches Christopher Baines
2022-09-19  7:46 ` Christopher Baines
2022-10-01 16:34   ` Ludovic Courtès
2022-10-01 21:58     ` Christopher Baines
2022-10-05 10:01       ` Ludovic Courtès
2022-10-05 10:22         ` Christopher Baines
2022-10-06 13:31           ` Ludovic Courtès
2022-10-05 22:49   ` jbranso
2022-10-06  9:11     ` zimoun [this message]
2022-10-07  9:47       ` debbugs-guix.el helper function Ludovic Courtès
2022-11-15 15:09         ` zimoun
2022-10-06 13:32     ` Progress with automating testing of patches Ludovic Courtès
2022-10-06 15:22       ` Joshua Branson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a669uxib.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=jbranso@dismail.de \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).