Re: Emacs and URLs in Git commit messages

2021-05-07 Thread Alexey Abramov
Hi,

I gave hyperbole [1] a try, and now if I move the point to that bug
string [bug#48262] or bug#48262 and press action key (M-RET) it
magically brings me to the debbugs with that bug. 

Footnotes:

[1]  https://www.gnu.org/software/hyperbole/

-- 
Alexey



Re: Emacs and URLs in Git commit messages

2021-04-20 Thread Maxim Cournoyer
Hi,

Ludovic Courtès  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



Re: Emacs and URLs in Git commit messages

2021-02-05 Thread Chris Marusich
Hi,

Thank you for the replies!

Maxime Devos  writes:

> I don't known any emacs command for that, but you inspired me to write
> such a command myself: [1].
>
> Maxime.
> [1]: 
> https://notabug.org/mdevos/things/commit/b0400ba06b6f031e88f1f89b47079c3c6d7dcac4

zimoun  writes:

> I am not representative since I commit few fixes.  Well, I have a tiny
> helper that pushes to the kill ring:
>
> 
>
> Especially reading bug#45314 in Debbugs mode, I type “M-x
> my/guix-issues” then the URL ’http://issues.guix.gnu.org/issue/45314’ is
> stashed.  If not in debbugs mode, as here in message mode, the tiny
> helper asks the bug number then pushes it to the kill ring.  This tiny
> helper is far from perfect, any improvements is welcome. :-) Especially
> if it is already provided by an Emacs command.
>
> About the brackets, I type them.

Ludovic Courtès  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.)
>
> Ludo’.

OK, I see.  So I'm not missing out on some built-in Emacs (or
debbugs-emacs) magic; most people just put together something convenient
on their own.  That makes sense!  Thank you for the examples; it's
helpful to see how others are doing it.  I think I'll try something
similar.

Bengt Richter  writes:

> I am not sure I understand your context or goal in searching ;/

I'm always interested in finding more effective ways to get things done.
Sometimes, asking people how they do something is the best way to
discover new methods, even if the answer seems simple or obvious.

-- 
Chris


signature.asc
Description: PGP signature


Re: Emacs and URLs in Git commit messages

2021-02-05 Thread Ludovic Courtès
Hi,

Chris Marusich  skribis:

> Many Guix commits look like this:
>
>   commit f9978346e73359ac1d8b88c9ed874edc7225582b
>   Author: Ludovic Courtès 
>   Date:   Fri Dec 18 18:10:04 2020 +0100
>
>   avahi: Remove poll timeout when possible.
>
>   Fixes .
>
>   * guix/avahi.scm (avahi-browse-service-thread): Change timeout default 
> value
>   to false when no "stop-loop?" procedure is passed. Adapt 
> "iterate-simple-poll"
>   call accordingly.
>
>   Signed-off-by: Mathieu Othacehe 
>
> Regarding the URL, do people just type it all out, including the opening
> and closing brackets (<>)?  Or is there an Emacs command that does it
> for you?  I've briefly looked on the Internet, but this is the kind of
> thing that seems difficult to search for.

I have this helper for debbugs.el:

--8<---cut here---start->8---
(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)
--8<---cut here---end--->8---

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.)

Ludo’.



Re: Emacs and URLs in Git commit messages

2021-02-04 Thread Bengt Richter
Hi Chris,

On +2021-02-04 00:38:18 -0800, Chris Marusich wrote:
> Hi,
> 
> Many Guix commits look like this:
> 
>   commit f9978346e73359ac1d8b88c9ed874edc7225582b
>   Author: Ludovic Courtès 
>   Date:   Fri Dec 18 18:10:04 2020 +0100
> 
>   avahi: Remove poll timeout when possible.
> 
>   Fixes .
> 
>   * guix/avahi.scm (avahi-browse-service-thread): Change timeout default 
> value
>   to false when no "stop-loop?" procedure is passed. Adapt 
> "iterate-simple-poll"
>   call accordingly.
> 
>   Signed-off-by: Mathieu Othacehe 
> 
> Regarding the URL, do people just type it all out, including the opening
> and closing brackets (<>)?  Or is there an Emacs command that does it
> for you?  I've briefly looked on the Internet, but this is the kind of
> thing that seems difficult to search for.
>
I am not sure I understand your context or goal in searching ;/

I.e., what did you briefly look for on the internet?
Did you search for an instance of ""
hoping to find discussion of it elsehere than at the URL itself?

What were you referring to with the "this" in
"...this is the kind of thing that seems difficult to search for." ?

If you were looking for alternate site discussion of bug#45314, duckduckgo
seems to respond better without the '#' and narrowed by a last search term
specifying the year, like
duckduckgo "bug 45314" 2020
(don't leave out the quotes, and don't put the year inside them)

