guix-devel
[Top][All Lists]
Advanced

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

Re: Emacs and URLs in Git commit messages


From: Maxim Cournoyer
Subject: Re: Emacs and URLs in Git commit messages
Date: Tue, 20 Apr 2021 23:09:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi,

Ludovic Courtès <ludo@gnu.org> writes:

[...]

> I have this helper for debbugs.el:
>
> (defun ludo-copy-debbugs-url ()
>   "Add to the kill ring the URL of the Debbugs issue at point."
>   (interactive)
>   (let ((url1 (concat "https://bugs.gnu.org/";
>                     (number-to-string (debbugs-gnu-current-id))))
>       (url2 (concat "https://issues.guix.gnu.org/";
>                     (number-to-string (debbugs-gnu-current-id)))))
>     (kill-new url1)
>     (kill-new url2)
>     (message "Copied %s and %s" url1 url2)))
>
> (define-key debbugs-gnu-mode-map (kbd "C-w") 'ludo-copy-debbugs-url)
>
> That way I can C-w on a bug in *Guix Bugs* and I get the two URLs in the
> clipboard (I normally use “bugs.gnu.org” as the canonical bug URL.)

Oh, that's perhaps nicer than what I had here (I like the
debbugs-gnu-current-id function):

(defun buffer-string-match (regexp)
  "Return the string matching the first group, else nil"
  (let ((text (buffer-substring-no-properties (point-min) (point-max))))
    (and (string-match regexp text)
         (match-string 1 text))))

(defun guix-get-debbugs-bug-number ()
  (interactive)
  (or (buffer-string-match "\\([[:digit:]]+\\)@debbugs.gnu.org")
      (buffer-string-match "bug#\\([[:digit:]]+\\)")))

(defun guix-get-mumi-link (bug-number)
  (interactive (list (guix-get-debbugs-bug-number)))
  "Parse the current buffer for a Debbugs issues number and
return a link for it in the MUMI Guix tracker."
  (let ((url (concat "https://issues.guix.gnu.org/"; bug-number)))
    (kill-new url)
    (message "%s" url)))

Maxim



reply via email to

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