unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jens Schmidt via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 63949@debbugs.gnu.org
Subject: bug#63949: 30.0.50; `vc-print-log´ does not erase buffer when called from *vc-change-log* buffer, at least for CVS logs
Date: Fri, 9 Jun 2023 00:44:39 +0200	[thread overview]
Message-ID: <965f7636-1bac-02ff-e9f2-d6848aa2df4b@vodafonemail.de> (raw)
In-Reply-To: <8c62dd9a-3cad-b992-bfc4-64b2f1db4485@vodafonemail.de>

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

Here come five patches for this issue, based on emacs-29:

0001-Always-erase-log-buffer-before-calling-vc-print-log.patch
0002-Always-erase-log-buffer-before-calling-vc-print-log.patch
0003-Always-erase-log-buffer-before-calling-vc-print-log.patch

   Name should be self-explaining, patches uncritical.

0004-Fix-documentation-bug-and-remove-obsolete-fixmes.patch

   `vc-deduce-fileset' uses `with-current-buffer' to protect the current
   buffer, which has not been reflected in comments.

0005-Avoid-setting-circular-vc-parent-buffer.patch

   This one fixes the issue related to VC parent buffer described in the
   previous update.  The "local" change seems to be logical (a buffer
   should not be the VC parent buffer of itself), but I'm not quite sure
   about any adverse "global" consequences.

