GNU bug report logs - #41974
28.0.50; Some vc commands refuse to work when called on non-file buffer

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sun, 21 Jun 2020 00:00:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

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 41974 in the body.
You can then email your comments to 41974 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41974; Package emacs. (Sun, 21 Jun 2020 00:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 21 Jun 2020 00:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Some vc commands refuse to work when called on non-file
 buffer
Date: Sun, 21 Jun 2020 02:55:47 +0300
For example, typing

  M-x vc-print-branch-log RET

on the project's *compilation* buffer signals the error:

  "Buffer *compilation* is not associated with a file"

I think this restriction should be lifted, so vc commands should
work even when called on non-file buffers whose default-directory
is inside the vc project.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41974; Package emacs. (Sun, 21 Jun 2020 00:08:01 GMT) Full text and rfc822 format available.

Message #8 received at 41974 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>, 41974 <at> debbugs.gnu.org
Subject: Re: bug#41974: 28.0.50; Some vc commands refuse to work when called
 on non-file buffer
Date: Sun, 21 Jun 2020 03:07:40 +0300
On 21.06.2020 02:55, Juri Linkov wrote:
> I think this restriction should be lifted, so vc commands should
> work even when called on non-file buffers whose default-directory
> is inside the vc project.

Agreed.

Does this patch help, or does it miss more cases?

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9b12d44978..36013fcdc9 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2563,7 +2563,7 @@ vc-print-branch-log
     (vc-read-revision "Branch to log: ")))
   (when (equal branch "")
     (error "No branch specified"))
-  (let* ((backend (vc-responsible-backend default-directory))
+  (let* ((backend (vc-deduce-backend))
          (rootdir (vc-call-backend backend 'root default-directory)))
     (vc-print-log-internal backend
                            (list rootdir) branch t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41974; Package emacs. (Sun, 21 Jun 2020 23:20:03 GMT) Full text and rfc822 format available.

Message #11 received at 41974 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 41974 <at> debbugs.gnu.org
Subject: Re: bug#41974: 28.0.50; Some vc commands refuse to work when called
 on non-file buffer
Date: Mon, 22 Jun 2020 01:51:20 +0300
> On 21.06.2020 02:55, Juri Linkov wrote:
>> I think this restriction should be lifted, so vc commands should
>> work even when called on non-file buffers whose default-directory
>> is inside the vc project.
>
> Agreed.
>
> Does this patch help, or does it miss more cases?
>
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index 9b12d44978..36013fcdc9 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -2563,7 +2563,7 @@ vc-print-branch-log
>      (vc-read-revision "Branch to log: ")))
>    (when (equal branch "")
>      (error "No branch specified"))
> -  (let* ((backend (vc-responsible-backend default-directory))
> +  (let* ((backend (vc-deduce-backend))
>           (rootdir (vc-call-backend backend 'root default-directory)))
>      (vc-print-log-internal backend
>                             (list rootdir) branch t

Strange, this patch has no effect, the same error remains.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41974; Package emacs. (Mon, 22 Jun 2020 01:00:02 GMT) Full text and rfc822 format available.

Message #14 received at 41974 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: 41974 <at> debbugs.gnu.org
Subject: Re: bug#41974: 28.0.50; Some vc commands refuse to work when called
 on non-file buffer
Date: Mon, 22 Jun 2020 03:59:38 +0300
On 22.06.2020 01:51, Juri Linkov wrote:
> Strange, this patch has no effect, the same error remains.

Sorry, that was a brain fart.

How about this:

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9b12d44978..6bb72d8976 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1074,11 +1074,11 @@ vc-deduce-fileset
       (progn                  ;FIXME: Why not `with-current-buffer'? 
--Stef.
 	(set-buffer vc-parent-buffer)
 	(vc-deduce-fileset not-state-changing allow-unregistered 
state-model-only-files)))
-     ((and (derived-mode-p 'log-view-mode)
+     ((and (not buffer-file-name)
 	   (setq backend (vc-responsible-backend default-directory)))
       (list backend nil))
      ((not buffer-file-name)
-       (error "Buffer %s is not associated with a file" (buffer-name)))
+       (error "Buffer %s is not recognized by any VC backend" 
(buffer-name)))
      ((and allow-unregistered (not (vc-registered buffer-file-name)))
       (if state-model-only-files
 	  (list (vc-backend-for-registration (buffer-file-name))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41974; Package emacs. (Tue, 23 Jun 2020 00:16:02 GMT) Full text and rfc822 format available.

Message #17 received at 41974 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 41974 <at> debbugs.gnu.org
Subject: Re: bug#41974: 28.0.50; Some vc commands refuse to work when called
 on non-file buffer
Date: Tue, 23 Jun 2020 02:38:39 +0300
> How about this:
>
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index 9b12d44978..6bb72d8976 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -1074,11 +1074,11 @@ vc-deduce-fileset
>        (progn                  ;FIXME: Why not
>        `with-current-buffer'? --Stef.
>  	(set-buffer vc-parent-buffer)
>  	(vc-deduce-fileset not-state-changing allow-unregistered
>  	state-model-only-files)))
> -     ((and (derived-mode-p 'log-view-mode)
> +     ((and (not buffer-file-name)
>  	   (setq backend (vc-responsible-backend default-directory)))
>        (list backend nil))

Thanks for finding the right place to fix, and it should also fix all
other vc commands that failed on non-file buffers.

>       ((not buffer-file-name)
> -       (error "Buffer %s is not associated with a file" (buffer-name)))
> +       (error "Buffer %s is not recognized by any VC backend"

It seems this code is not necessary anymore because before this code
gets executed, vc-responsible-backend already signals its error
"No VC backend is responsible for file".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41974; Package emacs. (Tue, 23 Jun 2020 00:35:02 GMT) Full text and rfc822 format available.

Message #20 received at 41974 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: 41974 <at> debbugs.gnu.org
Subject: Re: bug#41974: 28.0.50; Some vc commands refuse to work when called
 on non-file buffer
Date: Tue, 23 Jun 2020 03:34:28 +0300
On 23.06.2020 02:38, Juri Linkov wrote:
>>        ((not buffer-file-name)
>> -       (error "Buffer %s is not associated with a file" (buffer-name)))
>> +       (error "Buffer %s is not recognized by any VC backend"
> It seems this code is not necessary anymore because before this code
> gets executed, vc-responsible-backend already signals its error
> "No VC backend is responsible for file".

Even better.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41974; Package emacs. (Wed, 24 Jun 2020 00:05:02 GMT) Full text and rfc822 format available.

Message #23 received at 41974 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 41974 <at> debbugs.gnu.org
Subject: Re: bug#41974: 28.0.50; Some vc commands refuse to work when called
 on non-file buffer
Date: Wed, 24 Jun 2020 02:54:58 +0300
tags 41974 fixed
close 41974 28.0.50
quit

>>>        ((not buffer-file-name)
>>> -       (error "Buffer %s is not associated with a file" (buffer-name)))
>>> +       (error "Buffer %s is not recognized by any VC backend"
>> It seems this code is not necessary anymore because before this code
>> gets executed, vc-responsible-backend already signals its error
>> "No VC backend is responsible for file".
>
> Even better.

Thanks, pushed to master.




Added tag(s) fixed. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 24 Jun 2020 00:05:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.0.50, send any further explanations to 41974 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 24 Jun 2020 00:05:02 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, 22 Jul 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 19 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.