unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 67145@debbugs.gnu.org
Subject: bug#67145: Modes in vc-deduce-backend
Date: Mon, 13 Nov 2023 09:07:32 +0200	[thread overview]
Message-ID: <86zfzi6ucr.fsf@mail.linkov.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 149 bytes --]

Here is a patch that avoids hard-coding the modes in vc-deduce-backend.
For example, it makes possible to replace shell-mode with comint-mode, etc.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc-deduce-backend-modes.patch --]
[-- Type: text/x-diff, Size: 995 bytes --]

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 95f9218dcbf..9c01f032fc0 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1071,14 +1071,16 @@ log-edit-vc-backend
 (defvar diff-vc-backend)
 (defvar diff-vc-revisions)
 
+;; Maybe we could even use comint-mode rather than shell-mode?
+(defvar vc-deduce-backend-modes '(dired-mode shell-mode eshell-mode compilation-mode))
+
 (defun vc-deduce-backend ()
   (cond ((derived-mode-p 'vc-dir-mode)   vc-dir-backend)
 	((derived-mode-p 'log-view-mode) log-view-vc-backend)
 	((derived-mode-p 'log-edit-mode) log-edit-vc-backend)
 	((derived-mode-p 'diff-mode)     diff-vc-backend)
-        ;; Maybe we could even use comint-mode rather than shell-mode?
-	((derived-mode-p
-          'dired-mode 'shell-mode 'eshell-mode 'compilation-mode)
+	((or (null vc-deduce-backend-modes)
+             (apply #'derived-mode-p vc-deduce-backend-modes))
 	 (ignore-errors (vc-responsible-backend default-directory)))
 	(vc-mode (vc-backend buffer-file-name))))
 

             reply	other threads:[~2023-11-13  7:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13  7:07 Juri Linkov [this message]
2023-11-13 14:11 ` bug#67145: Modes in vc-deduce-backend Dmitry Gutov
2023-11-13 17:29   ` Juri Linkov
2023-11-13 21:22     ` Dmitry Gutov
2023-11-14  7:46       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86zfzi6ucr.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=67145@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).