GNU bug report logs -
#6870
Make vc-root-diff work in more modes
Previous Next
Reported by: rogers-emacs <at> rgrjr.dyndns.org
Date: Tue, 17 Aug 2010 01:55:02 UTC
Severity: minor
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6870 in the body.
You can then email your comments to 6870 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6870
; Package
emacs
.
(Tue, 17 Aug 2010 01:55:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
rogers-emacs <at> rgrjr.dyndns.org
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 17 Aug 2010 01:55:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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?
-- Bob Rogers
http://www.rgrjr.com/
------------------------------------------------------------------------
diff --git a/lisp/vc.el b/lisp/vc.el
index 1e52a3c..abba202 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1655,8 +1655,8 @@ saving the buffer."
(when buffer-file-name (vc-buffer-sync not-urgent))
(let ((backend
(cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
- ((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))))
rootdir working-revision)
(unless backend
(error "Buffer is not version controlled"))
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6870
; Package
emacs
.
(Mon, 04 Jul 2011 15:22:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 6870 <at> debbugs.gnu.org (full text, mbox):
rogers-emacs <at> 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?
>
> -- Bob Rogers
> http://www.rgrjr.com/
>
> ------------------------------------------------------------------------
> diff --git a/lisp/vc.el b/lisp/vc.el
> index 1e52a3c..abba202 100644
> --- a/lisp/vc.el
> +++ b/lisp/vc.el
> @@ -1655,8 +1655,8 @@ saving the buffer."
> (when buffer-file-name (vc-buffer-sync not-urgent))
> (let ((backend
> (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
> - ((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))))
> rootdir working-revision)
> (unless backend
> (error "Buffer is not version controlled"))
This looks very reasonable to me, but I'm not all that familiar with
vc.el internals. Does anybody else have any opinions on this?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6870
; Package
emacs
.
(Mon, 04 Jul 2011 18:14:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 6870 <at> debbugs.gnu.org (full text, mbox):
>> (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
>> - ((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))))
>> rootdir working-revision)
>> (unless backend
>> (error "Buffer is not version controlled"))
> This looks very reasonable to me, but I'm not all that familiar with
> vc.el internals. Does anybody else have any opinions on this?
It's only reasonable in buffers where default-directory is really
meaningful. E.g. in *Help* or *info* it's likely not going to do you
much good.
So feel free to add more major modes (rather than just `dired'), but
I don't think using (vc-responsible-backend default-directory)
everywhere is a good idea.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6870
; Package
emacs
.
(Tue, 05 Jul 2011 13:38:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 6870 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> It's only reasonable in buffers where default-directory is really
> meaningful. E.g. in *Help* or *info* it's likely not going to do you
> much good.
> So feel free to add more major modes (rather than just `dired'), but
> I don't think using (vc-responsible-backend default-directory)
> everywhere is a good idea.
What about all buffers that have file names? A la
(and (buffer-file-name)
(vc-responsible-backend default-directory))
or something along those lines...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6870
; Package
emacs
.
(Tue, 05 Jul 2011 19:17:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 6870 <at> debbugs.gnu.org (full text, mbox):
>> It's only reasonable in buffers where default-directory is really
>> meaningful. E.g. in *Help* or *info* it's likely not going to do you
>> much good.
>> So feel free to add more major modes (rather than just `dired'), but
>> I don't think using (vc-responsible-backend default-directory)
>> everywhere is a good idea.
> What about all buffers that have file names? A la
> (and (buffer-file-name)
> (vc-responsible-backend default-directory))
That'd be fine, yes.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6870
; Package
emacs
.
(Tue, 05 Jul 2011 20:59:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 6870 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> What about all buffers that have file names? A la
>
>> (and (buffer-file-name)
>> (vc-responsible-backend default-directory))
>
> That'd be fine, yes.
But this might be confusing, since this check would not trigger for
non-file buffers generated from those file buffers.
i.e., if you have a buffer with a file name that is not handled by VC,
vc-root-diff would work for that buffer but not for a diff file
generated from that buffer.
Whereas if a buffer with a file name *is* handled by VC, vc-root-diff
would work for both that buffer and a diff file generated for that
buffer.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#6870
; Package
emacs
.
(Tue, 25 Aug 2020 13:39:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 6870 <at> debbugs.gnu.org (full text, mbox):
rogers-emacs <at> 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
bug marked as fixed in version 28.1, send any further explanations to
6870 <at> debbugs.gnu.org and rogers-emacs <at> rgrjr.dyndns.org
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 25 Aug 2020 13:40:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 23 Sep 2020 11:24:12 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 187 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.