bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6870: Make vc-root-diff work in more modes


From: Lars Ingebrigtsen
Subject: bug#6870: Make vc-root-diff work in more modes
Date: Tue, 25 Aug 2020 15:38:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

rogers-emacs@rgrjr.dyndns.org writes:

>    It makes sense to me that vc-root-diff uses "(vc-responsible-backend
> default-directory)" when in a dired-mode buffer.  But since vc-root-diff
> is not at all about the current buffer, why not also make that the
> default for shell-mode, diff-mode, or any of the other modes for
> non-version-controlled buffers that may be generated in a working copy?

[...]

> -              ((derived-mode-p 'dired-mode) (vc-responsible-backend 
> default-directory))
> -              (vc-mode (vc-backend buffer-file-name))))
> +              (vc-mode (vc-backend buffer-file-name))
> +              (t (vc-responsible-backend default-directory))))

This has been extended somewhat over the years:

(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 'compilation-mode)
         (ignore-errors (vc-responsible-backend default-directory)))
        (vc-mode (vc-backend buffer-file-name))))

So we still don't do this in all buffers, but since there's some issues
with that, I think this works well now.  So I'm closing this bug
report.  If there's more to be done here, respond to the debbugs address
and we'll reopen the report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]