all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 60897@debbugs.gnu.org, epg@pretzelnet.org
Subject: bug#60897: 29.0.60; vc-revert fails to revert buffer
Date: Tue, 24 Jan 2023 19:46:51 +0200	[thread overview]
Message-ID: <864jsfygsw.fsf@mail.linkov.net> (raw)
In-Reply-To: <83v8kxidu2.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 23 Jan 2023 15:24:05 +0200")

>> >> >  (defun vc-resynch-buffer (file &optional keep noquery reset-vc-info)
>> >> >    "If FILE is currently visited, resynch its buffer."
>> >> > +  (unless (file-name-absolute-p file)
>> >> > +    (setq file (expand-file-name file (vc-root-dir))))
>> >> >    (if (string= buffer-file-name file)
>> >> >        (vc-resynch-window file keep noquery reset-vc-info)
>> >> >      (if (file-directory-p file)
>>
>> There is another string= call that fails inside vc-resynch-window
>> called from vc-resynch-buffer.
>
> How about replacing string= in these two cases with something smarter,
> which would expand-file-name?  Comparing file names as simple strings
> is wrought with trouble anyway.

This works as well:

diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index e1a3eff448d..8a0cdef4726 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -608,7 +608,7 @@ vc-resynch-window
 difference between the buffer and the file is due to
 modifications by the dispatcher client code, rather than user
 editing!"
-  (and (string= buffer-file-name file)
+  (and (string-prefix-p file buffer-file-name)
        (if keep
 	   (when (file-exists-p file)
 	     (when reset-vc-info
@@ -643,7 +643,7 @@ vc-resynch-buffers-in-directory
 
 (defun vc-resynch-buffer (file &optional keep noquery reset-vc-info)
   "If FILE is currently visited, resynch its buffer."
-  (if (string= buffer-file-name file)
+  (if (string-prefix-p file buffer-file-name)
       (vc-resynch-window file keep noquery reset-vc-info)
     (if (file-directory-p file)
 	(vc-resynch-buffers-in-directory file keep noquery reset-vc-info)





  reply	other threads:[~2023-01-24 17:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  1:09 bug#60897: 29.0.60; vc-revert fails to revert buffer Eric Gillespie
2023-01-18 17:29 ` Juri Linkov
2023-01-21  0:54   ` Eric Gillespie
2023-01-22 17:12     ` Juri Linkov
2023-01-22 17:17   ` Juri Linkov
2023-01-22 19:50     ` Eli Zaretskii
2023-01-23  7:51       ` Juri Linkov
2023-01-23 13:24         ` Eli Zaretskii
2023-01-24 17:46           ` Juri Linkov [this message]
2023-01-24 18:06             ` Eli Zaretskii
2023-01-24 18:18               ` Juri Linkov
2023-01-24 18:36                 ` Eli Zaretskii
2023-01-24 18:49                   ` 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

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

  git send-email \
    --in-reply-to=864jsfygsw.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=60897@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=epg@pretzelnet.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.