emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/window.el,v


From: Martin Rudalics
Subject: [Emacs-diffs] Changes to emacs/lisp/window.el,v
Date: Sun, 02 Nov 2008 11:02:26 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Martin Rudalics <m061211>       08/11/02 11:02:25

Index: window.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/window.el,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -b -r1.160 -r1.161
--- window.el   31 Oct 2008 13:39:06 -0000      1.160
+++ window.el   2 Nov 2008 11:02:24 -0000       1.161
@@ -69,6 +69,27 @@
         (if (window-live-p save-selected-window-window)
             (select-window save-selected-window-window))))))
 
+(defmacro save-selected-window-norecord (&rest body)
+  "Execute BODY, then select, but do not record previously selected window.
+This macro is like `save-selected-window' but changes neither the
+order of recently selected windows nor the buffer list."
+  `(let ((save-selected-window-window (selected-window))
+        ;; It is necessary to save all of these, because calling
+        ;; select-window changes frame-selected-window for whatever
+        ;; frame that window is in.
+        (save-selected-window-alist
+         (mapcar (lambda (frame) (cons frame (frame-selected-window frame)))
+                 (frame-list))))
+     (save-current-buffer
+       (unwind-protect
+          (progn ,@body)
+        (dolist (elt save-selected-window-alist)
+          (and (frame-live-p (car elt))
+               (window-live-p (cdr elt))
+               (set-frame-selected-window (car elt) (cdr elt) 'norecord)))
+        (when (window-live-p save-selected-window-window)
+          (select-window save-selected-window-window 'norecord))))))
+
 (defun window-body-height (&optional window)
   "Return number of lines in WINDOW available for actual buffer text.
 WINDOW defaults to the selected window.
@@ -162,13 +183,20 @@
 ALL-FRAMES a frame means cycle through all windows on that frame
  only.
 Anything else means cycle through all windows on WINDOW's frame
- and no others."
-  ;; If we start from the minibuffer window, don't fail to come back to it.
-  (if (window-minibuffer-p (selected-window))
+ and no others.
+
+This function changes neither the order of recently selected
+windows nor the buffer list."
+  ;; If we start from the minibuffer window, don't fail to come
+  ;; back to it.
+  (when (window-minibuffer-p (selected-window))
       (setq minibuf t))
-  (save-selected-window
-    (if (framep all-frames)
-       (select-window (frame-first-window all-frames)))
+  ;; Make sure to not mess up the order of recently selected
+  ;; windows.  Use `save-selected-window-norecord' and `select-window'
+  ;; with second argument non-nil for this purpose.
+  (save-selected-window-norecord
+    (when (framep all-frames)
+      (select-window (frame-first-window all-frames) 'norecord))
     (let* (walk-windows-already-seen
           (walk-windows-current (selected-window)))
       (while (progn
@@ -1202,10 +1230,10 @@
       ;; bizarre displays because it also allows Emacs to make *other*
       ;; windows 1-line tall, which means that there's no more space for
       ;; the modeline.
-      (let ((window-min-height (min 2 height))) ;One text line plus a modeline.
+      (let ((window-min-height (min 2 height))) ; One text line plus a 
modeline.
        (if (and window (not (eq window (selected-window))))
-           (save-selected-window
-             (select-window window)
+           (save-selected-window-norecord
+             (select-window window 'norecord)
              (enlarge-window delta))
          (enlarge-window delta))))))
 
@@ -1322,8 +1350,8 @@
            (and (eobp) (bolp) (not (bobp))))
       (set-window-point window (1- (window-point window))))
 
-    (save-selected-window
-      (select-window window)
+    (save-selected-window-norecord
+      (select-window window 'norecord)
 
       ;; Adjust WINDOW to the nominally correct size (which may actually
       ;; be slightly off because of variable height text, etc).
@@ -1373,7 +1401,7 @@
         (mini (frame-parameter frame 'minibuffer))
         (edges (window-edges window)))
     (if (and (not (eq window (frame-root-window frame)))
-            (window-safely-shrinkable-p)
+            (window-safely-shrinkable-p window)
             (pos-visible-in-window-p (point-min) window)
             (not (eq mini 'only))
             (or (not mini)




reply via email to

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