[-- Attachment #2: 0001-Always-erase-log-buffer-before-calling-vc-print-log.patch --]
[-- Type: text/x-patch, Size: 1094 bytes --]

From 9e3cb8038ea5bea3e2f129f0271a0cf3ec948159 Mon Sep 17 00:00:00 2001
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Date: Thu, 8 Jun 2023 23:36:46 +0200
Subject: [PATCH 1/5] Always erase log buffer before calling `vc-*-print-log'

When calling `vc-print-log' from buffer *vc-change-log* itself for
backends SCCS, RCS, and CVS, the log information is inserted or
appended to the *vc-change-log* buffer again without previously
erasing it.
* lisp/vc/vc-sccs.el (vc-sccs-print-log): Add call to
`vc-setup-buffer'. (Bug#63949)
---
 lisp/vc/vc-sccs.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index 03e9d12b76f..e5430753a64 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -310,6 +310,8 @@ vc-sccs-print-log
   "Print commit log associated with FILES into specified BUFFER.
 Remaining arguments are ignored."
   (setq files (vc-expand-dirs files 'SCCS))
+  (save-current-buffer
+    (vc-setup-buffer buffer))
   (vc-sccs-do-command buffer 0 "prs" (mapcar #'vc-master-name files))
   (when limit 'limit-unsupported))
 
-- 
2.30.2


[-- Attachment #3: 0002-Always-erase-log-buffer-before-calling-vc-print-log.patch --]
[-- Type: text/x-patch, Size: 1111 bytes --]

From 4cb5eaa2166103d645fa77972b456dd6a4fad282 Mon Sep 17 00:00:00 2001
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Date: Thu, 8 Jun 2023 23:37:45 +0200
Subject: [PATCH 2/5] Always erase log buffer before calling `vc-*-print-log'

When calling `vc-print-log' from buffer *vc-change-log* itself for
backends SCCS, RCS, and CVS, the log information is inserted or
appended to the *vc-change-log* buffer again without previously
erasing it.
* lisp/vc/vc-cvs.el (vc-cvs-print-log): Add call to
`vc-setup-buffer'. (Bug#63949)
---
 lisp/vc/vc-cvs.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 6e0246ea762..cf74ac31154 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -550,6 +550,8 @@ vc-cvs-modify-change-comment
 (defun vc-cvs-print-log (files buffer &optional _shortlog _start-revision limit)
   "Print commit log associated with FILES into specified BUFFER.
 Remaining arguments are ignored."
+  (save-current-buffer
+    (vc-setup-buffer buffer))
   ;; It's just the catenation of the individual logs.
   (vc-cvs-command
    buffer
-- 
2.30.2


[-- Attachment #4: 0003-Always-erase-log-buffer-before-calling-vc-print-log.patch --]
[-- Type: text/x-patch, Size: 1114 bytes --]

From 4eb1a951229d96026ca58f965c652ab8e8392812 Mon Sep 17 00:00:00 2001
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Date: Thu, 8 Jun 2023 23:38:45 +0200
Subject: [PATCH 3/5] Always erase log buffer before calling `vc-*-print-log'

When calling `vc-print-log' from buffer *vc-change-log* itself for
backends SCCS, RCS, and CVS, the log information is inserted or
appended to the *vc-change-log* buffer again without previously
erasing it.
* lisp/vc/vc-rcs.el (vc-rcs-print-log): Add call to
`vc-setup-buffer'. (Bug#63949)
---
 lisp/vc/vc-rcs.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index c2112b76ad3..05846a7de35 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -548,6 +548,8 @@ vc-rcs-print-log
 Remaining arguments are ignored.
 If FILE is a directory the operation is applied to all registered
 files beneath it."
+  (save-current-buffer
+    (vc-setup-buffer buffer))
   (vc-do-command (or buffer "*vc*") 0 "rlog"
                  (mapcar #'vc-master-name (vc-expand-dirs files 'RCS)))
   (with-current-buffer (or buffer "*vc*")
-- 
2.30.2


[-- Attachment #5: 0004-Fix-documentation-bug-and-remove-obsolete-fixmes.patch --]
[-- Type: text/x-patch, Size: 1513 bytes --]

From 8f62cd7bbe336ba0668afb72cbbbd8c46c15376a Mon Sep 17 00:00:00 2001
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Date: Thu, 8 Jun 2023 23:46:33 +0200
Subject: [PATCH 4/5] Fix documentation bug and remove obsolete fixmes

Function `vc-deduce-fileset' preserves current buffer since commit
d494833d47968fcd97ba549654a259d6fb6c2eee.  Change documentation
accordingly.
* lisp/vc/vc.el (vc-deduce-fileset): Change doc string.
(vc-deduce-fileset-1): Remove now-obsolete fixme comment.  (Bug#63949)
---
 lisp/vc/vc.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 1144a23f317..6b99eba9d3b 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1120,7 +1120,7 @@ vc-deduce-fileset
 `vc-checkout-model'.  Otherwise, these 3 members may be omitted from
 the returned list.
 
-BEWARE: this function may change the current buffer."
+This function preserves the current buffer."
   (with-current-buffer (or (buffer-base-buffer) (current-buffer))
     (vc-deduce-fileset-1 not-state-changing
                          allow-unregistered
@@ -1151,7 +1151,7 @@ vc-deduce-fileset-1
 				  (or (derived-mode-p 'vc-dir-mode)
 				      (derived-mode-p 'dired-mode)
 				      (derived-mode-p 'diff-mode)))))
-      (progn                  ;FIXME: Why not `with-current-buffer'? --Stef.
+      (progn
 	(set-buffer vc-parent-buffer)
 	(vc-deduce-fileset-1 not-state-changing allow-unregistered state-model-only-files)))
      ((and (not buffer-file-name)
-- 
2.30.2


[-- Attachment #6: 0005-Avoid-setting-circular-vc-parent-buffer.patch --]
[-- Type: text/x-patch, Size: 1476 bytes --]

From 9f3fc16ac6eb2fbf6c73aef5e47569dba2cb5d80 Mon Sep 17 00:00:00 2001
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Date: Fri, 9 Jun 2023 00:24:28 +0200
Subject: [PATCH 5/5] Avoid setting circular `vc-parent-buffer'

Otherwise, calling e.g. `vc-print-log' from buffer *vc-change-log*
sets `vc-parent-buffer' to itself.
* lisp/vc/vc-dispatcher.el (vc-setup-buffer): Avoid setting circular
`vc-parent-buffer'.  (Bug#63949)
---
 lisp/vc/vc-dispatcher.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index fd5f655a0f6..ac4d3a78afd 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -186,10 +186,13 @@ vc-setup-buffer
       ;; want any of its output to appear from now on.
       (when oldproc (delete-process oldproc)))
     (kill-all-local-variables)
-    (setq-local vc-parent-buffer camefrom)
-    (setq-local vc-parent-buffer-name
-                (concat " from " (buffer-name camefrom)))
-    (setq default-directory olddir)
+    ;; Do not set the VC parent buffer and related variables to
+    ;; ourselves.  (Bug#63949)
+    (unless (equal (current-buffer) camefrom)
+      (setq-local vc-parent-buffer camefrom)
+      (setq-local vc-parent-buffer-name
+                  (concat " from " (buffer-name camefrom)))
+      (setq default-directory olddir))
     (let ((buffer-undo-list t)
           (inhibit-read-only t))
       (erase-buffer))))
-- 
2.30.2


  parent reply	other threads:[~2023-06-08 22:44 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 21:04 bug#63949: 30.0.50; `vc-print-log´ does not erase buffer when called from *vc-change-log* buffer, at least for CVS logs Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-08 13:12 ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-08 20:21   ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-08 21:33     ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-08 22:10       ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-09  6:09         ` Eli Zaretskii
2023-06-09 20:27           ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-10  6:01             ` Eli Zaretskii
2023-06-10 15:44               ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-10 15:55                 ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-10 17:23                 ` Eli Zaretskii
2023-06-10 21:18                   ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-11  5:06                     ` Eli Zaretskii
2023-06-16 19:33                   ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-17  3:15                     ` Dmitry Gutov
2023-06-18  2:42                     ` Dmitry Gutov
2023-06-18  5:35                       ` Eli Zaretskii
2023-06-18  9:11                         ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-18 12:00                           ` Dmitry Gutov
     [not found]                             ` <e695eaa4-2f39-1b20-1cd4-fe7fdaeb3d61@vodafonemail.de>
2023-06-20  2:41                               ` Dmitry Gutov
2023-06-21 13:03                                 ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-21 14:37                                   ` Dmitry Gutov
2023-06-21 15:30                                     ` Eli Zaretskii
2023-06-24  3:08                                       ` Dmitry Gutov
2023-06-26 19:54                                         ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-29 21:37                                         ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30  5:57                                           ` Eli Zaretskii
2023-07-17 19:53                                             ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18  0:55                                               ` Dmitry Gutov
2023-07-18 11:08                                                 ` Eli Zaretskii
2023-06-08 22:44 ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-06-09  6:41   ` Eli Zaretskii
2023-06-09 18:44     ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-08 23:09 ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=965f7636-1bac-02ff-e9f2-d6848aa2df4b@vodafonemail.de \
    --to=bug-gnu-emacs@gnu.org \
    --cc=63949@debbugs.gnu.org \
    --cc=jschmidt4gnu@vodafonemail.de \
    /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).