diff options
| author | Tassilo Horn | 2020-06-18 10:39:01 +0200 |
|---|---|---|
| committer | Tassilo Horn | 2020-06-18 10:39:01 +0200 |
| commit | dcdf6d712416f76a5c29801e97c7f8d923d1a031 (patch) | |
| tree | 38defaa53aabc8d04cbac36006565ff106bba9e4 | |
| parent | a4f1d681c10e39429d4ba6d9ca42b009a7b003fb (diff) | |
| download | emacs-dcdf6d712416f76a5c29801e97c7f8d923d1a031.tar.gz emacs-dcdf6d712416f76a5c29801e97c7f8d923d1a031.zip | |
Make bug-reference auto-setup work in vc-dir or Magit like modes
* lisp/progmodes/bug-reference.el (bug-reference-try-setup-from-vc):
Use default-directory if not in a file-visiting buffer to determine
VC URL.
| -rw-r--r-- | lisp/progmodes/bug-reference.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 50bd3661eff..e142c693503 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el | |||
| @@ -212,8 +212,11 @@ URL-REGEXP against the VCS URL and returns the value to be set as | |||
| 212 | "Try setting up `bug-reference-mode' based on VC information. | 212 | "Try setting up `bug-reference-mode' based on VC information. |
| 213 | Test each configuration in `bug-reference-setup-from-vc-alist' | 213 | Test each configuration in `bug-reference-setup-from-vc-alist' |
| 214 | and apply it if applicable." | 214 | and apply it if applicable." |
| 215 | (when buffer-file-name | 215 | (let ((file-or-dir (or buffer-file-name |
| 216 | (let* ((backend (vc-responsible-backend buffer-file-name t)) | 216 | ;; Catches modes such as vc-dir and Magit. |
| 217 | default-directory)))) | ||
| 218 | (when file-or-dir | ||
| 219 | (let* ((backend (vc-responsible-backend file-or-dir t)) | ||
| 217 | (url | 220 | (url |
| 218 | (or (ignore-errors | 221 | (or (ignore-errors |
| 219 | (vc-call-backend backend 'repository-url "upstream")) | 222 | (vc-call-backend backend 'repository-url "upstream")) |