unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5310: 23.1; vc-revert modifies window configuration
@ 2010-01-04  5:14 Nathaniel Flath
  2010-01-30  3:14 ` bug#5310: Patch Attached Nathaniel Flath
  2011-10-10 18:19 ` bug#5310: vc-revert modifies window configuration martin rudalics
  0 siblings, 2 replies; 4+ messages in thread
From: Nathaniel Flath @ 2010-01-04  5:14 UTC (permalink / raw)
  To: bug-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 4665 bytes --]

To: bug-gnu-emacs@gnu.org
Subject: 23.1; vc-revert modifies window configuration
--text follows this line--

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

When calling vc-revert on a window configuration other than the default, it
is likely to change as a result.

To reproduce:
emacs -q
C-x 3
In one window, open a file under version control and modify it
M-x vc-revert
confirm the reversion

At this point, the second window will be closed.

The attached patch fixes this problem.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.18.3)
 of 2009-11-10 on vernadsky, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10604000
configured using `configure  '--build=i486-linux-gnu'
'--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var/lib'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim'
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g
-O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Shell

Minor modes in effect:
  diff-auto-refine-mode: t
  save-visited-files-mode: t
  savehist-mode: t
  dirtrack-mode: t
  global-pabbrev-mode: t
  icomplete-mode: t
  display-battery-mode: t
  display-time-mode: t
  show-paren-mode: t
  cua-mode: t
  command-frequency-autosave-mode: t
  command-frequency-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-p M-< C-x o M-> M-p C-a M-f C-f
v c . e l SPC C-a M-f SPC - j <backspace> u <return>
C-x C-f <backspace> <backspace> v c <return> M-< C-n
C-n C-k C-k C-k C-k C-k C-/ C-/ C-k C-k C-k C-d C-d
C-d C-d C-d C-d C-d C-d C-p C-p C-k C-k C-k C-k C-d
C-d C-d C-d C-d C-d C-d C-d C-n C-x C-s C-x b <return>
M-p <return> M-p M-p M-p M-p M-p M-m M-n C-a M-f M-f
M-f <tab> b <home> <backspace> <backspace> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <backspace> <backspace>
N a u f <backspace> r <return> C-x p o C-x <tab> t
t C-g C-g C-c C-c M-p C-w C-w <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <return>
C-x o C-x C-f v c . e l <return> y C-p C-n C-M-b C-n
C-n C-n C-n C-n C-x C-s C-a C-f C-f C-f C-f C-f C-f
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-a C-p C-p C-p
C-p C-x v = C-x k <return> C-x o M-x v c SPC r e v
e r t SPC f <backspace> <backspace> <return> <return>
y C-n C-n C-n C-n C-n C-p C-x v = C-x k <return> C-x
o C-x o C-x b <return> C-c C-c M-p M-p M-p M-p M-n
<return> C-x o d r C-x o r r <backspace> C-x C-s C-x
o M-x r e p o r t SPC e m a c s SPC b u g <return>

Recent messages:
vc.el changed on disk; really edit the buffer? (y, n, r or C-h)
Please type y, n or r; or ? for help
vc.el changed on disk; really edit the buffer? (y, n, r or C-h)
byte-code: File reverted: /home/nflath/emacs/lisp/vc.el
Saving file /home/nflath/emacs/lisp/vc.el...
Wrote /home/nflath/emacs/lisp/vc.el

Saving file /home/nflath/.emacs.d/emacs-visited-files...
Wrote /home/nflath/.emacs.d/emacs-visited-files
defun: (NAME ARGLIST [DOCSTRING] BODY...)

[-- Attachment #1.2: Type: text/html, Size: 5622 bytes --]

[-- Attachment #2: vc-revert.patch --]
[-- Type: text/x-patch, Size: 3161 bytes --]

--- vc.el	7 Dec 2009 09:02:16 -0000	1.746
+++ vc.el	4 Jan 2010 04:10:54 -0000
@@ -1975,37 +1975,38 @@
 This asks for confirmation if the buffer contents are not identical
 to the working revision (except for keyword expansion)."
   (interactive)
-  (let* ((vc-fileset (vc-deduce-fileset))
-	 (files (cadr vc-fileset)))
-    ;; If any of the files is visited by the current buffer, make
-    ;; sure buffer is saved.  If the user says `no', abort since
-    ;; we cannot show the changes and ask for confirmation to
-    ;; discard them.
-    (when (or (not files) (memq (buffer-file-name) files))
-      (vc-buffer-sync nil))
-    (dolist (file files)
-      (let ((buf (get-file-buffer file)))
-	(when (and buf (buffer-modified-p buf))
-	  (error "Please kill or save all modified buffers before reverting")))
-      (when (vc-up-to-date-p file)
-	(unless (yes-or-no-p (format "%s seems up-to-date.  Revert anyway? " file))
-	  (error "Revert canceled"))))
-    (when (vc-diff-internal vc-allow-async-revert vc-fileset nil nil)
-      (unless (yes-or-no-p
-	       (format "Discard changes in %s? "
-		       (let ((str (vc-delistify files))
-			     (nfiles (length files)))
-			 (if (< (length str) 50)
-			     str
-			   (format "%d file%s" nfiles
-				   (if (= nfiles 1) "" "s"))))))
-	(error "Revert canceled"))
-      (delete-windows-on "*vc-diff*")
-      (kill-buffer "*vc-diff*"))
-    (dolist (file files)
-      (message "Reverting %s..." (vc-delistify files))
-      (vc-revert-file file)
-      (message "Reverting %s...done" (vc-delistify files)))))
+  (save-window-excursion
+   (let* ((vc-fileset (vc-deduce-fileset))
+          (files (cadr vc-fileset)))
+     ;; If any of the files is visited by the current buffer, make
+     ;; sure buffer is saved.  If the user says `no', abort since
+     ;; we cannot show the changes and ask for confirmation to
+     ;; discard them.
+     (when (or (not files) (memq (buffer-file-name) files))
+       (vc-buffer-sync nil))
+     (dolist (file files)
+       (let ((buf (get-file-buffer file)))
+         (when (and buf (buffer-modified-p buf))
+           (error "Please kill or save all modified buffers before reverting")))
+       (when (vc-up-to-date-p file)
+         (unless (yes-or-no-p (format "%s seems up-to-date.  Revert anyway? " file))
+           (error "Revert canceled"))))
+     (when (vc-diff-internal vc-allow-async-revert vc-fileset nil nil)
+       (unless (yes-or-no-p
+                (format "Discard changes in %s? "
+                        (let ((str (vc-delistify files))
+                              (nfiles (length files)))
+                          (if (< (length str) 50)
+                              str
+                            (format "%d file%s" nfiles
+                                    (if (= nfiles 1) "" "s"))))))
+         (error "Revert canceled"))
+       (delete-windows-on "*vc-diff*")
+       (kill-buffer "*vc-diff*"))
+     (dolist (file files)
+       (message "Reverting %s..." (vc-delistify files))
+       (vc-revert-file file)
+       (message "Reverting %s...done" (vc-delistify files))))))

 ;;;###autoload
 (defun vc-rollback ()

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#5310: Patch Attached
  2010-01-04  5:14 bug#5310: 23.1; vc-revert modifies window configuration Nathaniel Flath
@ 2010-01-30  3:14 ` Nathaniel Flath
  2011-10-10 18:19 ` bug#5310: vc-revert modifies window configuration martin rudalics
  1 sibling, 0 replies; 4+ messages in thread
From: Nathaniel Flath @ 2010-01-30  3:14 UTC (permalink / raw)
  To: 5310

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

My apologies - looking at this in the bug tracker does not appear to show
the patch.  I must have forgotten to attach it, somehow.  The patch is as
follows:

--- vc.el    7 Dec 2009 09:02:16 -0000    1.746
+++ vc.el    4 Jan 2010 04:10:54 -0000
@@ -1975,37 +1975,38 @@
 This asks for confirmation if the buffer contents are not identical
 to the working revision (except for keyword expansion)."
   (interactive)
-  (let* ((vc-fileset (vc-deduce-fileset))
-     (files (cadr vc-fileset)))
-    ;; If any of the files is visited by the current buffer, make
-    ;; sure buffer is saved.  If the user says `no', abort since
-    ;; we cannot show the changes and ask for confirmation to
-    ;; discard them.
-    (when (or (not files) (memq (buffer-file-name) files))
-      (vc-buffer-sync nil))
-    (dolist (file files)
-      (let ((buf (get-file-buffer file)))
-    (when (and buf (buffer-modified-p buf))
-      (error "Please kill or save all modified buffers before reverting")))
-      (when (vc-up-to-date-p file)
-    (unless (yes-or-no-p (format "%s seems up-to-date.  Revert anyway? "
file))
-      (error "Revert canceled"))))
-    (when (vc-diff-internal vc-allow-async-revert vc-fileset nil nil)
-      (unless (yes-or-no-p
-           (format "Discard changes in %s? "
-               (let ((str (vc-delistify files))
-                 (nfiles (length files)))
-             (if (< (length str) 50)
-                 str
-               (format "%d file%s" nfiles
-                   (if (= nfiles 1) "" "s"))))))
-    (error "Revert canceled"))
-      (delete-windows-on "*vc-diff*")
-      (kill-buffer "*vc-diff*"))
-    (dolist (file files)
-      (message "Reverting %s..." (vc-delistify files))
-      (vc-revert-file file)
-      (message "Reverting %s...done" (vc-delistify files)))))
+  (save-window-excursion
+   (let* ((vc-fileset (vc-deduce-fileset))
+          (files (cadr vc-fileset)))
+     ;; If any of the files is visited by the current buffer, make
+     ;; sure buffer is saved.  If the user says `no', abort since
+     ;; we cannot show the changes and ask for confirmation to
+     ;; discard them.
+     (when (or (not files) (memq (buffer-file-name) files))
+       (vc-buffer-sync nil))
+     (dolist (file files)
+       (let ((buf (get-file-buffer file)))
+         (when (and buf (buffer-modified-p buf))
+           (error "Please kill or save all modified buffers before
reverting")))
+       (when (vc-up-to-date-p file)
+         (unless (yes-or-no-p (format "%s seems up-to-date.  Revert anyway?
" file))
+           (error "Revert canceled"))))
+     (when (vc-diff-internal vc-allow-async-revert vc-fileset nil nil)
+       (unless (yes-or-no-p
+                (format "Discard changes in %s? "
+                        (let ((str (vc-delistify files))
+                              (nfiles (length files)))
+                          (if (< (length str) 50)
+                              str
+                            (format "%d file%s" nfiles
+                                    (if (= nfiles 1) "" "s"))))))
+         (error "Revert canceled"))
+       (delete-windows-on "*vc-diff*")
+       (kill-buffer "*vc-diff*"))
+     (dolist (file files)
+       (message "Reverting %s..." (vc-delistify files))
+       (vc-revert-file file)
+       (message "Reverting %s...done" (vc-delistify files))))))

 ;;;###autoload
 (defun vc-rollback ()

[-- Attachment #2: Type: text/html, Size: 3922 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#5310: vc-revert modifies window configuration
  2010-01-04  5:14 bug#5310: 23.1; vc-revert modifies window configuration Nathaniel Flath
  2010-01-30  3:14 ` bug#5310: Patch Attached Nathaniel Flath
@ 2011-10-10 18:19 ` martin rudalics
  2011-10-12  7:01   ` martin rudalics
  1 sibling, 1 reply; 4+ messages in thread
From: martin rudalics @ 2011-10-10 18:19 UTC (permalink / raw)
  To: 5310

 > When calling vc-revert on a window configuration other than the default, it
 > is likely to change as a result.
 >
 > To reproduce:
 > emacs -q
 > C-x 3
 > In one window, open a file under version control and modify it
 > M-x vc-revert
 > confirm the reversion
 >
 > At this point, the second window will be closed.

I checked in a slightly different fix.  Please have a look.

Thanks, martin





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#5310: vc-revert modifies window configuration
  2011-10-10 18:19 ` bug#5310: vc-revert modifies window configuration martin rudalics
@ 2011-10-12  7:01   ` martin rudalics
  0 siblings, 0 replies; 4+ messages in thread
From: martin rudalics @ 2011-10-12  7:01 UTC (permalink / raw)
  To: 5310-done

> I checked in a slightly different fix.  Please have a look.

Closed, martin






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-12  7:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-04  5:14 bug#5310: 23.1; vc-revert modifies window configuration Nathaniel Flath
2010-01-30  3:14 ` bug#5310: Patch Attached Nathaniel Flath
2011-10-10 18:19 ` bug#5310: vc-revert modifies window configuration martin rudalics
2011-10-12  7:01   ` martin rudalics

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).