diff options
| author | Basil L. Contovounesios | 2021-09-19 21:13:17 +0100 |
|---|---|---|
| committer | Basil L. Contovounesios | 2021-09-20 14:41:13 +0100 |
| commit | 7d5930a6f0c7b44c00df403d5fe8a3f40e51902f (patch) | |
| tree | c9a14f584a974875f73b4d558f638a771f0fb88c /lisp/progmodes/bug-reference.el | |
| parent | d16e51e8d289400f6724ed9a568da7fb2237a472 (diff) | |
| download | emacs-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.el | 31 |
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 | |||
| 376 | Test each configuration in `bug-reference-setup-from-vc-alist' | 376 | Test each configuration in `bug-reference-setup-from-vc-alist' |
| 377 | and `bug-reference--setup-from-vc-alist' and apply it if | 377 | and `bug-reference--setup-from-vc-alist' and apply it if |
| 378 | applicable." | 378 | applicable." |
| 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) |