emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106043: In vc actions use quit-windo


From: martin rudalics
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106043: In vc actions use quit-windows-on instead of delete-windows-on.
Date: Mon, 10 Oct 2011 19:52:03 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106043
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Mon 2011-10-10 19:52:03 +0200
message:
  In vc actions use quit-windows-on instead of delete-windows-on.
  
  * window.el (quit-windows-on): New function.
  * vc/vc.el (vc-revert, vc-rollback):
  * vc/vc-dispatcher.el (vc-finish-logentry): Call quit-windows-on
  instead of deleting windows.  (Bug#4557) (Bug#5310) (Bug#5556)
  (Bug#6183) (Bug#7074)((Bug#7447)
modified:
  lisp/ChangeLog
  lisp/vc/vc-dispatcher.el
  lisp/vc/vc.el
  lisp/window.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-10-10 06:31:07 +0000
+++ b/lisp/ChangeLog    2011-10-10 17:52:03 +0000
@@ -3,6 +3,12 @@
        * window.el (special-display-buffer-names)
        (special-display-regexps): Remove some remnants of earlier
        changes from doc-strings.
+       (quit-windows-on): New function.
+
+       * vc/vc.el (vc-revert, vc-rollback):
+       * vc/vc-dispatcher.el (vc-finish-logentry): Call quit-windows-on
+       instead of deleting windows.  (Bug#4557) (Bug#5310) (Bug#5556)
+       (Bug#6183) (Bug#7074)((Bug#7447)
 
 2011-10-09  Martin Rudalics  <address@hidden>
 

=== modified file 'lisp/vc/vc-dispatcher.el'
--- a/lisp/vc/vc-dispatcher.el  2011-02-19 21:23:51 +0000
+++ b/lisp/vc/vc-dispatcher.el  2011-10-10 17:52:03 +0000
@@ -666,18 +666,15 @@
       (funcall log-operation
               log-fileset
               log-entry))
-    ;; Remove checkin window (after the checkin so that if that fails
-    ;; we don't zap the log buffer and the typing therein).
-    ;; -- IMO this should be replaced with quit-window
-    (cond ((and logbuf vc-delete-logbuf-window)
-          (delete-windows-on logbuf (selected-frame))
-          ;; Kill buffer and delete any other dedicated windows/frames.
-          (kill-buffer logbuf))
-         (logbuf
-           (with-selected-window (or (get-buffer-window logbuf 0)
-                                     (selected-window))
-             (with-current-buffer logbuf
-               (bury-buffer)))))
+
+    ;; Quit windows on logbuf.
+    (cond
+     ((not logbuf))
+     (vc-delete-logbuf-window
+      (quit-windows-on logbuf t (selected-frame)))
+     (t
+      (quit-windows-on logbuf nil 0)))
+
     ;; Now make sure we see the expanded headers
     (when log-fileset
       (mapc

=== modified file 'lisp/vc/vc.el'
--- a/lisp/vc/vc.el     2011-07-13 07:58:34 +0000
+++ b/lisp/vc/vc.el     2011-10-10 17:52:03 +0000
@@ -2302,8 +2302,7 @@
                                       (if (= nfiles 1) "" "s"))))))
            (error "Revert canceled")))
       (when diff-buffer
-       (delete-windows-on diff-buffer)
-       (kill-buffer diff-buffer)))
+       (quit-windows-on diff-buffer t)))
     (dolist (file files)
       (message "Reverting %s..." (vc-delistify files))
       (vc-revert-file file)
@@ -2349,8 +2348,7 @@
     ;; Display changes
     (unless (yes-or-no-p "Discard these revisions? ")
       (error "Rollback canceled"))
-    (delete-windows-on "*vc-diff*")
-    (kill-buffer"*vc-diff*")
+    (quit-windows-on "*vc-diff*" t)
     ;; Do the actual reversions
     (message "Rolling back %s..." (vc-delistify files))
     (with-vc-properties

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2011-10-10 06:31:07 +0000
+++ b/lisp/window.el    2011-10-10 17:52:03 +0000
@@ -2984,6 +2984,27 @@
     (if kill
        (kill-buffer buffer)
       (bury-buffer-internal buffer))))
+
+(defun quit-windows-on (&optional buffer-or-name kill frame)
+  "Quit all windows showing BUFFER-OR-NAME.
+BUFFER-OR-NAME may be a buffer or the name of an existing buffer
+and defaults to the current buffer.  Optional argument KILL
+non-nil means to kill BUFFER-OR-NAME.  KILL nil means to bury
+BUFFER-OR-NAME.  Optional argument FRAME is handled as by
+`delete-windows-on'.
+
+This function calls `quit-window' on all candidate windows
+showing BUFFER-OR-NAME."
+  (interactive "BQuit windows on (buffer):\nP")
+  (let ((buffer (window-normalize-buffer buffer-or-name))
+       ;; Handle the "inverted" meaning of the FRAME argument wrt other
+       ;; `window-list-1' based function.
+       (all-frames (cond ((not frame) t) ((eq frame t) nil) (t frame))))
+    (dolist (window (window-list-1 nil nil all-frames))
+      (if (eq (window-buffer window) buffer)
+         (quit-window kill window)
+       ;; If a window doesn't show BUFFER, unrecord BUFFER in it.
+       (unrecord-window-buffer window buffer)))))
 
 ;;; Splitting windows.
 (defsubst window-split-min-size (&optional horizontal)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]