]> git.eshelyaron.com Git - emacs.git/commitdiff
Make bug-reference auto-setup work in vc-dir or Magit like modes
authorTassilo Horn <tsdh@gnu.org>
Thu, 18 Jun 2020 08:39:01 +0000 (10:39 +0200)
committerTassilo Horn <tsdh@gnu.org>
Thu, 18 Jun 2020 08:39:01 +0000 (10:39 +0200)
* 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.

lisp/progmodes/bug-reference.el

index 50bd3661eff5e93f697e800855f303f46576720a..e142c6935038df03e95c1537394d158c36b223b9 100644 (file)
@@ -212,8 +212,11 @@ URL-REGEXP against the VCS URL and returns the value to be set as
   "Try setting up `bug-reference-mode' based on VC information.
 Test each configuration in `bug-reference-setup-from-vc-alist'
 and apply it if applicable."
-  (when buffer-file-name
-    (let* ((backend (vc-responsible-backend buffer-file-name t))
+  (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"))