Function: bug-reference-try-setup-from-vc

bug-reference-try-setup-from-vc is a byte-compiled function defined in bug-reference.el.gz.

Signature

(bug-reference-try-setup-from-vc)

Documentation

Try setting up bug-reference-mode(var)/bug-reference-mode(fun) based on VC information.

Test each configuration in bug-reference-setup-from-vc-alist and bug-reference--setup-from-vc-alist(var)/bug-reference--setup-from-vc-alist(fun) and apply it if applicable.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/bug-reference.el.gz
(defun bug-reference-try-setup-from-vc ()
  "Try setting up `bug-reference-mode' based on VC information.
Test each configuration in `bug-reference-setup-from-vc-alist'
and `bug-reference--setup-from-vc-alist' and apply it if
applicable."
  (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)))
                             ;; Try likely names for the remote which
                             ;; probably hosts the bug tracker.  The nil
                             ;; value refers to the default remote name
                             ;; of the concrete VCS which is "origin"
                             ;; for Git or "default" for mercurial.
                             '("upstream" "origin" 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)))))