From dd1be2b9c277a53078fb20242702ecf2599cbb7b Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sun, 19 Sep 2021 21:13:17 +0100 Subject: [PATCH 1/2] 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. 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 b646a47c85..fd014a38d9 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -376,24 +376,19 @@ bug-reference-try-setup-from-vc 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) -- 2.33.0