NB: there are lots of bug trackers out there, so you will probably
want to Ctl-f to ask your browser to walk through all the 45314's just by 
hitting Enter
after that (firefox example).

Not so many hits for 2021 yet, so I can show the result: (2 irrelevant hits :)
--8<---cut here---start->8---
DuckDuckGo
[...]
FreeNAS - Bug #45314
[Search domain redmine.ixsystems.com/issues/45314.pdf] 
https://redmine.ixsystems.com/issues/45314.pdf
FreeNAS - Bug #45314 Add the ability to set the password on first login if user 
left password blank during installation 09/07/2018 07:54 AM - Bonnie Follweiler
Possible IPad/1.7 bug - Unity Forum
[Search domain forum.unity.com/threads/possible-ipad-1-7-bug.45314/] 
https://forum.unity.com/threads/possible-ipad-1-7-bug.45314/
Unity ID. A Unity ID allows you to buy and/or subscribe to Unity products and 
services, shop in the Asset Store and participate in the Unity community.

No more results found for "bug 45314" 2021.
[...]
--8<---cut here---end--->8---

If your context is in emacs editing a git commit, and you just want an easy 
command to insert
a line like
Fixes .
... I'm sure you can handle that yourself if you want to, hence my confusion 
about what you were up to ;)

But maybe you are lazy like me, and wanted to see what was available. For me, 
that brings up the question
of what form of solution would be most helpful to the most people if I offered 
one. E.g., I could

1. point you to the others' elisp solutions,
2. offer a bash script that formats the line based on clipboard-captured number 
(e.g., using xclip or wl-paste)
   which you can easily invoke from emacs by "Esc 1 Esc ! bash-script"
3. offer a guile script to do the same
4. offer a bash script that will compile and link a C program (source and 
commands all in script) that will do the same,
   assuming you have a usual x86_64 tool chain at hand, or
5. write it in some other interesting language (rash? :)

I am not sure having the solution be dependent on emacs' (or any limiting 
entity's) internals
is the most generally useful, but it's something I think about.

I'd be interested in what you all think, though maybe it ought to be a new 
thread ;)

> -- 
> Chris
--
Regards,
Bengt Richter



Re: Emacs and URLs in Git commit messages

2021-02-04 Thread zimoun
Hi Chris,

On Thu, 04 Feb 2021 at 00:38, Chris Marusich  wrote:

>   Fixes .

[...]

> Regarding the URL, do people just type it all out, including the opening
> and closing brackets (<>)?  Or is there an Emacs command that does it
> for you?  I've briefly looked on the Internet, but this is the kind of
> thing that seems difficult to search for.

I am not representative since I commit few fixes.  Well, I have a tiny
helper that pushes to the kill ring:



Especially reading bug#45314 in Debbugs mode, I type “M-x
my/guix-issues” then the URL ’http://issues.guix.gnu.org/issue/45314’ is
stashed.  If not in debbugs mode, as here in message mode, the tiny
helper asks the bug number then pushes it to the kill ring.  This tiny
helper is far from perfect, any improvements is welcome. :-) Especially
if it is already provided by an Emacs command.

About the brackets, I type them.


Aside I thought the convention was  tough for
bug fix commit.  Anyway.


Hope that helps,
simon



Re: Emacs and URLs in Git commit messages

2021-02-04 Thread Maxime Devos
On Thu, 2021-02-04 at 00:38 -0800, Chris Marusich wrote:
> Regarding the URL, do people just type it all out, including the opening
> and closing brackets (<>)?  Or is there an Emacs command that does it
> for you?  I've briefly looked on the Internet, but this is the kind of
> thing that seems difficult to search for.

I don't known any emacs command for that, but you inspired me to write
such a command myself: [1].

Maxime.
[1]: 
https://notabug.org/mdevos/things/commit/b0400ba06b6f031e88f1f89b47079c3c6d7dcac4


signature.asc
Description: This is a digitally signed message part


Emacs and URLs in Git commit messages

2021-02-04 Thread Chris Marusich
Hi,

Many Guix commits look like this:

  commit f9978346e73359ac1d8b88c9ed874edc7225582b
  Author: Ludovic Courtès 
  Date:   Fri Dec 18 18:10:04 2020 +0100

  avahi: Remove poll timeout when possible.

  Fixes .

  * guix/avahi.scm (avahi-browse-service-thread): Change timeout default 
value
  to false when no "stop-loop?" procedure is passed. Adapt 
"iterate-simple-poll"
  call accordingly.

  Signed-off-by: Mathieu Othacehe 

Regarding the URL, do people just type it all out, including the opening
and closing brackets (<>)?  Or is there an Emacs command that does it
for you?  I've briefly looked on the Internet, but this is the kind of
thing that seems difficult to search for.

-- 
Chris


signature.asc
Description: PGP signature