summaryrefslogtreecommitdiff
path: root/lisp/vc
diff options
context:
space:
mode:
authorTassilo Horn <tsdh@gnu.org>2020-06-11 17:02:02 +0200
committerTassilo Horn <tsdh@gnu.org>2020-06-17 22:03:50 +0200
commit5502eedf90d0da27df0c6c1fa33389d849d59a80 (patch)
treef92d3435ebe288ce9632070915d55ce5daa1018b /lisp/vc
parent21b03faed44913ba0b0e3d54d2ffdb0ac067fae8 (diff)
downloademacs-5502eedf90d0da27df0c6c1fa33389d849d59a80.tar.gz
Auto-setup for bug-reference-mode
Tries to guess suitable bug-reference-bug-regexp and bug-reference-url-format values based on version control URL (in file buffers) and mail information (in Gnus summary and article buffers). * lisp/progmodes/bug-reference.el (bug-reference--maybe-setup-from-vc): New defun. (bug-reference-setup-from-vc-alist): New defvar defining setup rules based on version control URL. (bug-reference-try-setup-from-vc): New defun using above defvar. (bug-reference--maybe-setup-from-mail): New defun. (bug-reference-setup-from-mail-alist): New defvar defining setup rules based on mail/newsgroups and header values. (bug-reference-try-setup-from-gnus): New defun using above defvar. (bug-reference--try-setup-gnus-article): New defun. (bug-reference--run-auto-setup): New defun. (bug-reference-mode): Call bug-reference--run-auto-setup as :after-hook. (bug-reference-prog-mode): Call bug-reference--run-auto-setup as :after-hook.
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/vc.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index ce947d21f95..9b12d449785 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -964,7 +964,7 @@ use."
(throw 'found bk))))
;;;###autoload
-(defun vc-responsible-backend (file)
+(defun vc-responsible-backend (file &optional no-error)
"Return the name of a backend system that is responsible for FILE.
If FILE is already registered, return the
@@ -974,7 +974,10 @@ responsible for FILE is returned.
Note that if FILE is a symbolic link, it will not be resolved --
the responsible backend system for the symbolic link itself will
-be reported."
+be reported.
+
+If NO-ERROR is nil, signal an error that no VC backend is
+responsible for the given file."
(or (and (not (file-directory-p file)) (vc-backend file))
(catch 'found
;; First try: find a responsible backend. If this is for registration,
@@ -982,7 +985,8 @@ be reported."
(dolist (backend vc-handled-backends)
(and (vc-call-backend backend 'responsible-p file)
(throw 'found backend))))
- (error "No VC backend is responsible for %s" file)))
+ (unless no-error
+ (error "No VC backend is responsible for %s" file))))
(defun vc-expand-dirs (file-or-dir-list backend)
"Expands directories in a file list specification.