aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/bug-reference.el
diff options
context:
space:
mode:
authorBasil L. Contovounesios2021-09-19 21:13:17 +0100
committerBasil L. Contovounesios2021-09-20 14:41:13 +0100
commit7d5930a6f0c7b44c00df403d5fe8a3f40e51902f (patch)
treec9a14f584a974875f73b4d558f638a771f0fb88c /lisp/progmodes/bug-reference.el
parentd16e51e8d289400f6724ed9a568da7fb2237a472 (diff)
downloademacs-7d5930a6f0c7b44c00df403d5fe8a3f40e51902f.tar.gz
emacs-7d5930a6f0c7b44c00df403d5fe8a3f40e51902f.zip
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.
Diffstat (limited to 'lisp/progmodes/bug-reference.el')
-rw-r--r--lisp/progmodes/bug-reference.el31
1 files changed, 13 insertions, 18 deletions
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index b646a47c858..fd014a38d95 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
376Test each configuration in `bug-reference-setup-from-vc-alist' 376Test each configuration in `bug-reference-setup-from-vc-alist'
377and `bug-reference--setup-from-vc-alist' and apply it if 377and `bug-reference--setup-from-vc-alist' and apply it if
378applicable." 378applicable."
379 (let ((file-or-dir (or buffer-file-name 379 (when-let ((file-or-dir (or buffer-file-name
380 ;; Catches modes such as vc-dir and Magit. 380 ;; Catches modes such as vc-dir and Magit.
381 default-directory))) 381 default-directory))
382 (when file-or-dir 382 (backend (vc-responsible-backend file-or-dir t))
383 (let* ((backend (vc-responsible-backend file-or-dir t)) 383 (url (seq-some (lambda (remote)
384 (url 384 (ignore-errors
385 (or (ignore-errors 385 (vc-call-backend backend 'repository-url
386 (vc-call-backend backend 'repository-url "upstream")) 386 file-or-dir remote)))
387 (ignore-errors 387 '("upstream" nil))))
388 (vc-call-backend backend 'repository-url))))) 388 (seq-some (lambda (config)
389 (when url 389 (apply #'bug-reference-maybe-setup-from-vc url config))
390 (catch 'found 390 (append bug-reference-setup-from-vc-alist
391 (dolist (config (append 391 (bug-reference--setup-from-vc-alist)))))
392 bug-reference-setup-from-vc-alist
393 (bug-reference--setup-from-vc-alist)))
394 (when (apply #'bug-reference-maybe-setup-from-vc
395 url config)
396 (throw 'found t)))))))))
397 392
398(defvar bug-reference-setup-from-mail-alist 393(defvar bug-reference-setup-from-mail-alist
399 `((,(regexp-opt '("emacs" "auctex" "gnus" "tramp" "orgmode") 'words) 394 `((,(regexp-opt '("emacs" "auctex" "gnus" "tramp" "orgmode") 'words)