emacs-diffs
[Top][All Lists]
Advanced

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

master 7d5930a: Fix VC repo URL detection in bug-reference-mode


From: Basil L. Contovounesios
Subject: master 7d5930a: Fix VC repo URL detection in bug-reference-mode
Date: Mon, 20 Sep 2021 09:48:16 -0400 (EDT)

branch: master
commit 7d5930a6f0c7b44c00df403d5fe8a3f40e51902f
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Fix VC repo URL detection in bug-reference-mode
    
    * lisp/progmodes/bug-reference.el (bug-reference-try-setup-from-vc):
    Pass file or directory name in question as the first argument to the
    backend's repository-url implementation (bug#50689).  Use when-let
    and seq-some to flatten nested conditionals.
---
 lisp/progmodes/bug-reference.el | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index b646a47..fd014a3 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -376,24 +376,19 @@ URL-REGEXP against the VCS URL and returns the value to 
be set as
 Test each configuration in `bug-reference-setup-from-vc-alist'
 and `bug-reference--setup-from-vc-alist' and apply it if
 applicable."
-  (let ((file-or-dir (or buffer-file-name
-                         ;; Catches modes such as vc-dir and Magit.
-                         default-directory)))
-    (when file-or-dir
-      (let* ((backend (vc-responsible-backend file-or-dir t))
-             (url
-              (or (ignore-errors
-                    (vc-call-backend backend 'repository-url "upstream"))
-                  (ignore-errors
-                    (vc-call-backend backend 'repository-url)))))
-        (when url
-          (catch 'found
-            (dolist (config (append
-                             bug-reference-setup-from-vc-alist
-                             (bug-reference--setup-from-vc-alist)))
-              (when (apply #'bug-reference-maybe-setup-from-vc
-                           url config)
-                (throw 'found t)))))))))
+  (when-let ((file-or-dir (or buffer-file-name
+                              ;; Catches modes such as vc-dir and Magit.
+                              default-directory))
+             (backend (vc-responsible-backend file-or-dir t))
+             (url (seq-some (lambda (remote)
+                              (ignore-errors
+                                (vc-call-backend backend 'repository-url
+                                                 file-or-dir remote)))
+                            '("upstream" nil))))
+    (seq-some (lambda (config)
+                (apply #'bug-reference-maybe-setup-from-vc url config))
+              (append bug-reference-setup-from-vc-alist
+                      (bug-reference--setup-from-vc-alist)))))
 
 (defvar bug-reference-setup-from-mail-alist
   `((,(regexp-opt '("emacs" "auctex" "gnus" "tramp" "orgmode") 'words)



reply via email to

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