all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#42914: [PATCH] Fixed indentation and mix used of space and tabs.
@ 2020-08-18 14:02 Jen-Chieh Shen
  2020-08-18 14:11 ` Eli Zaretskii
  2020-08-18 14:13 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Jen-Chieh Shen @ 2020-08-18 14:02 UTC (permalink / raw)
  To: 42914


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

When I am editing the file `lisp/window.el` I found some indentation issues
and mixed use of space and tab. Is there a specific reason that these
issues exist?

Best,

Jen-Chieh Shen

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

[-- Attachment #2: ind-and-mix.patch --]
[-- Type: application/octet-stream, Size: 366811 bytes --]

From 98e9a7d41c66a7d0821283472dcfa1c84dba9bb0 Mon Sep 17 00:00:00 2001
From: jenchieh <jcs090218@gmail.com>
Date: Tue, 18 Aug 2020 21:55:16 +0800
Subject: [PATCH] Fixed indentation and mix used of space and tabs.

---
 lisp/window.el | 6236 ++++++++++++++++++++++++------------------------
 1 file changed, 3118 insertions(+), 3118 deletions(-)

diff --git a/lisp/window.el b/lisp/window.el
index bb34a6d7b4..cadc963cb8 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -76,7 +76,7 @@ are not altered by this macro (unless they are altered in BODY)."
   `(let ((save-selected-window--state (internal--before-save-selected-window)))
      (save-current-buffer
        (unwind-protect
-	   (progn ,@body)
+           (progn ,@body)
          (internal--after-save-selected-window save-selected-window--state)))))
 
 (defvar temp-buffer-window-setup-hook nil
@@ -93,7 +93,7 @@ displayed and current and its window selected.")
   "Set up temporary buffer specified by BUFFER-OR-NAME.
 Return the buffer."
   (let ((old-dir default-directory)
-	(buffer (get-buffer-create buffer-or-name)))
+        (buffer (get-buffer-create buffer-or-name)))
     (with-current-buffer buffer
       (kill-all-local-variables)
       (setq default-directory old-dir)
@@ -102,9 +102,9 @@ Return the buffer."
       (setq buffer-file-name nil)
       (setq buffer-undo-list t)
       (let ((inhibit-read-only t)
-	    (inhibit-modification-hooks t))
-	(erase-buffer)
-	(run-hooks 'temp-buffer-window-setup-hook))
+            (inhibit-modification-hooks t))
+        (erase-buffer)
+        (run-hooks 'temp-buffer-window-setup-hook))
       ;; Return the buffer.
       buffer)))
 
@@ -118,29 +118,29 @@ to `display-buffer'."
       (setq buffer-read-only t)
       (goto-char (point-min))
       (when (let ((window-combination-limit
-		   ;; When `window-combination-limit' equals
-		   ;; `temp-buffer' or `temp-buffer-resize' and
-		   ;; `temp-buffer-resize-mode' is enabled in this
-		   ;; buffer bind it to t so resizing steals space
-		   ;; preferably from the window that was split.
-		   (if (or (eq window-combination-limit 'temp-buffer)
-			   (and (eq window-combination-limit
-				    'temp-buffer-resize)
-				temp-buffer-resize-mode))
-		       t
-		     window-combination-limit)))
-	      (setq window (display-buffer buffer action)))
-	(setq frame (window-frame window))
-	(unless (eq frame (selected-frame))
-	  (raise-frame frame))
-	(setq minibuffer-scroll-window window)
-	(set-window-hscroll window 0)
-	(with-selected-window window
-	  (run-hooks 'temp-buffer-window-show-hook)
-	  (when temp-buffer-resize-mode
-	    (resize-temp-buffer-window window)))
-	;; Return the window.
-	window))))
+                   ;; When `window-combination-limit' equals
+                   ;; `temp-buffer' or `temp-buffer-resize' and
+                   ;; `temp-buffer-resize-mode' is enabled in this
+                   ;; buffer bind it to t so resizing steals space
+                   ;; preferably from the window that was split.
+                   (if (or (eq window-combination-limit 'temp-buffer)
+                           (and (eq window-combination-limit
+                                    'temp-buffer-resize)
+                                temp-buffer-resize-mode))
+                       t
+                     window-combination-limit)))
+              (setq window (display-buffer buffer action)))
+        (setq frame (window-frame window))
+        (unless (eq frame (selected-frame))
+          (raise-frame frame))
+        (setq minibuffer-scroll-window window)
+        (set-window-hscroll window 0)
+        (with-selected-window window
+          (run-hooks 'temp-buffer-window-show-hook)
+          (when temp-buffer-resize-mode
+            (resize-temp-buffer-window window)))
+        ;; Return the window.
+        window))))
 
 (defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body)
   "Bind `standard-output' to BUFFER-OR-NAME, eval BODY, show the buffer.
@@ -183,21 +183,21 @@ buffer in Help mode, nor `temp-buffer-show-function' (the ACTION
 argument replaces this)."
   (declare (debug t) (indent 3))
   (let ((buffer (make-symbol "buffer"))
-	(window (make-symbol "window"))
-	(value (make-symbol "value")))
+        (window (make-symbol "window"))
+        (value (make-symbol "value")))
     (macroexp-let2* nil ((vbuffer-or-name buffer-or-name)
-			 (vaction action)
-			 (vquit-function quit-function))
+                         (vaction action)
+                         (vquit-function quit-function))
       `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
-	      (standard-output ,buffer)
-	      ,window ,value)
-	 (setq ,value (progn ,@body))
-	 (with-current-buffer ,buffer
-	   (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
+              (standard-output ,buffer)
+              ,window ,value)
+         (setq ,value (progn ,@body))
+         (with-current-buffer ,buffer
+           (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
 
-	 (if (functionp ,vquit-function)
-	     (funcall ,vquit-function ,window ,value)
-	   ,value)))))
+         (if (functionp ,vquit-function)
+             (funcall ,vquit-function ,window ,value)
+           ,value)))))
 
 (defmacro with-current-buffer-window (buffer-or-name action quit-function &rest body)
   "Evaluate BODY with a buffer BUFFER-OR-NAME current and show that buffer.
@@ -206,21 +206,21 @@ makes the buffer specified by BUFFER-OR-NAME current for running
 BODY."
   (declare (debug t) (indent 3))
   (let ((buffer (make-symbol "buffer"))
-	(window (make-symbol "window"))
-	(value (make-symbol "value")))
+        (window (make-symbol "window"))
+        (value (make-symbol "value")))
     (macroexp-let2* nil ((vbuffer-or-name buffer-or-name)
-			 (vaction action)
-			 (vquit-function quit-function))
+                         (vaction action)
+                         (vquit-function quit-function))
       `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
-	      (standard-output ,buffer)
-	      ,window ,value)
-	 (with-current-buffer ,buffer
-	   (setq ,value (progn ,@body))
-	   (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
+              (standard-output ,buffer)
+              ,window ,value)
+         (with-current-buffer ,buffer
+           (setq ,value (progn ,@body))
+           (setq ,window (temp-buffer-window-show ,buffer ,vaction)))
 
-	 (if (functionp ,vquit-function)
-	     (funcall ,vquit-function ,window ,value)
-	   ,value)))))
+         (if (functionp ,vquit-function)
+             (funcall ,vquit-function ,window ,value)
+           ,value)))))
 
 (defmacro with-displayed-buffer-window (buffer-or-name action quit-function &rest body)
   "Show a buffer BUFFER-OR-NAME and evaluate BODY in that buffer.
@@ -230,13 +230,13 @@ displays the buffer specified by BUFFER-OR-NAME before running BODY."
            (obsolete "use `with-current-buffer-window' with action alist entry `body-function'."
                      "28.1"))
   (let ((buffer (make-symbol "buffer"))
-	(window (make-symbol "window"))
-	(value (make-symbol "value")))
+        (window (make-symbol "window"))
+        (value (make-symbol "value")))
     (macroexp-let2* nil ((vbuffer-or-name buffer-or-name)
-			 (vaction action)
-			 (vquit-function quit-function))
+                         (vaction action)
+                         (vquit-function quit-function))
       `(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
-	      (standard-output ,buffer)
+              (standard-output ,buffer)
               ;; If a 'window-height' entry specifies a function,
               ;; remember it here in order to call it below but replace
               ;; the entry so `window--try-to-split-window' will bind
@@ -254,31 +254,31 @@ displays the buffer specified by BUFFER-OR-NAME before running BODY."
                         '(window-height . t)
                         (assq-delete-all
                          'window-height (cdr (copy-sequence ,vaction)))))))
-	      ,window ,value)
-	 (with-current-buffer ,buffer
-	   (setq ,window (temp-buffer-window-show
+              ,window ,value)
+         (with-current-buffer ,buffer
+           (setq ,window (temp-buffer-window-show
                           ,buffer (or vaction-copied ,vaction))))
 
-	 (let ((inhibit-read-only t)
-	       (inhibit-modification-hooks t))
-	   (setq ,value (progn ,@body)))
+         (let ((inhibit-read-only t)
+               (inhibit-modification-hooks t))
+           (setq ,value (progn ,@body)))
 
-	 (set-window-point ,window (point-min))
+         (set-window-point ,window (point-min))
 
-	 (when vheight-function
-	   (ignore-errors
-	     (set-window-parameter ,window 'preserve-size nil)
+         (when vheight-function
+           (ignore-errors
+             (set-window-parameter ,window 'preserve-size nil)
              (funcall vheight-function ,window)))
 
-	 (when (consp (cdr (assq 'preserve-size (cdr ,vaction))))
-	   (window-preserve-size
-	    ,window t (cadr (assq 'preserve-size (cdr ,vaction))))
-	  (window-preserve-size
-	    ,window nil (cddr (assq 'preserve-size (cdr ,vaction)))))
+         (when (consp (cdr (assq 'preserve-size (cdr ,vaction))))
+           (window-preserve-size
+            ,window t (cadr (assq 'preserve-size (cdr ,vaction))))
+           (window-preserve-size
+            ,window nil (cddr (assq 'preserve-size (cdr ,vaction)))))
 
-	 (if (functionp ,vquit-function)
-	     (funcall ,vquit-function ,window ,value)
-	   ,value)))))
+         (if (functionp ,vquit-function)
+             (funcall ,vquit-function ,window ,value)
+           ,value)))))
 
 (defmacro with-window-non-dedicated (window &rest body)
   "Evaluate BODY with WINDOW temporarily made non-dedicated.
@@ -326,8 +326,8 @@ WINDOW can be any window."
   (let ((count 0))
     (when (and (windowp window) (setq window (window-child window)))
       (while window
-	(setq count (1+ count))
-	(setq window (window-next-sibling window))))
+        (setq count (1+ count))
+        (setq window (window-next-sibling window))))
     count))
 
 (defun window-last-child (window)
@@ -357,7 +357,7 @@ stands for the current buffer."
           (t
            (error "No such buffer %s" buffer-or-name)))))
     (if (buffer-live-p buffer)
-	buffer
+        buffer
       (error "No such live buffer %s" buffer-or-name))))
 
 (defun window-normalize-frame (frame)
@@ -370,8 +370,8 @@ This function is commonly used to process the (usually optional)
 nil stands for the selected frame."
   (if frame
       (if (frame-live-p frame)
-	  frame
-	(error "%s is not a live frame" frame))
+          frame
+        (error "%s is not a live frame" frame))
     (selected-frame)))
 
 (defun window-normalize-window (window &optional live-only)
@@ -389,7 +389,7 @@ for the selected window."
     (selected-window))
    (live-only
     (if (window-live-p window)
-	window
+        window
       (error "%s is not a live window" window)))
    ((window-valid-p window)
     window)
@@ -408,14 +408,14 @@ window's frame.  In any other case, return the value of
 Optional argument HORIZONTAL non-nil means to return the value of
 `frame-char-width' for WINDOW-OR-FRAME."
   (let ((frame
-	 (cond
-	  ((window-valid-p window-or-frame)
-	   (window-frame window-or-frame))
-	  ((frame-live-p window-or-frame)
-	   window-or-frame)
-	  (t (selected-frame)))))
+         (cond
+          ((window-valid-p window-or-frame)
+           (window-frame window-or-frame))
+          ((frame-live-p window-or-frame)
+           window-or-frame)
+          (t (selected-frame)))))
     (if horizontal
-	(frame-char-width frame)
+        (frame-char-width frame)
       (frame-char-height frame))))
 
 (defvar ignore-window-parameters nil
@@ -516,9 +516,9 @@ non-nil if WINDOW is part of a horizontal window combination."
   (setq window (window-normalize-window window))
   (let ((parent (window-parent window)))
     (and parent
-	 (if horizontal
-	     (window-left-child parent)
-	   (window-top-child parent)))))
+         (if horizontal
+             (window-left-child parent)
+           (window-top-child parent)))))
 
 (defun window-combination-p (&optional window horizontal)
   "Return WINDOW's first child if WINDOW is a vertical combination.
@@ -544,30 +544,30 @@ fixed-size windows in the calculation."
     ;; If WINDOW is live, return 1.
     1)
    ((if horizontal
-	(window-left-child window)
+        (window-left-child window)
       (window-top-child window))
     ;; If WINDOW is iso-combined, return the sum of the values for all
     ;; child windows of WINDOW.
     (let ((child (window-child window))
-	  (count 0))
+          (count 0))
       (while child
-	(unless (and ignore-fixed (window-size-fixed-p child horizontal))
-	  (setq count
-		(+ (window-combinations child horizontal ignore-fixed)
-		   count)))
-	(setq child (window-right child)))
+        (unless (and ignore-fixed (window-size-fixed-p child horizontal))
+          (setq count
+                (+ (window-combinations child horizontal ignore-fixed)
+                   count)))
+        (setq child (window-right child)))
       count))
    (t
     ;; If WINDOW is not iso-combined, return the maximum value of any
     ;; child window of WINDOW.
     (let ((child (window-child window))
-	  (count 1))
+          (count 1))
       (while child
-	(unless (and ignore-fixed (window-size-fixed-p child horizontal))
-	  (setq count
-		(max (window-combinations child horizontal ignore-fixed)
-		     count)))
-	(setq child (window-right child)))
+        (unless (and ignore-fixed (window-size-fixed-p child horizontal))
+          (setq count
+                (max (window-combinations child horizontal ignore-fixed)
+                     count)))
+        (setq child (window-right child)))
       count))))
 
 (defun walk-window-tree-1 (fun walk-window-tree-window any &optional sub-only)
@@ -575,18 +575,18 @@ fixed-size windows in the calculation."
   (let (walk-window-tree-buffer)
     (while walk-window-tree-window
       (setq walk-window-tree-buffer
-	    (window-buffer walk-window-tree-window))
+            (window-buffer walk-window-tree-window))
       (when (or walk-window-tree-buffer any)
-	(funcall fun walk-window-tree-window))
+        (funcall fun walk-window-tree-window))
       (unless walk-window-tree-buffer
-	(walk-window-tree-1
-	 fun (window-left-child walk-window-tree-window) any)
-	(walk-window-tree-1
-	 fun (window-top-child walk-window-tree-window) any))
+        (walk-window-tree-1
+         fun (window-left-child walk-window-tree-window) any)
+        (walk-window-tree-1
+         fun (window-top-child walk-window-tree-window) any))
       (if sub-only
-	  (setq walk-window-tree-window nil)
-	(setq walk-window-tree-window
-	      (window-right walk-window-tree-window))))))
+          (setq walk-window-tree-window nil)
+        (setq walk-window-tree-window
+              (window-right walk-window-tree-window))))))
 
 (defun walk-window-tree (fun &optional frame any minibuf)
   "Run function FUN on each live window of FRAME.
@@ -611,11 +611,11 @@ unpredictable."
       (walk-window-tree-1 fun root any))
     ;; Run FUN on FRAME's minibuffer window if requested.
     (when (and (window-live-p mini)
-	       (eq (window-frame mini) frame)
-	       (or (eq minibuf t)
-		   (and (not minibuf)
+               (eq (window-frame mini) frame)
+               (or (eq minibuf t)
+                   (and (not minibuf)
                         (minibuffer-window-active-p mini))))
-	(funcall fun mini))))
+      (funcall fun mini))))
 
 (defun walk-window-subtree (fun &optional window any)
   "Run function FUN on the subtree of windows rooted at WINDOW.
@@ -648,9 +648,9 @@ neither nil nor t means never consider the minibuffer window."
     (catch 'found
       (walk-window-tree
        (lambda (window)
-	 (when (and (setq this-value (window-parameter window parameter))
-		    (or (not value) (equal value this-value)))
-	   (throw 'found window)))
+         (when (and (setq this-value (window-parameter window parameter))
+                    (or (not value) (equal value this-value)))
+           (throw 'found window)))
        frame any minibuf))))
 
 ;;; Atomic windows.
@@ -673,7 +673,7 @@ WINDOW must be an internal window.  Return WINDOW."
     (walk-window-subtree
      (lambda (window)
        (unless (window-parameter window 'window-atom)
-	 (set-window-parameter window 'window-atom t)))
+         (set-window-parameter window 'window-atom t)))
      window t)
     window))
 
@@ -712,26 +712,26 @@ node `(elisp) Buffer Display Action Functions'.  It should be
 called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (let* ((ignore-window-parameters t)
-	 (window-combination-limit t)
-	 (window-combination-resize 'atom)
-	 (window (cdr (assq 'window alist)))
-	 (side (or (cdr (assq 'side alist)) 'below))
-	 (atom (when window (window-parameter window 'window-atom)))
-	 root new)
+         (window-combination-limit t)
+         (window-combination-resize 'atom)
+         (window (cdr (assq 'window alist)))
+         (side (or (cdr (assq 'side alist)) 'below))
+         (atom (when window (window-parameter window 'window-atom)))
+         root new)
     (setq window (window-normalize-window window))
     (setq root (window-atom-root window))
     ;; Split off new window.
     (when (setq new (split-window-no-error window nil side))
       (window-make-atom
        (if (and root (not (eq root window)))
-	   ;; When WINDOW was part of an atomic window and we did not
-	   ;; split its root, root atomic window at old root.
-	   root
-	 ;; Otherwise, root atomic window at WINDOW's new parent.
-	 (window-parent window)))
+           ;; When WINDOW was part of an atomic window and we did not
+           ;; split its root, root atomic window at old root.
+           root
+         ;; Otherwise, root atomic window at WINDOW's new parent.
+         (window-parent window)))
       ;; Assign `window-atom' parameters, if needed.
       (when (and (not atom) (window-live-p window))
-	(set-window-parameter window 'window-atom 'main))
+        (set-window-parameter window 'window-atom 'main))
       (set-window-parameter new 'window-atom side)
       ;; Display BUFFER in NEW and return NEW.
       (window--display-buffer buffer new 'window alist))))
@@ -740,26 +740,26 @@ indirectly called by the latter."
   "Subroutine of `window--atom-check'."
   (when window
     (if (window-parameter window 'window-atom)
-	(let ((count 0))
-	  (when (or (catch 'reset
-		      (walk-window-subtree
-		       (lambda (window)
-			 (if (window-parameter window 'window-atom)
-			     (setq count (1+ count))
-			   (throw 'reset t)))
-		       window t))
-		    ;; count >= 1 must hold here.  If there's no other
-		    ;; window around dissolve this atomic window.
-		    (= count 1))
-	    ;; Dissolve atomic window.
-	    (walk-window-subtree
-	     (lambda (window)
-	       (set-window-parameter window 'window-atom nil))
-	     window t)))
+        (let ((count 0))
+          (when (or (catch 'reset
+                      (walk-window-subtree
+                       (lambda (window)
+                         (if (window-parameter window 'window-atom)
+                             (setq count (1+ count))
+                           (throw 'reset t)))
+                       window t))
+                    ;; count >= 1 must hold here.  If there's no other
+                    ;; window around dissolve this atomic window.
+                    (= count 1))
+            ;; Dissolve atomic window.
+            (walk-window-subtree
+             (lambda (window)
+               (set-window-parameter window 'window-atom nil))
+             window t)))
       ;; Check children.
       (unless (window-buffer window)
-	(window--atom-check-1 (window-left-child window))
-	(window--atom-check-1 (window-top-child window))))
+        (window--atom-check-1 (window-left-child window))
+        (window--atom-check-1 (window-top-child window))))
     ;; Check right sibling
     (window--atom-check-1 (window-right window))))
 
@@ -797,8 +797,8 @@ The layout of side windows on the left or right of a frame is not
 affected by the value of this variable."
   :type
   '(choice (const :tag "Never" nil)
-	   (const :tag "Bidi" bidi)
-	   (const :tag "Always" t))
+           (const :tag "Bidi" bidi)
+           (const :tag "Always" t))
   :initialize 'custom-initialize-default
   :set 'window--sides-reverse
   :group 'windows
@@ -909,17 +909,17 @@ Otherwise, return either an internal non-side window such that
 all other non-side windows on FRAME descend from it, or the
 single live non-side window of FRAME."
   (let ((frame (window-normalize-frame frame))
-	main sibling)
+        main sibling)
     ;; Set main to the _last_ window found by `walk-window-tree' that
     ;; is not a side window but has a side window as its sibling.
     (walk-window-tree
      (lambda (window)
        (and (not (window-parameter window 'window-side))
-	    (or (and (setq sibling (window-prev-sibling window))
-		     (window-parameter sibling 'window-side))
-		(and (setq sibling (window-next-sibling window))
-		     (window-parameter sibling 'window-side)))
-	    (setq main window)))
+            (or (and (setq sibling (window-prev-sibling window))
+                     (window-parameter sibling 'window-side))
+                (and (setq sibling (window-next-sibling window))
+                     (window-parameter sibling 'window-side)))
+            (setq main window)))
      frame t 'nomini)
     (or main (frame-root-window frame))))
 
@@ -942,32 +942,32 @@ and must not be called when a window on SIDE exists already."
     ;; (4) Otherwise return the frame's root window.
     (cond
      ((or (and (eq side 'left)
-	       (setq window (window-with-parameter 'window-side 'right nil t)))
-	  (and (eq side 'top)
-	       (setq window (window-with-parameter 'window-side 'bottom nil t))))
+               (setq window (window-with-parameter 'window-side 'right nil t)))
+          (and (eq side 'top)
+               (setq window (window-with-parameter 'window-side 'bottom nil t))))
       (window-prev-sibling window))
      ((or (and (eq side 'right)
-	       (setq window (window-with-parameter 'window-side 'left nil t)))
-	  (and (eq side 'bottom)
-	       (setq window (window-with-parameter 'window-side 'top nil t))))
+               (setq window (window-with-parameter 'window-side 'left nil t)))
+          (and (eq side 'bottom)
+               (setq window (window-with-parameter 'window-side 'top nil t))))
       (window-next-sibling window))
      ((memq side '(left right))
       (cond
        (window-sides-vertical
-	root)
+        root)
        ((setq window (window-with-parameter 'window-side 'top nil t))
-	(window-next-sibling window))
+        (window-next-sibling window))
        ((setq window (window-with-parameter 'window-side 'bottom nil t))
-	(window-prev-sibling window))
+        (window-prev-sibling window))
        (t root)))
      ((memq side '(top bottom))
       (cond
        ((not window-sides-vertical)
-	root)
+        root)
        ((setq window (window-with-parameter 'window-side 'left nil t))
-	(window-next-sibling window))
+        (window-next-sibling window))
        ((setq window (window-with-parameter 'window-side 'right nil t))
-	(window-prev-sibling window))
+        (window-prev-sibling window))
        (t root))))))
 
 (defun window--make-major-side-window (buffer side slot &optional alist)
@@ -980,18 +980,18 @@ Return the new window, nil if its creation failed.
 This is an auxiliary function of `display-buffer-in-side-window'
 and may be called only if no window on SIDE exists yet."
   (let* ((left-or-right (memq side '(left right)))
-	 (next-to (window--make-major-side-window-next-to side))
-	 (on-side (cond
-		   ((eq side 'top) 'above)
-		   ((eq side 'bottom) 'below)
-		   (t side)))
+         (next-to (window--make-major-side-window-next-to side))
+         (on-side (cond
+                   ((eq side 'top) 'above)
+                   ((eq side 'bottom) 'below)
+                   (t side)))
          (window--sides-inhibit-check t)
-	 ;; The following two bindings will tell `split-window' to take
-	 ;; the space for the new window from the selected frame's main
-	 ;; window and not make a new parent window unless needed.
-	 (window-combination-resize 'side)
-	 (window-combination-limit nil)
-	 (window (split-window-no-error next-to nil on-side))
+         ;; The following two bindings will tell `split-window' to take
+         ;; the space for the new window from the selected frame's main
+         ;; window and not make a new parent window unless needed.
+         (window-combination-resize 'side)
+         (window-combination-limit nil)
+         (window (split-window-no-error next-to nil on-side))
          (alist (if (assq 'dedicated alist)
                     alist
                   (cons `(dedicated . ,(or display-buffer-mark-dedicated 'side))
@@ -1008,17 +1008,17 @@ and may be called only if no window on SIDE exists yet."
       ;; Auto-adjust height/width of new window unless a size has been
       ;; explicitly requested.
       (unless (if left-or-right
-		  (cdr (assq 'window-width alist))
-		(cdr (assq 'window-height alist)))
-	(setq alist
-	      (cons
-	       (cons
-		(if left-or-right 'window-width 'window-height)
-		(/ (window-total-size (frame-root-window) left-or-right)
-		   ;; By default use a fourth of the size of the frame's
-		   ;; root window.
-		   4))
-	       alist)))
+                  (cdr (assq 'window-width alist))
+                (cdr (assq 'window-height alist)))
+        (setq alist
+              (cons
+               (cons
+                (if left-or-right 'window-width 'window-height)
+                (/ (window-total-size (frame-root-window) left-or-right)
+                   ;; By default use a fourth of the size of the frame's
+                   ;; root window.
+                   4))
+               alist)))
       (with-current-buffer buffer
         (setq window--sides-shown t))
       ;; Install BUFFER in new window and return WINDOW.
@@ -1071,11 +1071,11 @@ indirectly called by the latter."
       (error "Invalid slot %s specified" slot)))
 
     (let* ((major (window-with-parameter 'window-side side nil t))
-	   ;; `major' is the major window on SIDE, `windows' the list of
-	   ;; life windows on SIDE.
+           ;; `major' is the major window on SIDE, `windows' the list of
+           ;; life windows on SIDE.
            (reversed (window--sides-reverse-on-frame-p (selected-frame)))
            (windows
-	    (cond
+            (cond
              ((window-live-p major)
               (list major))
              ((window-valid-p major)
@@ -1084,58 +1084,58 @@ indirectly called by the latter."
                      (windows (list next first)))
                 (setq reversed (> (window-parameter first 'window-slot)
                                   (window-parameter next 'window-slot)))
-		(while (setq next (window-next-sibling next))
+                (while (setq next (window-next-sibling next))
                   (setq windows (cons next windows)))
-		(if reversed windows (nreverse windows))))))
-	   (slots (when major (max 1 (window-child-count major))))
-	   (max-slots
-	    (nth (cond
-		  ((eq side 'left) 0)
-		  ((eq side 'top) 1)
-		  ((eq side 'right) 2)
-		  ((eq side 'bottom) 3))
-		 window-sides-slots))
+                (if reversed windows (nreverse windows))))))
+           (slots (when major (max 1 (window-child-count major))))
+           (max-slots
+            (nth (cond
+                  ((eq side 'left) 0)
+                  ((eq side 'top) 1)
+                  ((eq side 'right) 2)
+                  ((eq side 'bottom) 3))
+                 window-sides-slots))
            (window--sides-inhibit-check t)
            (alist (if (assq 'dedicated alist)
                       alist
                     (cons `(dedicated . ,(or display-buffer-mark-dedicated 'side))
                           alist)))
            window this-window this-slot prev-window next-window
-	   best-window best-slot abs-slot)
+           best-window best-slot abs-slot)
 
       (cond
        ((and (numberp max-slots) (<= max-slots 0))
-	;; No side-slots available on this side.  Don't raise an error,
-	;; just return nil.
-	nil)
+        ;; No side-slots available on this side.  Don't raise an error,
+        ;; just return nil.
+        nil)
        ((not windows)
-	;; No major side window exists on this side, make one.
-	(window--make-major-side-window buffer side slot alist))
+        ;; No major side window exists on this side, make one.
+        (window--make-major-side-window buffer side slot alist))
        (t
-	;; Scan windows on SIDE.
-	(catch 'found
-	  (dolist (window windows)
-	    (setq this-slot (window-parameter window 'window-slot))
-	    (cond
-	     ;; The following should not happen and probably be checked
-	     ;; by window--sides-check.
-	     ((not (numberp this-slot)))
-	     ((= this-slot slot)
-	      ;; A window with a matching slot has been found.
-	      (setq this-window window)
-	      (throw 'found t))
-	     (t
-	      ;; Check if this window has a better slot value wrt the
-	      ;; slot of the window we want.
-	      (setq abs-slot
-		    (if (or (and (> this-slot 0) (> slot 0))
-			    (and (< this-slot 0) (< slot 0)))
-			(abs (- slot this-slot))
-		      (+ (abs slot) (abs this-slot))))
-	      (unless (and best-slot (<= best-slot abs-slot))
-		(setq best-window window)
-		(setq best-slot abs-slot))
-	      (if reversed
+        ;; Scan windows on SIDE.
+        (catch 'found
+          (dolist (window windows)
+            (setq this-slot (window-parameter window 'window-slot))
+            (cond
+             ;; The following should not happen and probably be checked
+             ;; by window--sides-check.
+             ((not (numberp this-slot)))
+             ((= this-slot slot)
+              ;; A window with a matching slot has been found.
+              (setq this-window window)
+              (throw 'found t))
+             (t
+              ;; Check if this window has a better slot value wrt the
+              ;; slot of the window we want.
+              (setq abs-slot
+                    (if (or (and (> this-slot 0) (> slot 0))
+                            (and (< this-slot 0) (< slot 0)))
+                        (abs (- slot this-slot))
+                      (+ (abs slot) (abs this-slot))))
+              (unless (and best-slot (<= best-slot abs-slot))
+                (setq best-window window)
+                (setq best-slot abs-slot))
+              (if reversed
                   (cond
                    ((<= this-slot slot)
                     (setq next-window window))
@@ -1148,39 +1148,39 @@ indirectly called by the latter."
                   (setq next-window window))))))))
 
         ;; `this-window' is the first window with the same SLOT.
-	;; `prev-window' is the window with the largest slot < SLOT.  A new
-	;; window will be created after it.
-	;; `next-window' is the window with the smallest slot > SLOT.  A new
-	;; window will be created before it.
-	;; `best-window' is the window with the smallest absolute difference
-	;; of its slot and SLOT.
-	(or (and this-window
-		 ;; Reuse `this-window'.
+        ;; `prev-window' is the window with the largest slot < SLOT.  A new
+        ;; window will be created after it.
+        ;; `next-window' is the window with the smallest slot > SLOT.  A new
+        ;; window will be created before it.
+        ;; `best-window' is the window with the smallest absolute difference
+        ;; of its slot and SLOT.
+        (or (and this-window
+                 ;; Reuse `this-window'.
                  (with-current-buffer buffer
                    (setq window--sides-shown t))
-		 (window--display-buffer buffer this-window 'reuse alist))
-	    (and (or (not max-slots) (< slots max-slots))
-		 (or (and next-window
-			  ;; Make new window before `next-window'.
-			  (let ((next-side (if left-or-right 'above 'left))
-				(window-combination-resize 'side))
-			    (setq window (split-window-no-error
+                 (window--display-buffer buffer this-window 'reuse alist))
+            (and (or (not max-slots) (< slots max-slots))
+                 (or (and next-window
+                          ;; Make new window before `next-window'.
+                          (let ((next-side (if left-or-right 'above 'left))
+                                (window-combination-resize 'side))
+                            (setq window (split-window-no-error
                                           next-window nil next-side))))
-		     (and prev-window
-			  ;; Make new window after `prev-window'.
-			  (let ((prev-side (if left-or-right 'below 'right))
-				(window-combination-resize 'side))
-			    (setq window (split-window-no-error
+                     (and prev-window
+                          ;; Make new window after `prev-window'.
+                          (let ((prev-side (if left-or-right 'below 'right))
+                                (window-combination-resize 'side))
+                            (setq window (split-window-no-error
                                           prev-window nil prev-side)))))
-		   (set-window-parameter window 'window-slot slot)
-                   (with-current-buffer buffer
-                     (setq window--sides-shown t))
-		   (window--display-buffer buffer window 'window alist))
-	    (and best-window
-		 ;; Reuse `best-window'.
-		 (progn
-		   ;; Give best-window the new slot value.
-		   (set-window-parameter best-window 'window-slot slot)
+                 (set-window-parameter window 'window-slot slot)
+                 (with-current-buffer buffer
+                   (setq window--sides-shown t))
+                 (window--display-buffer buffer window 'window alist))
+            (and best-window
+                 ;; Reuse `best-window'.
+                 (progn
+                   ;; Give best-window the new slot value.
+                   (set-window-parameter best-window 'window-slot slot)
                    (with-current-buffer buffer
                      (setq window--sides-shown t))
                    (window--display-buffer
@@ -1272,35 +1272,35 @@ it is found."
   (setq frame (window-normalize-frame frame))
   (let ((window--sides-inhibit-check t)
         (root (frame-root-window frame))
-	(main (window-main-window frame)))
+        (main (window-main-window frame)))
     (when (and (not (eq main root))
-	       (not (eq (window-parent main) root))
-	       (window-combined-p main window-sides-vertical))
+               (not (eq (window-parent main) root))
+               (window-combined-p main window-sides-vertical))
       (let* ((window--sides-inhibit-check t)
-	     (ignore-window-parameters t)
-	     (first (window-child root))
-	     (first-state
-	      (and first (window-parameter first 'window-side)
-		   (window-state-get first)))
-	     (last (window-last-child root))
-	     (last-state
-	      (and last (window-parameter last 'window-side)
-		   (window-state-get last)))
-	     (dummy (get-buffer-create " *dummy*"))
-	     major)
-	(unwind-protect
-	    (progn
-	      (when first-state (delete-window first))
-	      (when last-state (delete-window last))
-	      (when first-state
-		(setq major (window--make-major-side-window
-			     dummy (if window-sides-vertical 'top 'left) 0))
-		(window-state-put first-state major t))
-	      (when last-state
-		(setq major (window--make-major-side-window
-			     dummy (if window-sides-vertical 'bottom 'right) 0))
-		(window-state-put last-state major t)))
-	  (kill-buffer " *dummy*"))))))
+             (ignore-window-parameters t)
+             (first (window-child root))
+             (first-state
+              (and first (window-parameter first 'window-side)
+                   (window-state-get first)))
+             (last (window-last-child root))
+             (last-state
+              (and last (window-parameter last 'window-side)
+                   (window-state-get last)))
+             (dummy (get-buffer-create " *dummy*"))
+             major)
+        (unwind-protect
+            (progn
+              (when first-state (delete-window first))
+              (when last-state (delete-window last))
+              (when first-state
+                (setq major (window--make-major-side-window
+                             dummy (if window-sides-vertical 'top 'left) 0))
+                (window-state-put first-state major t))
+              (when last-state
+                (setq major (window--make-major-side-window
+                             dummy (if window-sides-vertical 'bottom 'right) 0))
+                (window-state-put last-state major t)))
+          (kill-buffer " *dummy*"))))))
 
 (defun window--sides-verticalize (symbol value)
   "Helper function for customizing `window-sides-vertical'."
@@ -1383,33 +1383,33 @@ before writing to it."
     (insert
      (format "%s   parent: %s\n" window (window-parent window))
      (format "pixel left: %s   top: %s   size: %s x %s   new: %s\n"
-	     (window-pixel-left window) (window-pixel-top window)
-	     (window-size window t t) (window-size window nil t)
-	     (window-new-pixel window))
+             (window-pixel-left window) (window-pixel-top window)
+             (window-size window t t) (window-size window nil t)
+             (window-new-pixel window))
      (format "char left: %s   top: %s   size: %s x %s   new: %s\n"
-	     (window-left-column window) (window-top-line window)
-	     (window-total-size window t) (window-total-size window)
-	     (window-new-total window))
+             (window-left-column window) (window-top-line window)
+             (window-total-size window t) (window-total-size window)
+             (window-new-total window))
      (format "normal: %s x %s   new: %s\n"
-	     (window-normal-size window t) (window-normal-size window)
-	     (window-new-normal window)))
+             (window-normal-size window t) (window-normal-size window)
+             (window-new-normal window)))
     (when (window-live-p window)
       (let ((fringes (window-fringes window))
-	    (margins (window-margins window)))
-	(insert
-	 (format "body pixel: %s x %s   char: %s x %s\n"
-		 (window-body-width window t) (window-body-height window t)
-		 (window-body-width window) (window-body-height window))
-	 (format "width left fringe: %s  left margin: %s  right margin: %s\n"
-		 (car fringes) (or (car margins) 0) (or (cdr margins) 0))
-	 (format "width right fringe: %s  scroll-bar: %s  divider: %s\n"
-		 (cadr fringes)
-		 (window-scroll-bar-width window)
-		 (window-right-divider-width window))
-	 (format "height header-line: %s  mode-line: %s  divider: %s\n"
-		 (window-header-line-height window)
-		 (window-mode-line-height window)
-		 (window-bottom-divider-width window)))))
+            (margins (window-margins window)))
+        (insert
+         (format "body pixel: %s x %s   char: %s x %s\n"
+                 (window-body-width window t) (window-body-height window t)
+                 (window-body-width window) (window-body-height window))
+         (format "width left fringe: %s  left margin: %s  right margin: %s\n"
+                 (car fringes) (or (car margins) 0) (or (cdr margins) 0))
+         (format "width right fringe: %s  scroll-bar: %s  divider: %s\n"
+                 (cadr fringes)
+                 (window-scroll-bar-width window)
+                 (window-right-divider-width window))
+         (format "height header-line: %s  mode-line: %s  divider: %s\n"
+                 (window-header-line-height window)
+                 (window-mode-line-height window)
+                 (window-bottom-divider-width window)))))
     (insert "\n")))
 
 (defun window--dump-frame (&optional window-or-frame)
@@ -1419,39 +1419,39 @@ selected frame.  When WINDOW-OR-FRAME is a window, dump that
 window's frame.  The buffer *window-frame-dump* is erased before
 dumping to it."
   (let* ((window
-	  (cond
-	   ((or (not window-or-frame)
-		(frame-live-p window-or-frame))
-	    (frame-root-window window-or-frame))
-	   ((or (window-live-p window-or-frame)
-		(window-child window-or-frame))
-	    window-or-frame)
-	   (t
-	    (frame-root-window))))
-	 (frame (window-frame window)))
+          (cond
+           ((or (not window-or-frame)
+                (frame-live-p window-or-frame))
+            (frame-root-window window-or-frame))
+           ((or (window-live-p window-or-frame)
+                (window-child window-or-frame))
+            window-or-frame)
+           (t
+            (frame-root-window))))
+         (frame (window-frame window)))
     (with-current-buffer (get-buffer-create "*window-frame-dump*")
       (erase-buffer)
       (insert
        (format "frame pixel: %s x %s   cols/lines: %s x %s   units: %s x %s\n"
-	       (frame-pixel-width frame) (frame-pixel-height frame)
-	       (frame-total-cols frame) (frame-total-lines frame)
-	       (frame-char-width frame) (frame-char-height frame))
+               (frame-pixel-width frame) (frame-pixel-height frame)
+               (frame-total-cols frame) (frame-total-lines frame)
+               (frame-char-width frame) (frame-char-height frame))
        (format "frame text pixel: %s x %s   cols/lines: %s x %s\n"
-	       (frame-text-width frame) (frame-text-height frame)
-	       (frame-text-cols frame) (frame-text-lines frame))
+               (frame-text-width frame) (frame-text-height frame)
+               (frame-text-cols frame) (frame-text-lines frame))
        (format "tab: %s  tool: %s  scroll: %s/%s  fringe: %s  border: %s  right: %s  bottom: %s\n\n"
-	       (if (fboundp 'tab-bar-height)
-		   (tab-bar-height frame t)
-		 "0")
-	       (if (fboundp 'tool-bar-height)
-		   (tool-bar-height frame t)
-		 "0")
-	       (frame-scroll-bar-width frame)
-	       (frame-scroll-bar-height frame)
-	       (frame-fringe-width frame)
-	       (frame-border-width frame)
-	       (frame-right-divider-width frame)
-	       (frame-bottom-divider-width frame)))
+               (if (fboundp 'tab-bar-height)
+                   (tab-bar-height frame t)
+                 "0")
+               (if (fboundp 'tool-bar-height)
+                   (tool-bar-height frame t)
+                 "0")
+               (frame-scroll-bar-width frame)
+               (frame-scroll-bar-height frame)
+               (frame-fringe-width frame)
+               (frame-border-width frame)
+               (frame-right-divider-width frame)
+               (frame-bottom-divider-width frame)))
       (walk-window-tree 'window--dump-window frame t t))))
 
 ;;; Window sizes.
@@ -1494,10 +1494,10 @@ handled as for `window-total-height' and `window-total-width'
 otherwise."
   (if horizontal
       (if pixelwise
-	  (window-pixel-width window)
-	(window-total-width window round))
+          (window-pixel-width window)
+        (window-total-width window round))
     (if pixelwise
-	(window-pixel-height window)
+        (window-pixel-height window)
       (window-total-height window round))))
 
 (defvar window-size-fixed nil
@@ -1542,21 +1542,21 @@ WINDOW as argument also removes the respective restraint.
 Other values of PRESERVE are reserved for future use."
   (setq window (window-normalize-window window t))
   (let* ((parameter (window-parameter window 'window-preserved-size))
-	 (width (nth 1 parameter))
-	 (height (nth 2 parameter)))
+         (width (nth 1 parameter))
+         (height (nth 2 parameter)))
     (if horizontal
-	(set-window-parameter
-	 window 'window-preserved-size
-	 (list
-	  (window-buffer window)
-	  (and preserve (window--preservable-size window t))
-	  height))
+        (set-window-parameter
+         window 'window-preserved-size
+         (list
+          (window-buffer window)
+          (and preserve (window--preservable-size window t))
+          height))
       (set-window-parameter
        window 'window-preserved-size
        (list
-	(window-buffer window)
-	width
-	(and preserve (window--preservable-size window)))))))
+        (window-buffer window)
+        width
+        (and preserve (window--preservable-size window)))))))
 
 (defun window-preserved-size (&optional window horizontal)
   "Return preserved height of window WINDOW.
@@ -1565,9 +1565,9 @@ Optional argument HORIZONTAL non-nil means to return preserved
 width of WINDOW."
   (setq window (window-normalize-window window t))
   (let* ((parameter (window-parameter window 'window-preserved-size))
-	 (buffer (nth 0 parameter))
-	 (width (nth 1 parameter))
-	 (height (nth 2 parameter)))
+         (buffer (nth 0 parameter))
+         (width (nth 1 parameter))
+         (height (nth 2 parameter)))
     (when (eq buffer (window-buffer window))
       (if horizontal width height))))
 
@@ -1577,7 +1577,7 @@ Optional argument HORIZONTAL non-nil means to return non-nil when
 the width of WINDOW shall be preserved."
   (let ((size (window-preserved-size window horizontal)))
     (and (numberp size)
-	 (= size (window--preservable-size window horizontal)))))
+         (= size (window--preservable-size window horizontal)))))
 
 (defun window-safe-min-size (&optional window horizontal pixelwise)
   "Return safe minimum size of WINDOW.
@@ -1591,10 +1591,10 @@ of WINDOW."
   (setq window (window-normalize-window window))
   (if pixelwise
       (if horizontal
-	  (* window-safe-min-width
-	     (frame-char-width (window-frame window)))
-	(* window-safe-min-height
-	   (frame-char-height (window-frame window))))
+          (* window-safe-min-width
+             (frame-char-width (window-frame window)))
+        (* window-safe-min-height
+           (frame-char-height (window-frame window))))
     (if horizontal window-safe-min-width window-safe-min-height)))
 
 (defun window-min-size (&optional window horizontal ignore pixelwise)
@@ -1620,42 +1620,42 @@ return the minimum pixel-size of WINDOW."
   "Internal function of `window-min-size'."
   (let ((sub (window-child window)))
     (if sub
-	(let ((value 0))
-	  ;; WINDOW is an internal window.
-	  (if (window-combined-p sub horizontal)
-	      ;; The minimum size of an iso-combination is the sum of
-	      ;; the minimum sizes of its child windows.
-	      (while sub
-		(setq value (+ value
-			       (window--min-size-1
-				sub horizontal ignore pixelwise)))
-		(setq sub (window-right sub)))
-	    ;; The minimum size of an ortho-combination is the maximum
-	    ;; of the minimum sizes of its child windows.
-	    (while sub
-	      (setq value (max value
-			       (window--min-size-1
-				sub horizontal ignore pixelwise)))
-	      (setq sub (window-right sub))))
-	  value)
+        (let ((value 0))
+          ;; WINDOW is an internal window.
+          (if (window-combined-p sub horizontal)
+              ;; The minimum size of an iso-combination is the sum of
+              ;; the minimum sizes of its child windows.
+              (while sub
+                (setq value (+ value
+                               (window--min-size-1
+                                sub horizontal ignore pixelwise)))
+                (setq sub (window-right sub)))
+            ;; The minimum size of an ortho-combination is the maximum
+            ;; of the minimum sizes of its child windows.
+            (while sub
+              (setq value (max value
+                               (window--min-size-1
+                                sub horizontal ignore pixelwise)))
+              (setq sub (window-right sub))))
+          value)
       (with-current-buffer (window-buffer window)
-	(cond
-	 ((window-size-fixed-p window horizontal ignore)
-	  ;; The minimum size of a fixed size window is its size.
-	  (window-size window horizontal pixelwise))
-	 ((eq ignore 'safe)
-	  ;; If IGNORE equals `safe' return the safe value.
-	  (window-safe-min-size window horizontal pixelwise))
-	 (horizontal
-	  ;; For the minimum width of a window take fringes and
-	  ;; scroll-bars into account.  This is questionable and should
-	  ;; be removed as soon as we are able to split (and resize)
-	  ;; windows such that the new (or resized) windows can get a
-	  ;; size less than the user-specified `window-min-height' and
-	  ;; `window-min-width'.
-	  (let* ((char-size (frame-char-size window t))
-		 (fringes (window-fringes window))
-		 (margins (window-margins window))
+        (cond
+         ((window-size-fixed-p window horizontal ignore)
+          ;; The minimum size of a fixed size window is its size.
+          (window-size window horizontal pixelwise))
+         ((eq ignore 'safe)
+          ;; If IGNORE equals `safe' return the safe value.
+          (window-safe-min-size window horizontal pixelwise))
+         (horizontal
+          ;; For the minimum width of a window take fringes and
+          ;; scroll-bars into account.  This is questionable and should
+          ;; be removed as soon as we are able to split (and resize)
+          ;; windows such that the new (or resized) windows can get a
+          ;; size less than the user-specified `window-min-height' and
+          ;; `window-min-width'.
+          (let* ((char-size (frame-char-size window t))
+                 (fringes (window-fringes window))
+                 (margins (window-margins window))
                  ;; Let the 'min-margins' parameter override the actual
                  ;; widths of the margins.  We allow any number to
                  ;; replace the values specified by `window-margins'.
@@ -1667,47 +1667,47 @@ return the minimum pixel-size of WINDOW."
                  (right-min-margin (and min-margins
                                         (numberp (cdr min-margins))
                                         (cdr min-margins)))
-		 (pixel-width
-		  (+ (window-safe-min-size window t t)
-		     (* (or left-min-margin (car margins) 0) char-size)
-		     (* (or right-min-margin(cdr margins) 0) char-size)
-		     (car fringes) (cadr fringes)
-		     (window-scroll-bar-width window)
-		     (window-right-divider-width window))))
-	    (if pixelwise
-		(max
-		 (if window-resize-pixelwise
-		     pixel-width
-		   ;; Round up to next integral of columns.
-		   (* (ceiling pixel-width char-size) char-size))
-		 (if (window--min-size-ignore-p window ignore)
-		     0
-		   (window-min-pixel-width window)))
-	      (max
-	       (ceiling pixel-width char-size)
-	       (if (window--min-size-ignore-p window ignore)
-		   0
-		 window-min-width)))))
-	 ((let ((char-size (frame-char-size window))
-		(pixel-height
-		 (+ (window-safe-min-size window nil t)
-		    (window-header-line-height window)
-		    (window-scroll-bar-height window)
-		    (window-mode-line-height window)
-		    (window-bottom-divider-width window))))
-	    (if pixelwise
-		(max
-		 (if window-resize-pixelwise
-		     pixel-height
-		   ;; Round up to next integral of lines.
-		   (* (ceiling pixel-height char-size) char-size))
-		 (if (window--min-size-ignore-p window ignore)
-		     0
-		   (window-min-pixel-height window)))
-	      (max (ceiling pixel-height char-size)
-		   (if (window--min-size-ignore-p window ignore)
-		       0
-		     window-min-height))))))))))
+                 (pixel-width
+                  (+ (window-safe-min-size window t t)
+                     (* (or left-min-margin (car margins) 0) char-size)
+                     (* (or right-min-margin(cdr margins) 0) char-size)
+                     (car fringes) (cadr fringes)
+                     (window-scroll-bar-width window)
+                     (window-right-divider-width window))))
+            (if pixelwise
+                (max
+                 (if window-resize-pixelwise
+                     pixel-width
+                   ;; Round up to next integral of columns.
+                   (* (ceiling pixel-width char-size) char-size))
+                 (if (window--min-size-ignore-p window ignore)
+                     0
+                   (window-min-pixel-width window)))
+              (max
+               (ceiling pixel-width char-size)
+               (if (window--min-size-ignore-p window ignore)
+                   0
+                 window-min-width)))))
+         ((let ((char-size (frame-char-size window))
+                (pixel-height
+                 (+ (window-safe-min-size window nil t)
+                    (window-header-line-height window)
+                    (window-scroll-bar-height window)
+                    (window-mode-line-height window)
+                    (window-bottom-divider-width window))))
+            (if pixelwise
+                (max
+                 (if window-resize-pixelwise
+                     pixel-height
+                   ;; Round up to next integral of lines.
+                   (* (ceiling pixel-height char-size) char-size))
+                 (if (window--min-size-ignore-p window ignore)
+                     0
+                   (window-min-pixel-height window)))
+              (max (ceiling pixel-height char-size)
+                   (if (window--min-size-ignore-p window ignore)
+                       0
+                     window-min-height))))))))))
 
 (defun window-sizable (window delta &optional horizontal ignore pixelwise)
   "Return DELTA if DELTA lines can be added to WINDOW.
@@ -1737,11 +1737,11 @@ interpret DELTA as pixels."
   (cond
    ((< delta 0)
     (max (- (window-min-size window horizontal ignore pixelwise)
-	    (window-size window horizontal pixelwise))
-	 delta))
+            (window-size window horizontal pixelwise))
+         delta))
    ((> delta 0)
     (if (window-size-fixed-p window horizontal ignore)
-	0
+        0
       delta))
    (t 0)))
 
@@ -1753,45 +1753,45 @@ doc-string of `window-sizable'."
   (setq window (window-normalize-window window))
   (if (> delta 0)
       (>= (window-sizable window delta horizontal ignore pixelwise)
-	  delta)
+          delta)
     (<= (window-sizable window delta horizontal ignore pixelwise)
-	delta)))
+        delta)))
 
 (defun window--size-fixed-1 (window horizontal ignore)
   "Internal function for `window-size-fixed-p'."
   (let ((sub (window-child window)))
     (catch 'fixed
       (if sub
-	  ;; WINDOW is an internal window.
-	  (if (window-combined-p sub horizontal)
-	      ;; An iso-combination is fixed size if all its child
-	      ;; windows are fixed-size.
-	      (progn
-		(while sub
-		  (unless (window--size-fixed-1 sub horizontal ignore)
-		    ;; We found a non-fixed-size child window, so
-		    ;; WINDOW's size is not fixed.
-		    (throw 'fixed nil))
-		  (setq sub (window-right sub)))
-		;; All child windows are fixed-size, so WINDOW's size is
-		;; fixed.
-		(throw 'fixed t))
-	    ;; An ortho-combination is fixed-size if at least one of its
-	    ;; child windows is fixed-size.
-	    (while sub
-	      (when (window--size-fixed-1 sub horizontal ignore)
-		;; We found a fixed-size child window, so WINDOW's size
-		;; is fixed.
-		(throw 'fixed t))
-	      (setq sub (window-right sub))))
-	;; WINDOW is a live window.
-	(and (or (not (windowp ignore)) (not (eq window ignore)))
-	     (or (and (not (eq ignore 'preserved))
-		      (window--preserve-size window horizontal))
-		 (with-current-buffer (window-buffer window)
-		   (if horizontal
-		       (memq window-size-fixed '(width t))
-		     (memq window-size-fixed '(height t))))))))))
+          ;; WINDOW is an internal window.
+          (if (window-combined-p sub horizontal)
+              ;; An iso-combination is fixed size if all its child
+              ;; windows are fixed-size.
+              (progn
+                (while sub
+                  (unless (window--size-fixed-1 sub horizontal ignore)
+                    ;; We found a non-fixed-size child window, so
+                    ;; WINDOW's size is not fixed.
+                    (throw 'fixed nil))
+                  (setq sub (window-right sub)))
+                ;; All child windows are fixed-size, so WINDOW's size is
+                ;; fixed.
+                (throw 'fixed t))
+            ;; An ortho-combination is fixed-size if at least one of its
+            ;; child windows is fixed-size.
+            (while sub
+              (when (window--size-fixed-1 sub horizontal ignore)
+                ;; We found a fixed-size child window, so WINDOW's size
+                ;; is fixed.
+                (throw 'fixed t))
+              (setq sub (window-right sub))))
+        ;; WINDOW is a live window.
+        (and (or (not (windowp ignore)) (not (eq window ignore)))
+             (or (and (not (eq ignore 'preserved))
+                      (window--preserve-size window horizontal))
+                 (with-current-buffer (window-buffer window)
+                   (if horizontal
+                       (memq window-size-fixed '(width t))
+                     (memq window-size-fixed '(height t))))))))))
 
 (defun window-size-fixed-p (&optional window horizontal ignore)
   "Return non-nil if WINDOW's height is fixed.
@@ -1814,38 +1814,38 @@ WINDOW can be resized in the desired direction.  The function
       0
     ;; Else try to find a non-fixed-size sibling of WINDOW.
     (let* ((parent (window-parent window))
-	   (sub (window-child parent)))
+           (sub (window-child parent)))
       (catch 'done
-	(if (window-combined-p sub horizontal)
-	    ;; In an iso-combination throw DELTA if we find at least one
-	    ;; child window and that window is either not fixed-size or
-	    ;; we can ignore fixed-sizeness.
-	    (let ((skip (eq trail 'after)))
-	      (while sub
-		(cond
-		 ((eq sub window)
-		  (setq skip (eq trail 'before)))
-		 (skip)
-		 ((window-size-fixed-p sub horizontal ignore))
-		 (t
-		  ;; We found a non-fixed-size child window.
-		  (throw 'done delta)))
-		(setq sub (window-right sub))))
-	  ;; In an ortho-combination set DELTA to the minimum value by
-	  ;; which other child windows can shrink.
-	  (while sub
-	    (unless (eq sub window)
-	      (setq delta
-		    (min delta
-			 (max (- (window-size sub horizontal pixelwise 'ceiling)
-				 (window-min-size
-				  sub horizontal ignore pixelwise))
-			      0))))
-	    (setq sub (window-right sub))))
-	(if noup
-	    delta
-	  (window--min-delta-1
-	   parent delta horizontal ignore trail nil pixelwise))))))
+        (if (window-combined-p sub horizontal)
+            ;; In an iso-combination throw DELTA if we find at least one
+            ;; child window and that window is either not fixed-size or
+            ;; we can ignore fixed-sizeness.
+            (let ((skip (eq trail 'after)))
+              (while sub
+                (cond
+                 ((eq sub window)
+                  (setq skip (eq trail 'before)))
+                 (skip)
+                 ((window-size-fixed-p sub horizontal ignore))
+                 (t
+                  ;; We found a non-fixed-size child window.
+                  (throw 'done delta)))
+                (setq sub (window-right sub))))
+          ;; In an ortho-combination set DELTA to the minimum value by
+          ;; which other child windows can shrink.
+          (while sub
+            (unless (eq sub window)
+              (setq delta
+                    (min delta
+                         (max (- (window-size sub horizontal pixelwise 'ceiling)
+                                 (window-min-size
+                                  sub horizontal ignore pixelwise))
+                              0))))
+            (setq sub (window-right sub))))
+        (if noup
+            delta
+          (window--min-delta-1
+           parent delta horizontal ignore trail nil pixelwise))))))
 
 (defun window-min-delta (&optional window horizontal ignore trail noup nodown pixelwise)
   "Return number of lines by which WINDOW can be shrunk.
@@ -1872,7 +1872,7 @@ Optional argument PIXELWISE non-nil means return number of pixels
 by which WINDOW can be shrunk."
   (setq window (window-normalize-window window))
   (let ((size (window-size window horizontal pixelwise 'floor))
-	(minimum (window-min-size window horizontal ignore pixelwise)))
+        (minimum (window-min-size window horizontal ignore pixelwise)))
     (cond
      (nodown
       ;; If NODOWN is t, try to recover the entire size of WINDOW.
@@ -1896,11 +1896,11 @@ for `window-resizable'.  PIXELWISE non-nil means return sizes in
 pixels."
   (setq frame (window-normalize-frame frame))
   (let* ((root (frame-root-window frame))
-	 (mini (window-next-sibling root)))
+         (mini (window-next-sibling root)))
     (+ (window-min-size root horizontal ignore pixelwise)
        (if (and mini (not horizontal))
-	   (window-min-size mini horizontal nil pixelwise)
-	 0))))
+           (window-min-size mini horizontal nil pixelwise)
+         0))))
 
 (defun window--max-delta-1 (window delta &optional horizontal ignore trail noup pixelwise)
   "Internal function of `window-max-delta'."
@@ -1908,40 +1908,40 @@ pixels."
       ;; Can't go up.  Return DELTA.
       delta
     (let* ((parent (window-parent window))
-	   (sub (window-child parent)))
+           (sub (window-child parent)))
       (catch 'fixed
-	(if (window-combined-p sub horizontal)
-	    ;; For an iso-combination calculate how much we can get from
-	    ;; other child windows.
-	    (let ((skip (eq trail 'after)))
-	      (while sub
-		(cond
-		 ((eq sub window)
-		  (setq skip (eq trail 'before)))
-		 (skip)
-		 (t
-		  (setq delta
-			(+ delta
-			   (max
-			    (- (window-size sub horizontal pixelwise 'floor)
-			       (window-min-size
-				sub horizontal ignore pixelwise))
-			    0)))))
-		(setq sub (window-right sub))))
-	  ;; For an ortho-combination throw DELTA when at least one
-	  ;; child window is fixed-size.
-	  (while sub
-	    (when (and (not (eq sub window))
-		       (window-size-fixed-p sub horizontal ignore))
-	      (throw 'fixed delta))
-	    (setq sub (window-right sub))))
-	(if noup
-	    ;; When NOUP is nil, DELTA is all we can get.
-	    delta
-	  ;; Else try with parent of WINDOW, passing the DELTA we
-	  ;; recovered so far.
-	  (window--max-delta-1
-	   parent delta horizontal ignore trail nil pixelwise))))))
+        (if (window-combined-p sub horizontal)
+            ;; For an iso-combination calculate how much we can get from
+            ;; other child windows.
+            (let ((skip (eq trail 'after)))
+              (while sub
+                (cond
+                 ((eq sub window)
+                  (setq skip (eq trail 'before)))
+                 (skip)
+                 (t
+                  (setq delta
+                        (+ delta
+                           (max
+                            (- (window-size sub horizontal pixelwise 'floor)
+                               (window-min-size
+                                sub horizontal ignore pixelwise))
+                            0)))))
+                (setq sub (window-right sub))))
+          ;; For an ortho-combination throw DELTA when at least one
+          ;; child window is fixed-size.
+          (while sub
+            (when (and (not (eq sub window))
+                       (window-size-fixed-p sub horizontal ignore))
+              (throw 'fixed delta))
+            (setq sub (window-right sub))))
+        (if noup
+            ;; When NOUP is nil, DELTA is all we can get.
+            delta
+          ;; Else try with parent of WINDOW, passing the DELTA we
+          ;; recovered so far.
+          (window--max-delta-1
+           parent delta horizontal ignore trail nil pixelwise))))))
 
 (defun window-max-delta (&optional window horizontal ignore trail noup nodown pixelwise)
   "Return maximum number of lines by which WINDOW can be enlarged.
@@ -2012,12 +2012,12 @@ number of pixels."
   (cond
    ((< delta 0)
     (max (- (window-min-delta
-	     window horizontal ignore trail noup nodown pixelwise))
-	 delta))
+             window horizontal ignore trail noup nodown pixelwise))
+         delta))
    ((> delta 0)
     (min (window-max-delta
-	  window horizontal ignore trail noup nodown pixelwise)
-	 delta))
+          window horizontal ignore trail noup nodown pixelwise)
+         delta))
    (t 0)))
 
 (defun window--resizable-p (window delta &optional horizontal ignore trail noup nodown pixelwise)
@@ -2031,11 +2031,11 @@ pixels."
   (setq window (window-normalize-window window))
   (if (> delta 0)
       (>= (window--resizable
-	   window delta horizontal ignore trail noup nodown pixelwise)
-	  delta)
+           window delta horizontal ignore trail noup nodown pixelwise)
+          delta)
     (<= (window--resizable
-	 window delta horizontal ignore trail noup nodown pixelwise)
-	delta)))
+         window delta horizontal ignore trail noup nodown pixelwise)
+        delta)))
 
 (defun window-resizable (window delta &optional horizontal ignore pixelwise)
   "Return DELTA if WINDOW can be resized vertically by DELTA lines.
@@ -2076,11 +2076,11 @@ doc-string of `window-resizable'."
   (setq window (window-normalize-window window))
   (if (> delta 0)
       (>= (window--resizable
-	   window delta horizontal ignore nil nil nil pixelwise)
-	  delta)
+           window delta horizontal ignore nil nil nil pixelwise)
+          delta)
     (<= (window--resizable
-	 window delta horizontal ignore nil nil nil pixelwise)
-	delta)))
+         window delta horizontal ignore nil nil nil pixelwise)
+        delta)))
 
 ;; Aliases of functions defined in window.c.
 (defalias 'window-height 'window-total-height)
@@ -2124,35 +2124,35 @@ optional argument PIXELWISE is passed to the functions."
 (declare-function font-info "font.c" (name &optional frame))
 
 (defun window-font-width (&optional window face)
-   "Return average character width for the font of FACE used in WINDOW.
+  "Return average character width for the font of FACE used in WINDOW.
 WINDOW must be a live window and defaults to the selected one.
 
 If FACE is nil or omitted, the default face is used.  If FACE is
 remapped (see `face-remapping-alist'), the function returns the
 information for the remapped face."
-   (with-selected-window (window-normalize-window window t)
-     (if (display-multi-font-p)
-	 (let* ((face (if face face 'default))
-		(info (font-info (face-font face)))
-		(width (aref info 11)))
-	   (if (> width 0)
-	      width
-	     (aref info 10)))
-       (frame-char-width))))
+  (with-selected-window (window-normalize-window window t)
+    (if (display-multi-font-p)
+        (let* ((face (if face face 'default))
+               (info (font-info (face-font face)))
+               (width (aref info 11)))
+          (if (> width 0)
+              width
+            (aref info 10)))
+      (frame-char-width))))
 
 (defun window-font-height (&optional window face)
-   "Return character height for the font of FACE used in WINDOW.
+  "Return character height for the font of FACE used in WINDOW.
 WINDOW must be a live window and defaults to the selected one.
 
 If FACE is nil or omitted, the default face is used.  If FACE is
 remapped (see `face-remapping-alist'), the function returns the
 information for the remapped face."
-   (with-selected-window (window-normalize-window window t)
-     (if (display-multi-font-p)
-	 (let* ((face (if face face 'default))
-		(info (font-info (face-font face))))
-	   (aref info 3))
-       (frame-char-height))))
+  (with-selected-window (window-normalize-window window t)
+    (if (display-multi-font-p)
+        (let* ((face (if face face 'default))
+               (info (font-info (face-font face))))
+          (aref info 3))
+      (frame-char-height))))
 
 (defvar overflow-newline-into-fringe)
 
@@ -2171,10 +2171,10 @@ for the continuation glyph.  Second, it accounts for the size of
 the font."
   (with-selected-window (window-normalize-window window t)
     (let* ((window-width (window-body-width window t))
-	   (font-width (window-font-width window face))
-	   (ncols (/ window-width font-width)))
+           (font-width (window-font-width window face))
+           (ncols (/ window-width font-width)))
       (if (and (display-graphic-p)
-	       overflow-newline-into-fringe
+               overflow-newline-into-fringe
                (not
                 (or (eq left-fringe-width 0)
                     (and (null left-fringe-width)
@@ -2183,12 +2183,12 @@ the font."
                 (or (eq right-fringe-width 0)
                     (and (null right-fringe-width)
                          (= (frame-parameter nil 'right-fringe) 0)))))
-	  ncols
+          ncols
         ;; FIXME: This should remove 1 more column when there are no
         ;; fringes, lines are truncated, and the window is hscrolled,
         ;; but EOL is not in the view, because then there are 2
         ;; truncation glyphs, not one.
-	(1- ncols)))))
+        (1- ncols)))))
 
 (defun window-current-scroll-bars (&optional window)
   "Return the current scroll bar types for WINDOW.
@@ -2204,8 +2204,8 @@ type actually used, once frame defaults and `scroll-bar-mode' are
 taken into account."
   (setq window (window-normalize-window window t))
   (let ((vertical (nth 2 (window-scroll-bars window)))
-	(horizontal (nth 5 (window-scroll-bars window)))
-	(inherited (frame-current-scroll-bars (window-frame window))))
+        (horizontal (nth 5 (window-scroll-bars window)))
+        (inherited (frame-current-scroll-bars (window-frame window))))
     (when (eq vertical t)
       (setq vertical (car inherited)))
     (when (eq horizontal t)
@@ -2269,11 +2269,11 @@ SIDE can be any of the symbols `left', `top', `right' or
 `bottom'.  The default value nil is handled like `bottom'."
   (setq window (window-normalize-window window))
   (let ((edge
-	 (cond
-	  ((eq side 'left) 0)
-	  ((eq side 'top) 1)
-	  ((eq side 'right) 2)
-	  ((memq side '(bottom nil)) 3))))
+         (cond
+          ((eq side 'left) 0)
+          ((eq side 'top) 1)
+          ((eq side 'right) 2)
+          ((memq side '(bottom nil)) 3))))
     (= (nth edge (window-pixel-edges window))
        (nth edge (window-pixel-edges (frame-root-window window))))))
 
@@ -2287,7 +2287,7 @@ SIDE can be any of the symbols `left', `top', `right' or
     (walk-window-tree
      (lambda (window)
        (when (window-at-side-p window side)
-	 (setq windows (cons window windows))))
+         (setq windows (cons window windows))))
      frame nil 'nomini)
     (nreverse windows)))
 
@@ -2295,13 +2295,13 @@ SIDE can be any of the symbols `left', `top', `right' or
   "Support function for `window-in-direction'."
   (if horizontal
       (let ((top (window-pixel-top window)))
-	(if (> top posn)
-	    (- top posn)
-	  (- posn top (window-pixel-height window))))
+        (if (> top posn)
+            (- top posn)
+          (- posn top (window-pixel-height window))))
     (let ((left (window-pixel-left window)))
       (if (> left posn)
-	  (- left posn)
-	(- posn left (window-pixel-width window))))))
+          (- left posn)
+        (- posn left (window-pixel-width window))))))
 
 ;; Predecessors to the below have been devised by Julian Assange in
 ;; change-windows-intuitively.el and Hovav Shacham in windmove.el.
@@ -2346,110 +2346,110 @@ Return nil if no suitable window can be found."
    ((not (memq direction '(above below left right)))
     (error "Wrong direction %s" direction)))
   (let* ((frame (window-frame window))
-	 (hor (memq direction '(left right)))
-	 (first (if hor
-		    (window-pixel-left window)
-		  (window-pixel-top window)))
-	 (last (+ first (window-size window hor t)))
-	 ;; The column / row value of `posn-at-point' can be nil for the
-	 ;; mini-window, guard against that.
-	 (posn
-	  (cond
-	   ((and (numberp sign) (< sign 0))
-	    (if hor
-		(1- (+ (window-pixel-top window) (window-pixel-height window)))
-	      (1- (+ (window-pixel-left window) (window-pixel-width window)))))
-	   ((and (numberp sign) (> sign 0))
-	    (if hor
-		(window-pixel-top window)
-	      (window-pixel-left window)))
-	   ((let ((posn-cons (nth 2 (posn-at-point (window-point window) window))))
-	      (if hor
-		  (+ (or (cdr posn-cons) 1) (window-pixel-top window))
-		(+ (or (car posn-cons) 1) (window-pixel-left window)))))))
-	 (best-edge
-	  (cond
-	   ((eq direction 'below) (frame-pixel-height frame))
-	   ((eq direction 'right) (frame-pixel-width frame))
-	   (t -1)))
-	 (best-edge-2 best-edge)
-	 (best-diff-2 (if hor (frame-pixel-height frame) (frame-pixel-width frame)))
-	 best best-2 best-diff-2-new)
+         (hor (memq direction '(left right)))
+         (first (if hor
+                    (window-pixel-left window)
+                  (window-pixel-top window)))
+         (last (+ first (window-size window hor t)))
+         ;; The column / row value of `posn-at-point' can be nil for the
+         ;; mini-window, guard against that.
+         (posn
+          (cond
+           ((and (numberp sign) (< sign 0))
+            (if hor
+                (1- (+ (window-pixel-top window) (window-pixel-height window)))
+              (1- (+ (window-pixel-left window) (window-pixel-width window)))))
+           ((and (numberp sign) (> sign 0))
+            (if hor
+                (window-pixel-top window)
+              (window-pixel-left window)))
+           ((let ((posn-cons (nth 2 (posn-at-point (window-point window) window))))
+              (if hor
+                  (+ (or (cdr posn-cons) 1) (window-pixel-top window))
+                (+ (or (car posn-cons) 1) (window-pixel-left window)))))))
+         (best-edge
+          (cond
+           ((eq direction 'below) (frame-pixel-height frame))
+           ((eq direction 'right) (frame-pixel-width frame))
+           (t -1)))
+         (best-edge-2 best-edge)
+         (best-diff-2 (if hor (frame-pixel-height frame) (frame-pixel-width frame)))
+         best best-2 best-diff-2-new)
     (walk-window-tree
      (lambda (w)
        (let* ((w-top (window-pixel-top w))
-	      (w-left (window-pixel-left w)))
-	 (cond
-	  ((or (eq window w)
-	       ;; Ignore ourselves.
-	       (and (window-parameter w 'no-other-window)
-		    ;; Ignore W unless IGNORE is non-nil.
-		    (not ignore))))
-	  (hor
-	   (cond
-	    ((and (<= w-top posn)
-		  (< posn (+ w-top (window-pixel-height w))))
-	     ;; W is to the left or right of WINDOW and covers POSN.
-	     (when (or (and (eq direction 'left)
-			    (or (and (<= w-left first) (> w-left best-edge))
-				(and wrap
-				     (window-at-side-p window 'left)
-				     (window-at-side-p w 'right))))
-		       (and (eq direction 'right)
-			    (or (and (>= w-left last) (< w-left best-edge))
-				(and wrap
-				     (window-at-side-p window 'right)
-				     (window-at-side-p w 'left)))))
-	       (setq best-edge w-left)
-	       (setq best w)))
-	    ((and (or (and (eq direction 'left)
-			   (<= (+ w-left (window-pixel-width w)) first))
-		      (and (eq direction 'right) (<= last w-left)))
-		  ;; W is to the left or right of WINDOW but does not
-		  ;; cover POSN.
-		  (setq best-diff-2-new
-			(window--in-direction-2 w posn hor))
-		  (or (< best-diff-2-new best-diff-2)
-		      (and (= best-diff-2-new best-diff-2)
-			   (if (eq direction 'left)
-			       (> w-left best-edge-2)
-			     (< w-left best-edge-2)))))
-	     (setq best-edge-2 w-left)
-	     (setq best-diff-2 best-diff-2-new)
-	     (setq best-2 w))))
-	  ((and (<= w-left posn)
-		(< posn (+ w-left (window-pixel-width w))))
-	   ;; W is above or below WINDOW and covers POSN.
-	   (when (or (and (eq direction 'above)
-			  (or (and (<= w-top first) (> w-top best-edge))
-			      (and wrap
-				   (window-at-side-p window 'top)
-				   (if (active-minibuffer-window)
-				       (minibuffer-window-active-p w)
-				     (window-at-side-p w 'bottom)))))
-		     (and (eq direction 'below)
-			  (or (and (>= w-top first) (< w-top best-edge))
-			      (and wrap
-				   (if (active-minibuffer-window)
-				       (minibuffer-window-active-p window)
-				     (window-at-side-p window 'bottom))
-				   (window-at-side-p w 'top)))))
-	     (setq best-edge w-top)
-	     (setq best w)))
-	  ((and (or (and (eq direction 'above)
-			 (<= (+ w-top (window-pixel-height w)) first))
-		    (and (eq direction 'below) (<= last w-top)))
-		;; W is above or below WINDOW but does not cover POSN.
-		(setq best-diff-2-new
-		      (window--in-direction-2 w posn hor))
-		(or (< best-diff-2-new best-diff-2)
-		    (and (= best-diff-2-new best-diff-2)
-			 (if (eq direction 'above)
-			     (> w-top best-edge-2)
-			   (< w-top best-edge-2)))))
-	   (setq best-edge-2 w-top)
-	   (setq best-diff-2 best-diff-2-new)
-	   (setq best-2 w)))))
+              (w-left (window-pixel-left w)))
+         (cond
+          ((or (eq window w)
+               ;; Ignore ourselves.
+               (and (window-parameter w 'no-other-window)
+                    ;; Ignore W unless IGNORE is non-nil.
+                    (not ignore))))
+          (hor
+           (cond
+            ((and (<= w-top posn)
+                  (< posn (+ w-top (window-pixel-height w))))
+             ;; W is to the left or right of WINDOW and covers POSN.
+             (when (or (and (eq direction 'left)
+                            (or (and (<= w-left first) (> w-left best-edge))
+                                (and wrap
+                                     (window-at-side-p window 'left)
+                                     (window-at-side-p w 'right))))
+                       (and (eq direction 'right)
+                            (or (and (>= w-left last) (< w-left best-edge))
+                                (and wrap
+                                     (window-at-side-p window 'right)
+                                     (window-at-side-p w 'left)))))
+               (setq best-edge w-left)
+               (setq best w)))
+            ((and (or (and (eq direction 'left)
+                           (<= (+ w-left (window-pixel-width w)) first))
+                      (and (eq direction 'right) (<= last w-left)))
+                  ;; W is to the left or right of WINDOW but does not
+                  ;; cover POSN.
+                  (setq best-diff-2-new
+                        (window--in-direction-2 w posn hor))
+                  (or (< best-diff-2-new best-diff-2)
+                      (and (= best-diff-2-new best-diff-2)
+                           (if (eq direction 'left)
+                               (> w-left best-edge-2)
+                             (< w-left best-edge-2)))))
+             (setq best-edge-2 w-left)
+             (setq best-diff-2 best-diff-2-new)
+             (setq best-2 w))))
+          ((and (<= w-left posn)
+                (< posn (+ w-left (window-pixel-width w))))
+           ;; W is above or below WINDOW and covers POSN.
+           (when (or (and (eq direction 'above)
+                          (or (and (<= w-top first) (> w-top best-edge))
+                              (and wrap
+                                   (window-at-side-p window 'top)
+                                   (if (active-minibuffer-window)
+                                       (minibuffer-window-active-p w)
+                                     (window-at-side-p w 'bottom)))))
+                     (and (eq direction 'below)
+                          (or (and (>= w-top first) (< w-top best-edge))
+                              (and wrap
+                                   (if (active-minibuffer-window)
+                                       (minibuffer-window-active-p window)
+                                     (window-at-side-p window 'bottom))
+                                   (window-at-side-p w 'top)))))
+             (setq best-edge w-top)
+             (setq best w)))
+          ((and (or (and (eq direction 'above)
+                         (<= (+ w-top (window-pixel-height w)) first))
+                    (and (eq direction 'below) (<= last w-top)))
+                ;; W is above or below WINDOW but does not cover POSN.
+                (setq best-diff-2-new
+                      (window--in-direction-2 w posn hor))
+                (or (< best-diff-2-new best-diff-2)
+                    (and (= best-diff-2-new best-diff-2)
+                         (if (eq direction 'above)
+                             (> w-top best-edge-2)
+                           (< w-top best-edge-2)))))
+           (setq best-edge-2 w-top)
+           (setq best-diff-2 best-diff-2-new)
+           (setq best-2 w)))))
      frame nil (and mini t))
     (or best best-2)))
 
@@ -2488,16 +2488,16 @@ Anything else means consider all windows on the selected frame
 and no others."
   (catch 'found
     (dolist (window (window-list-1
-		     (next-window nil minibuf all-frames)
-		     minibuf all-frames))
+                     (next-window nil minibuf all-frames)
+                     minibuf all-frames))
       (when (funcall predicate window)
-	(throw 'found window)))
+        (throw 'found window)))
     default))
 
 (defalias 'some-window 'get-window-with-predicate)
 
 (defun get-lru-window (&optional all-frames dedicated not-selected)
-   "Return the least recently used window on frames specified by ALL-FRAMES.
+  "Return the least recently used window on frames specified by ALL-FRAMES.
 Return a full-width window if possible.  A minibuffer window is
 never a candidate.  A dedicated window is never a candidate
 unless DEDICATED is non-nil, so if all windows are dedicated, the
@@ -2520,23 +2520,23 @@ have special meanings:
 
 Any other value of ALL-FRAMES means consider all windows on the
 selected frame and no others."
-   (let (best-window best-time second-best-window second-best-time time)
+  (let (best-window best-time second-best-window second-best-time time)
     (dolist (window (window-list-1 nil 'nomini all-frames))
       (when (and (or dedicated (not (window-dedicated-p window)))
-		 (or (not not-selected) (not (eq window (selected-window)))))
-	(setq time (window-use-time window))
-	(if (or (eq window (selected-window))
-		(not (window-full-width-p window)))
-	    (when (or (not second-best-time) (< time second-best-time))
-	      (setq second-best-time time)
-	      (setq second-best-window window))
-	  (when (or (not best-time) (< time best-time))
-	    (setq best-time time)
-	    (setq best-window window)))))
+                 (or (not not-selected) (not (eq window (selected-window)))))
+        (setq time (window-use-time window))
+        (if (or (eq window (selected-window))
+                (not (window-full-width-p window)))
+            (when (or (not second-best-time) (< time second-best-time))
+              (setq second-best-time time)
+              (setq second-best-window window))
+          (when (or (not best-time) (< time best-time))
+            (setq best-time time)
+            (setq best-window window)))))
     (or best-window second-best-window)))
 
 (defun get-mru-window (&optional all-frames dedicated not-selected)
-   "Return the most recently used window on frames specified by ALL-FRAMES.
+  "Return the most recently used window on frames specified by ALL-FRAMES.
 A minibuffer window is never a candidate.  A dedicated window is
 never a candidate unless DEDICATED is non-nil, so if all windows
 are dedicated, the value is nil.  Optional argument NOT-SELECTED
@@ -2557,14 +2557,14 @@ have special meanings:
 
 Any other value of ALL-FRAMES means consider all windows on the
 selected frame and no others."
-   (let (best-window best-time time)
+  (let (best-window best-time time)
     (dolist (window (window-list-1 nil 'nomini all-frames))
       (setq time (window-use-time window))
       (when (and (or dedicated (not (window-dedicated-p window)))
-		 (or (not not-selected) (not (eq window (selected-window))))
-		 (or (not best-time) (> time best-time)))
-	(setq best-time time)
-	(setq best-window window)))
+                 (or (not not-selected) (not (eq window (selected-window))))
+                 (or (not best-time) (> time best-time)))
+        (setq best-time time)
+        (setq best-window window)))
     best-window))
 
 (defun get-largest-window (&optional all-frames dedicated not-selected)
@@ -2590,15 +2590,15 @@ have special meanings:
 Any other value of ALL-FRAMES means consider all windows on the
 selected frame and no others."
   (let ((best-size 0)
-	best-window size)
+        best-window size)
     (dolist (window (window-list-1 nil 'nomini all-frames))
       (when (and (or dedicated (not (window-dedicated-p window)))
-		 (or (not not-selected) (not (eq window (selected-window)))))
-	(setq size (* (window-pixel-height window)
-		      (window-pixel-width window)))
-	(when (> size best-size)
-	  (setq best-size size)
-	  (setq best-window window))))
+                 (or (not not-selected) (not (eq window (selected-window)))))
+        (setq size (* (window-pixel-height window)
+                      (window-pixel-width window)))
+        (when (> size best-size)
+          (setq best-size size)
+          (setq best-window window))))
     best-window))
 
 (defun get-buffer-window-list (&optional buffer-or-name minibuf all-frames)
@@ -2632,10 +2632,10 @@ non-nil values of ALL-FRAMES have special meanings:
 Anything else means consider all windows on the selected frame
 and no others."
   (let ((buffer (window-normalize-buffer buffer-or-name))
-	windows)
+        windows)
     (dolist (window (window-list-1 (selected-window) minibuf all-frames))
       (when (eq (window-buffer window) buffer)
-	(setq windows (cons window windows))))
+        (setq windows (cons window windows))))
     (nreverse windows)))
 
 (defun minibuffer-window-active-p (window)
@@ -2643,7 +2643,7 @@ and no others."
   (and (window-live-p window) (eq window (active-minibuffer-window))))
 
 (defun count-windows (&optional minibuf all-frames)
-   "Return the number of live windows on the selected frame.
+  "Return the number of live windows on the selected frame.
 
 The optional argument MINIBUF specifies whether the minibuffer
 window is included in the count.
@@ -2652,7 +2652,7 @@ If ALL-FRAMES is non-nil, count the windows in all frames instead
 just the selected frame.
 
 See `walk-windows' for the precise meaning of this argument."
-   (length (window-list-1 nil minibuf all-frames)))
+  (length (window-list-1 nil minibuf all-frames)))
 \f
 ;;; Resizing windows.
 (defun window--size-to-pixel (window size &optional horizontal pixelwise round-maybe)
@@ -2672,52 +2672,52 @@ WINDOW's frame if the option `window-resize-pixelwise' is nil."
   (setq window (window-normalize-window window))
   (let ((char-size (frame-char-size window horizontal)))
     (if pixelwise
-	(if (and round-maybe (not window-resize-pixelwise))
-	    (* (round size char-size) char-size)
-	  size)
+        (if (and round-maybe (not window-resize-pixelwise))
+            (* (round size char-size) char-size)
+          size)
       (* size char-size))))
 
 (defun window--pixel-to-total-1 (window horizontal char-size)
   "Subroutine of `window--pixel-to-total'."
   (let ((child (window-child window)))
     (if (window-combination-p window horizontal)
-	;; In an iso-combination distribute sizes proportionally.
-	(let ((remainder (window-new-total window))
-	      size best-child rem best-rem)
-	  ;; Initialize total sizes to each child's floor.
-	  (while child
-	    (setq size (max (/ (window-size child horizontal t) char-size) 1))
-	    (set-window-new-total child size)
-	    (setq remainder (- remainder size))
-	    (setq child (window-next-sibling child)))
-	  ;; Distribute remainder.
-	  (while (> remainder 0)
-	    (setq child (window-last-child window))
-	    (setq best-child nil)
-	    (setq best-rem 0)
-	    (while child
-	      (when (and (<= (window-new-total child)
-			     (/ (window-size child horizontal t) char-size))
-			 (> (setq rem (% (window-size child horizontal t)
-					 char-size))
-			    best-rem))
-		   (setq best-child child)
-		   (setq best-rem rem))
-	      (setq child (window-prev-sibling child)))
-	    ;; We MUST have a best-child here.
-	    (set-window-new-total best-child 1 t)
-	    (setq remainder (1- remainder)))
-	  ;; Recurse.
-	  (setq child (window-child window))
-	  (while child
-	    (window--pixel-to-total-1 child horizontal char-size)
-	    (setq child (window-next-sibling child))))
+        ;; In an iso-combination distribute sizes proportionally.
+        (let ((remainder (window-new-total window))
+              size best-child rem best-rem)
+          ;; Initialize total sizes to each child's floor.
+          (while child
+            (setq size (max (/ (window-size child horizontal t) char-size) 1))
+            (set-window-new-total child size)
+            (setq remainder (- remainder size))
+            (setq child (window-next-sibling child)))
+          ;; Distribute remainder.
+          (while (> remainder 0)
+            (setq child (window-last-child window))
+            (setq best-child nil)
+            (setq best-rem 0)
+            (while child
+              (when (and (<= (window-new-total child)
+                             (/ (window-size child horizontal t) char-size))
+                         (> (setq rem (% (window-size child horizontal t)
+                                         char-size))
+                            best-rem))
+                (setq best-child child)
+                (setq best-rem rem))
+              (setq child (window-prev-sibling child)))
+            ;; We MUST have a best-child here.
+            (set-window-new-total best-child 1 t)
+            (setq remainder (1- remainder)))
+          ;; Recurse.
+          (setq child (window-child window))
+          (while child
+            (window--pixel-to-total-1 child horizontal char-size)
+            (setq child (window-next-sibling child))))
       ;; In an ortho-combination assign new sizes directly.
       (let ((size (window-new-total window)))
-	(while child
-	  (set-window-new-total child size)
-	  (window--pixel-to-total-1 child horizontal char-size)
-	  (setq child (window-next-sibling child)))))))
+        (while child
+          (set-window-new-total child size)
+          (window--pixel-to-total-1 child horizontal char-size)
+          (setq child (window-next-sibling child)))))))
 
 (defun window--pixel-to-total (&optional frame horizontal)
   "On FRAME assign new total window heights from pixel heights.
@@ -2727,34 +2727,34 @@ Optional argument HORIZONTAL non-nil means assign new total
 window widths from pixel widths."
   (setq frame (window-normalize-frame frame))
   (let* ((char-size (frame-char-size frame horizontal))
-	 (root (frame-root-window frame))
-	 (root-size (window-size root horizontal t))
-	 ;; We have to care about the minibuffer window only if it
-	 ;; appears together with the root window on this frame.
-	 (mini (let ((mini (minibuffer-window frame)))
-		 (and (eq (window-frame mini) frame)
-		      (not (eq mini root)) mini)))
-	 (mini-size (and mini (window-size mini horizontal t))))
+         (root (frame-root-window frame))
+         (root-size (window-size root horizontal t))
+         ;; We have to care about the minibuffer window only if it
+         ;; appears together with the root window on this frame.
+         (mini (let ((mini (minibuffer-window frame)))
+                 (and (eq (window-frame mini) frame)
+                      (not (eq mini root)) mini)))
+         (mini-size (and mini (window-size mini horizontal t))))
     ;; We round the line/column sizes of windows here to the nearest
     ;; integer.  In some cases this can make windows appear _larger_
     ;; than the containing frame (line/column-wise) because the latter's
     ;; sizes are not (yet) rounded.  We might eventually fix that.
     (if (and mini (not horizontal))
-	(let (lines)
-	  (set-window-new-total root (max (/ root-size char-size) 1))
-	  (set-window-new-total mini (max (/ mini-size char-size) 1))
-	  (setq lines (- (round (+ root-size mini-size) char-size)
-			 (+ (window-new-total root) (window-new-total mini))))
-	  (while (> lines 0)
-	    (if (>= (% root-size (window-new-total root))
-		    (% mini-size (window-new-total mini)))
-		(set-window-new-total root 1 t)
-	      (set-window-new-total mini 1 t))
-	    (setq lines (1- lines))))
+        (let (lines)
+          (set-window-new-total root (max (/ root-size char-size) 1))
+          (set-window-new-total mini (max (/ mini-size char-size) 1))
+          (setq lines (- (round (+ root-size mini-size) char-size)
+                         (+ (window-new-total root) (window-new-total mini))))
+          (while (> lines 0)
+            (if (>= (% root-size (window-new-total root))
+                    (% mini-size (window-new-total mini)))
+                (set-window-new-total root 1 t)
+              (set-window-new-total mini 1 t))
+            (setq lines (1- lines))))
       (set-window-new-total root (round root-size char-size))
       (when mini
-	;; This is taken in the horizontal case only.
-	(set-window-new-total mini (round mini-size char-size))))
+        ;; This is taken in the horizontal case only.
+        (set-window-new-total mini (round mini-size char-size))))
     (unless (window-buffer root)
       (window--pixel-to-total-1 root horizontal char-size))
     ;; Apply the new sizes.
@@ -2793,28 +2793,28 @@ If WINDOW cannot be resized by DELTA pixels make it as large (or
 as small) as possible, but don't signal an error."
   (when (window-minibuffer-p window)
     (let* ((frame (window-frame window))
-	   (root (frame-root-window frame))
-	   (height (window-pixel-height window))
+           (root (frame-root-window frame))
+           (height (window-pixel-height window))
            (min-height (+ (frame-char-height frame)
                           (- (window-pixel-height window)
                              (window-body-height window t))))
            (max-delta (- (window-pixel-height root)
-	                 (window-min-size root nil nil t))))
+                         (window-min-size root nil nil t))))
       ;; Don't make mini window too small.
       (when (< (+ height delta) min-height)
-	(setq delta (- min-height height)))
+        (setq delta (- min-height height)))
       ;; Don't make root window too small.
       (when (> delta max-delta)
-	(setq delta max-delta))
+        (setq delta max-delta))
 
       (unless (zerop delta)
-	(window--resize-reset frame)
-	(window--resize-this-window root (- delta) nil nil t)
-	(set-window-new-pixel window (+ height delta))
-	;; The following routine catches the case where we want to resize
-	;; a minibuffer-only frame.
-	(when (resize-mini-window-internal window)
-	  (window--pixel-to-total frame))))))
+        (window--resize-reset frame)
+        (window--resize-this-window root (- delta) nil nil t)
+        (set-window-new-pixel window (+ height delta))
+        ;; The following routine catches the case where we want to resize
+        ;; a minibuffer-only frame.
+        (when (resize-mini-window-internal window)
+          (window--pixel-to-total frame))))))
 
 (defun window--resize-apply-p (frame &optional horizontal)
   "Return t when a window on FRAME shall be resized vertically.
@@ -2824,8 +2824,8 @@ shall be resized horizontally."
     (walk-window-tree
      (lambda (window)
        (unless (= (window-new-pixel window)
-		  (window-size window horizontal t))
-	 (throw 'apply t)))
+                  (window-size window horizontal t))
+         (throw 'apply t)))
      frame t t)
     nil))
 
@@ -2862,58 +2862,58 @@ edge of WINDOW consider using `adjust-window-trailing-edge'
 instead."
   (setq window (window-normalize-window window))
   (let* ((frame (window-frame window))
-	 (minibuffer-window (minibuffer-window frame))
-	 sibling)
+         (minibuffer-window (minibuffer-window frame))
+         sibling)
     (setq delta (window--size-to-pixel
-		 window delta horizontal pixelwise t))
+                 window delta horizontal pixelwise t))
     (cond
      ((eq window (frame-root-window frame))
       (error "Cannot resize the root window of a frame"))
      ((window-minibuffer-p window)
       (if horizontal
-	  (error "Cannot resize minibuffer window horizontally")
-	(window--resize-mini-window window delta)))
+          (error "Cannot resize minibuffer window horizontally")
+        (window--resize-mini-window window delta)))
      ((and (not horizontal)
-	   (window-full-height-p window)
-	   (eq (window-frame minibuffer-window) frame)
-	   (or (not resize-mini-windows)
-	       (eq minibuffer-window (active-minibuffer-window))))
+           (window-full-height-p window)
+           (eq (window-frame minibuffer-window) frame)
+           (or (not resize-mini-windows)
+               (eq minibuffer-window (active-minibuffer-window))))
       ;; If WINDOW is full height and either `resize-mini-windows' is
       ;; nil or the minibuffer window is active, resize the minibuffer
       ;; window.
       (window--resize-mini-window minibuffer-window (- delta)))
      ((or (window--resizable-p
-	   window delta horizontal ignore nil nil nil t)
-	  (and (not ignore)
-	       (setq ignore 'preserved)
-	       (window--resizable-p
-		window delta horizontal ignore nil nil nil t)))
+           window delta horizontal ignore nil nil nil t)
+          (and (not ignore)
+               (setq ignore 'preserved)
+               (window--resizable-p
+                window delta horizontal ignore nil nil nil t)))
       (window--resize-reset frame horizontal)
       (window--resize-this-window window delta horizontal ignore t)
       (if (and (not (eq window-combination-resize t))
-	       (window-combined-p window horizontal)
-	       (setq sibling (or (window-right window) (window-left window)))
-	       (window-sizable-p
-		sibling (- delta) horizontal ignore t))
-	  ;; If window-combination-resize is nil, WINDOW is part of an
-	  ;; iso-combination, and WINDOW's neighboring right or left
-	  ;; sibling can be resized as requested, resize that sibling.
-	  (let ((normal-delta
-		 (/ (float delta)
-		    (window-size (window-parent window) horizontal t))))
-	    (window--resize-this-window sibling (- delta) horizontal nil t)
-	    (set-window-new-normal
-	     window (+ (window-normal-size window horizontal)
-		       normal-delta))
-	    (set-window-new-normal
-	     sibling (- (window-normal-size sibling horizontal)
-			normal-delta)))
-	;; Otherwise, resize all other windows in the same combination.
-	(window--resize-siblings window delta horizontal ignore))
+               (window-combined-p window horizontal)
+               (setq sibling (or (window-right window) (window-left window)))
+               (window-sizable-p
+                sibling (- delta) horizontal ignore t))
+          ;; If window-combination-resize is nil, WINDOW is part of an
+          ;; iso-combination, and WINDOW's neighboring right or left
+          ;; sibling can be resized as requested, resize that sibling.
+          (let ((normal-delta
+                 (/ (float delta)
+                    (window-size (window-parent window) horizontal t))))
+            (window--resize-this-window sibling (- delta) horizontal nil t)
+            (set-window-new-normal
+             window (+ (window-normal-size window horizontal)
+                       normal-delta))
+            (set-window-new-normal
+             sibling (- (window-normal-size sibling horizontal)
+                        normal-delta)))
+        ;; Otherwise, resize all other windows in the same combination.
+        (window--resize-siblings window delta horizontal ignore))
       (when (window--resize-apply-p frame horizontal)
-	(if (window-resize-apply frame horizontal)
-	    (window--pixel-to-total frame horizontal)
-	  (error "Failed to apply resizing %s" window))))
+        (if (window-resize-apply frame horizontal)
+            (window--pixel-to-total frame horizontal)
+          (error "Failed to apply resizing %s" window))))
      (t
       (error "Cannot resize window %s" window)))))
 
@@ -2923,7 +2923,7 @@ This function is like `window-resize' but does not signal an
 error when WINDOW cannot be resized.  For the meaning of the
 optional arguments see the documentation of `window-resize'."
   (when (window--resizable-p
-	 window delta horizontal ignore nil nil nil pixelwise)
+         window delta horizontal ignore nil nil nil pixelwise)
     (window-resize window delta horizontal ignore pixelwise)))
 
 (defun window--resize-child-windows-skip-p (window)
@@ -2942,20 +2942,20 @@ OTHER-DELTA, a number, specifies that this many lines (columns)
 have been obtained from (or returned to) an ancestor window of
 PARENT in order to resize WINDOW."
   (let* ((delta-normal
-	  (if (and (= (- this-delta)
-		      (window-size window horizontal t))
-		   (zerop other-delta))
-	      ;; When WINDOW gets deleted and we can return its entire
-	      ;; space to its siblings, use WINDOW's normal size as the
-	      ;; normal delta.
-	      (- (window-normal-size window horizontal))
-	    ;; In any other case calculate the normal delta from the
-	    ;; relation of THIS-DELTA to the total size of PARENT.
-	    (/ (float this-delta)
-	       (window-size parent horizontal t))))
-	 (sub (window-child parent))
-	 (parent-normal 0.0)
-	 (skip (eq trail 'after)))
+          (if (and (= (- this-delta)
+                      (window-size window horizontal t))
+                   (zerop other-delta))
+              ;; When WINDOW gets deleted and we can return its entire
+              ;; space to its siblings, use WINDOW's normal size as the
+              ;; normal delta.
+              (- (window-normal-size window horizontal))
+            ;; In any other case calculate the normal delta from the
+            ;; relation of THIS-DELTA to the total size of PARENT.
+            (/ (float this-delta)
+               (window-size parent horizontal t))))
+         (sub (window-child parent))
+         (parent-normal 0.0)
+         (skip (eq trail 'after)))
 
     ;; Set parent-normal to the sum of the normal sizes of all child
     ;; windows of PARENT that shall be resized, excluding only WINDOW
@@ -2963,11 +2963,11 @@ PARENT in order to resize WINDOW."
     (while sub
       (cond
        ((eq sub window)
-	(setq skip (eq trail 'before)))
+        (setq skip (eq trail 'before)))
        (skip)
        (t
-	(setq parent-normal
-	      (+ parent-normal (window-normal-size sub horizontal)))))
+        (setq parent-normal
+              (+ parent-normal (window-normal-size sub horizontal)))))
       (setq sub (window-right sub)))
 
     ;; Set the new normal size of all child windows of PARENT from what
@@ -2978,39 +2978,39 @@ PARENT in order to resize WINDOW."
     (while sub
       (cond
        ((eq sub window)
-	(setq skip (eq trail 'before)))
+        (setq skip (eq trail 'before)))
        (skip)
        (t
-	(let ((old-normal (window-normal-size sub horizontal)))
-	  (set-window-new-normal
-	   sub (min 1.0 ; Don't get larger than 1.
-		    (max (- old-normal
-			    (* (/ old-normal parent-normal)
-			       delta-normal))
-			 ;; Don't drop below 0.
-			 0.0))))))
+        (let ((old-normal (window-normal-size sub horizontal)))
+          (set-window-new-normal
+           sub (min 1.0 ; Don't get larger than 1.
+                    (max (- old-normal
+                            (* (/ old-normal parent-normal)
+                               delta-normal))
+                         ;; Don't drop below 0.
+                         0.0))))))
       (setq sub (window-right sub)))
 
     (when (numberp other-delta)
       ;; Set the new normal size of windows from what they should have
       ;; contributed for recovering OTHER-DELTA lines (columns).
       (setq delta-normal (/ (float (window-size parent horizontal t))
-			    (+ (window-size parent horizontal t)
-			       other-delta)))
+                            (+ (window-size parent horizontal t)
+                               other-delta)))
       (setq sub (window-child parent))
       (setq skip (eq trail 'after))
       (while sub
-	(cond
-	 ((eq sub window)
-	  (setq skip (eq trail 'before)))
-	 (skip)
-	 (t
-	  (set-window-new-normal
-	   sub (min 1.0 ; Don't get larger than 1.
-		    (max (* (window-new-normal sub) delta-normal)
-			 ;; Don't drop below 0.
-			 0.0)))))
-	(setq sub (window-right sub))))
+        (cond
+         ((eq sub window)
+          (setq skip (eq trail 'before)))
+         (skip)
+         (t
+          (set-window-new-normal
+           sub (min 1.0 ; Don't get larger than 1.
+                    (max (* (window-new-normal sub) delta-normal)
+                         ;; Don't drop below 0.
+                         0.0)))))
+        (setq sub (window-right sub))))
 
     ;; Set the new normal size of WINDOW to what is left by the sum of
     ;; the normal sizes of its siblings.
@@ -3019,13 +3019,13 @@ PARENT in order to resize WINDOW."
      (let ((sum 0))
        (setq sub (window-child parent))
        (while sub
-	 (cond
-	  ((eq sub window))
-	  ((not (numberp (window-new-normal sub)))
-	   (setq sum (+ sum (window-normal-size sub horizontal))))
-	  (t
-	   (setq sum (+ sum (window-new-normal sub)))))
-	 (setq sub (window-right sub)))
+         (cond
+          ((eq sub window))
+          ((not (numberp (window-new-normal sub)))
+           (setq sum (+ sum (window-normal-size sub horizontal))))
+          (t
+           (setq sum (+ sum (window-new-normal sub)))))
+         (setq sub (window-right sub)))
        ;; Don't get larger than 1 or smaller than 0.
        (min 1.0 (max (- 1.0 sum) 0.0))))))
 
@@ -3057,162 +3057,162 @@ If CHAR-SIZE is nil, this means to use the value of
 Return the symbol `normalized' if new normal sizes have been
 already set by this routine."
   (let* ((first (window-child parent))
-	 (last (window-last-child parent))
-	 (parent-total (+ (window-size parent horizontal t)
-			  delta))
-	 (char-size (or char-size
-			(and window-resize-pixelwise 1)
-			(frame-char-size window horizontal)))
-	 sub best-window best-value best-delta)
+         (last (window-last-child parent))
+         (parent-total (+ (window-size parent horizontal t)
+                          delta))
+         (char-size (or char-size
+                        (and window-resize-pixelwise 1)
+                        (frame-char-size window horizontal)))
+         sub best-window best-value best-delta)
 
     (if (and edge (memq trail '(before after))
-	     (progn
-	       (setq sub first)
-	       (while (and (window-right sub)
-			   (or (and (eq trail 'before)
-				    (not (window--resize-child-windows-skip-p
-					  (window-right sub))))
-			       (and (eq trail 'after)
-				    (window--resize-child-windows-skip-p sub))))
-		 (setq sub (window-right sub)))
-	       sub)
-	     (if horizontal
-		 (if (eq trail 'before)
-		     (= (+ (window-pixel-left sub) (window-pixel-width sub))
-			edge)
-		   (= (window-pixel-left sub) edge))
-	       (if (eq trail 'before)
-		   (= (+ (window-pixel-top sub) (window-pixel-height sub))
-		      edge)
-		 (= (window-pixel-top sub) edge)))
-	     (window-sizable-p sub delta horizontal ignore t))
-	;; Resize only windows adjacent to EDGE.
-	(progn
-	  (window--resize-this-window
-	   sub delta horizontal ignore t trail edge)
-	  (if (and window (eq (window-parent sub) parent))
-	      (progn
-		;; Assign new normal sizes.
-		(set-window-new-normal
-		 sub (/ (float (window-new-pixel sub)) parent-total))
-		(set-window-new-normal
-		 window (- (window-normal-size window horizontal)
-			   (- (window-new-normal sub)
-			      (window-normal-size sub horizontal)))))
-	    (window--resize-child-windows-normal
-	     parent horizontal sub 0 trail delta))
-	  ;; Return 'normalized to notify `window--resize-siblings' that
-	  ;; normal sizes have been already set.
-	  'normalized)
+             (progn
+               (setq sub first)
+               (while (and (window-right sub)
+                           (or (and (eq trail 'before)
+                                    (not (window--resize-child-windows-skip-p
+                                          (window-right sub))))
+                               (and (eq trail 'after)
+                                    (window--resize-child-windows-skip-p sub))))
+                 (setq sub (window-right sub)))
+               sub)
+             (if horizontal
+                 (if (eq trail 'before)
+                     (= (+ (window-pixel-left sub) (window-pixel-width sub))
+                        edge)
+                   (= (window-pixel-left sub) edge))
+               (if (eq trail 'before)
+                   (= (+ (window-pixel-top sub) (window-pixel-height sub))
+                      edge)
+                 (= (window-pixel-top sub) edge)))
+             (window-sizable-p sub delta horizontal ignore t))
+        ;; Resize only windows adjacent to EDGE.
+        (progn
+          (window--resize-this-window
+           sub delta horizontal ignore t trail edge)
+          (if (and window (eq (window-parent sub) parent))
+              (progn
+                ;; Assign new normal sizes.
+                (set-window-new-normal
+                 sub (/ (float (window-new-pixel sub)) parent-total))
+                (set-window-new-normal
+                 window (- (window-normal-size window horizontal)
+                           (- (window-new-normal sub)
+                              (window-normal-size sub horizontal)))))
+            (window--resize-child-windows-normal
+             parent horizontal sub 0 trail delta))
+          ;; Return 'normalized to notify `window--resize-siblings' that
+          ;; normal sizes have been already set.
+          'normalized)
       ;; Resize all windows proportionally.
       (setq sub last)
       (while sub
-	(cond
-	 ((or (window--resize-child-windows-skip-p sub)
-	      ;; Ignore windows to skip and fixed-size child windows -
-	      ;; in the latter case make it a window to skip.
-	      (and (not ignore)
-		   (window-size-fixed-p sub horizontal ignore)
-		   (set-window-new-normal sub 'ignore))))
-	 ((< delta 0)
-	  ;; When shrinking store the number of lines/cols we can get
-	  ;; from this window here together with the total/normal size
-	  ;; factor.
-	  (set-window-new-normal
-	   sub
-	   (cons
-	    ;; We used to call this with NODOWN t, "fixed" 2011-05-11.
-	    (window-min-delta sub horizontal ignore trail t nil t)
-	    (- (/ (float (window-size sub horizontal t))
-		  parent-total)
-	       (window-normal-size sub horizontal)))))
-	 ((> delta 0)
-	  ;; When enlarging store the total/normal size factor only
-	  (set-window-new-normal
-	   sub
-	   (- (/ (float (window-size sub horizontal t))
-		 parent-total)
-	      (window-normal-size sub horizontal)))))
-
-	(setq sub (window-left sub)))
+        (cond
+         ((or (window--resize-child-windows-skip-p sub)
+              ;; Ignore windows to skip and fixed-size child windows -
+              ;; in the latter case make it a window to skip.
+              (and (not ignore)
+                   (window-size-fixed-p sub horizontal ignore)
+                   (set-window-new-normal sub 'ignore))))
+         ((< delta 0)
+          ;; When shrinking store the number of lines/cols we can get
+          ;; from this window here together with the total/normal size
+          ;; factor.
+          (set-window-new-normal
+           sub
+           (cons
+            ;; We used to call this with NODOWN t, "fixed" 2011-05-11.
+            (window-min-delta sub horizontal ignore trail t nil t)
+            (- (/ (float (window-size sub horizontal t))
+                  parent-total)
+               (window-normal-size sub horizontal)))))
+         ((> delta 0)
+          ;; When enlarging store the total/normal size factor only
+          (set-window-new-normal
+           sub
+           (- (/ (float (window-size sub horizontal t))
+                 parent-total)
+              (window-normal-size sub horizontal)))))
+
+        (setq sub (window-left sub)))
 
       (cond
        ((< delta 0)
-	;; Shrink windows by delta.
-	(setq best-window t)
-	(while (and best-window (not (zerop delta)))
-	  (setq sub last)
-	  (setq best-window nil)
-	  (setq best-value nil)
-	  (while sub
-	    (when (and (consp (window-new-normal sub))
-		       (not (<= (car (window-new-normal sub)) 0))
-		       (or (not best-value)
-			   (> (cdr (window-new-normal sub)) best-value)))
-	      (setq best-window sub)
-	      (setq best-value (cdr (window-new-normal sub))))
-
-	    (setq sub (window-left sub)))
-
-	  (when best-window
-	    (setq best-delta (min (car (window-new-normal best-window))
-				  char-size (- delta)))
-	    (setq delta (+ delta best-delta))
-	    (set-window-new-pixel best-window (- best-delta) t)
-	    (set-window-new-normal
-	     best-window
-	     (if (= (car (window-new-normal best-window)) best-delta)
-		 'skip	    ; We can't shrink best-window any further.
-	       (cons (- (car (window-new-normal best-window)) best-delta)
-		     (- (/ (float (window-new-pixel best-window))
-			   parent-total)
-			(window-normal-size best-window horizontal))))))))
+        ;; Shrink windows by delta.
+        (setq best-window t)
+        (while (and best-window (not (zerop delta)))
+          (setq sub last)
+          (setq best-window nil)
+          (setq best-value nil)
+          (while sub
+            (when (and (consp (window-new-normal sub))
+                       (not (<= (car (window-new-normal sub)) 0))
+                       (or (not best-value)
+                           (> (cdr (window-new-normal sub)) best-value)))
+              (setq best-window sub)
+              (setq best-value (cdr (window-new-normal sub))))
+
+            (setq sub (window-left sub)))
+
+          (when best-window
+            (setq best-delta (min (car (window-new-normal best-window))
+                                  char-size (- delta)))
+            (setq delta (+ delta best-delta))
+            (set-window-new-pixel best-window (- best-delta) t)
+            (set-window-new-normal
+             best-window
+             (if (= (car (window-new-normal best-window)) best-delta)
+                 'skip      ; We can't shrink best-window any further.
+               (cons (- (car (window-new-normal best-window)) best-delta)
+                     (- (/ (float (window-new-pixel best-window))
+                           parent-total)
+                        (window-normal-size best-window horizontal))))))))
        ((> delta 0)
-	;; Enlarge windows by delta.
-	(setq best-window t)
-	(while (and best-window (not (zerop delta)))
-	  (setq sub last)
-	  (setq best-window nil)
-	  (setq best-value nil)
-	  (while sub
-	    (when (and (numberp (window-new-normal sub))
-		       (or (not best-value)
-		           (< (window-new-normal sub) best-value)))
-	      (setq best-window sub)
-	      (setq best-value (window-new-normal sub)))
-
-	    (setq sub (window-left sub)))
-
-	  (when best-window
-	    (setq best-delta (min delta char-size))
-	    (setq delta (- delta best-delta))
-	    (set-window-new-pixel best-window best-delta t)
-	    (set-window-new-normal
-	     best-window
-	     (- (/ (float (window-new-pixel best-window))
-		   parent-total)
-		(window-normal-size best-window horizontal)))))))
+        ;; Enlarge windows by delta.
+        (setq best-window t)
+        (while (and best-window (not (zerop delta)))
+          (setq sub last)
+          (setq best-window nil)
+          (setq best-value nil)
+          (while sub
+            (when (and (numberp (window-new-normal sub))
+                       (or (not best-value)
+                           (< (window-new-normal sub) best-value)))
+              (setq best-window sub)
+              (setq best-value (window-new-normal sub)))
+
+            (setq sub (window-left sub)))
+
+          (when best-window
+            (setq best-delta (min delta char-size))
+            (setq delta (- delta best-delta))
+            (set-window-new-pixel best-window best-delta t)
+            (set-window-new-normal
+             best-window
+             (- (/ (float (window-new-pixel best-window))
+                   parent-total)
+                (window-normal-size best-window horizontal)))))))
 
       (when best-window
-	(setq sub last)
-	(while sub
-	  (when (or (consp (window-new-normal sub))
-		    (numberp (window-new-normal sub)))
-	    ;; Reset new normal size fields so `window-resize-apply'
-	    ;; won't use them to apply new sizes.
-	    (set-window-new-normal sub))
-
-	  (unless (eq (window-new-normal sub) 'ignore)
-	    ;; Resize this window's child windows (back-engineering
-	    ;; delta from sub's old and new total sizes).
-	    (let ((delta (- (window-new-pixel sub)
-			    (window-size sub horizontal t))))
-	      (unless (and (zerop delta) (not trail))
-		;; For the TRAIL non-nil case we have to resize SUB
-		;; recursively even if it's size does not change.
-		(window--resize-this-window
-		 sub delta horizontal ignore nil trail edge))))
-	  (setq sub (window-left sub)))))))
+        (setq sub last)
+        (while sub
+          (when (or (consp (window-new-normal sub))
+                    (numberp (window-new-normal sub)))
+            ;; Reset new normal size fields so `window-resize-apply'
+            ;; won't use them to apply new sizes.
+            (set-window-new-normal sub))
+
+          (unless (eq (window-new-normal sub) 'ignore)
+            ;; Resize this window's child windows (back-engineering
+            ;; delta from sub's old and new total sizes).
+            (let ((delta (- (window-new-pixel sub)
+                            (window-size sub horizontal t))))
+              (unless (and (zerop delta) (not trail))
+                ;; For the TRAIL non-nil case we have to resize SUB
+                ;; recursively even if it's size does not change.
+                (window--resize-this-window
+                 sub delta horizontal ignore nil trail edge))))
+          (setq sub (window-left sub)))))))
 
 (defun window--resize-siblings (window delta &optional horizontal ignore trail edge char-size)
   "Resize other windows when WINDOW is resized vertically by DELTA pixels.
@@ -3230,88 +3230,88 @@ resize only windows on the left or above EDGE.  If TRAIL equals
 preferably only resize windows adjacent to EDGE."
   (when (window-parent window)
     (let* ((parent (window-parent window))
-	   (sub (window-child parent)))
+           (sub (window-child parent)))
       (if (window-combined-p sub horizontal)
-	  ;; In an iso-combination try to extract DELTA from WINDOW's
-	  ;; siblings.
-	  (let ((skip (eq trail 'after))
-		this-delta other-delta)
-	    ;; Decide which windows shall be left alone.
-	    (while sub
-	      (cond
-	       ((eq sub window)
-		;; Make sure WINDOW is left alone when
-		;; resizing its siblings.
-		(set-window-new-normal sub 'ignore)
-		(setq skip (eq trail 'before)))
-	       (skip
-		;; Make sure this sibling is left alone when
-		;; resizing its siblings.
-		(set-window-new-normal sub 'ignore))
-	       ((not (window-size-fixed-p sub horizontal ignore))
-		;; Set this-delta to t to signal that we found a sibling
-		;; of WINDOW whose size is not fixed.
-		(setq this-delta t)))
-
-	      (setq sub (window-right sub)))
-
-	    ;; Set this-delta to what we can get from WINDOW's siblings.
-	    (if (= (- delta) (window-size window horizontal t))
-		;; A deletion, presumably.  We must handle this case
-		;; specially since `window--resizable' can't be used.
-		(if this-delta
-		    ;; There's at least one resizable sibling we can
-		    ;; give WINDOW's size to.
-		    (setq this-delta delta)
-		  ;; No resizable sibling exists.
-		  (setq this-delta 0))
-	      ;; Any other form of resizing.
-	      (setq this-delta
-		    (window--resizable
-		     window delta horizontal ignore trail t nil t)))
-
-	    ;; Set other-delta to what we still have to get from
-	    ;; ancestor windows of parent.
-	    (setq other-delta (- delta this-delta))
-	    (unless (zerop other-delta)
-	      ;; Unless we got everything from WINDOW's siblings, PARENT
-	      ;; must be resized by other-delta lines or columns.
-	      (set-window-new-pixel parent other-delta 'add))
-
-	    (if (zerop this-delta)
-		;; We haven't got anything from WINDOW's siblings but we
-		;; must update the normal sizes to respect other-delta.
-		(window--resize-child-windows-normal
-		 parent horizontal window this-delta trail other-delta)
-	      ;; We did get something from WINDOW's siblings which means
-	      ;; we have to resize their child windows.
-	      (unless (eq (window--resize-child-windows
-			   parent (- this-delta) horizontal
-			   window ignore trail edge char-size)
-			  ;; If `window--resize-child-windows' returns
-			  ;; 'normalized, this means it has set the
-			  ;; normal sizes already.
-			  'normalized)
-		;; Set the normal sizes.
-		(window--resize-child-windows-normal
-		 parent horizontal window this-delta trail other-delta))
-	      ;; Set DELTA to what we still have to get from ancestor
-	      ;; windows.
-	      (setq delta other-delta)))
-
-	;; In an ortho-combination all siblings of WINDOW must be
-	;; resized by DELTA.
-	(set-window-new-pixel parent delta 'add)
-	(while sub
-	  (unless (eq sub window)
-	    (window--resize-this-window
-	     sub delta horizontal ignore t))
-	  (setq sub (window-right sub))))
+          ;; In an iso-combination try to extract DELTA from WINDOW's
+          ;; siblings.
+          (let ((skip (eq trail 'after))
+                this-delta other-delta)
+            ;; Decide which windows shall be left alone.
+            (while sub
+              (cond
+               ((eq sub window)
+                ;; Make sure WINDOW is left alone when
+                ;; resizing its siblings.
+                (set-window-new-normal sub 'ignore)
+                (setq skip (eq trail 'before)))
+               (skip
+                ;; Make sure this sibling is left alone when
+                ;; resizing its siblings.
+                (set-window-new-normal sub 'ignore))
+               ((not (window-size-fixed-p sub horizontal ignore))
+                ;; Set this-delta to t to signal that we found a sibling
+                ;; of WINDOW whose size is not fixed.
+                (setq this-delta t)))
+
+              (setq sub (window-right sub)))
+
+            ;; Set this-delta to what we can get from WINDOW's siblings.
+            (if (= (- delta) (window-size window horizontal t))
+                ;; A deletion, presumably.  We must handle this case
+                ;; specially since `window--resizable' can't be used.
+                (if this-delta
+                    ;; There's at least one resizable sibling we can
+                    ;; give WINDOW's size to.
+                    (setq this-delta delta)
+                  ;; No resizable sibling exists.
+                  (setq this-delta 0))
+              ;; Any other form of resizing.
+              (setq this-delta
+                    (window--resizable
+                     window delta horizontal ignore trail t nil t)))
+
+            ;; Set other-delta to what we still have to get from
+            ;; ancestor windows of parent.
+            (setq other-delta (- delta this-delta))
+            (unless (zerop other-delta)
+              ;; Unless we got everything from WINDOW's siblings, PARENT
+              ;; must be resized by other-delta lines or columns.
+              (set-window-new-pixel parent other-delta 'add))
+
+            (if (zerop this-delta)
+                ;; We haven't got anything from WINDOW's siblings but we
+                ;; must update the normal sizes to respect other-delta.
+                (window--resize-child-windows-normal
+                 parent horizontal window this-delta trail other-delta)
+              ;; We did get something from WINDOW's siblings which means
+              ;; we have to resize their child windows.
+              (unless (eq (window--resize-child-windows
+                           parent (- this-delta) horizontal
+                           window ignore trail edge char-size)
+                          ;; If `window--resize-child-windows' returns
+                          ;; 'normalized, this means it has set the
+                          ;; normal sizes already.
+                          'normalized)
+                ;; Set the normal sizes.
+                (window--resize-child-windows-normal
+                 parent horizontal window this-delta trail other-delta))
+              ;; Set DELTA to what we still have to get from ancestor
+              ;; windows.
+              (setq delta other-delta)))
+
+        ;; In an ortho-combination all siblings of WINDOW must be
+        ;; resized by DELTA.
+        (set-window-new-pixel parent delta 'add)
+        (while sub
+          (unless (eq sub window)
+            (window--resize-this-window
+             sub delta horizontal ignore t))
+          (setq sub (window-right sub))))
 
       (unless (zerop delta)
-	;; "Go up."
-	(window--resize-siblings
-	 parent delta horizontal ignore trail edge char-size)))))
+        ;; "Go up."
+        (window--resize-siblings
+         parent delta horizontal ignore trail edge char-size)))))
 
 (defun window--resize-this-window (window delta &optional horizontal ignore add trail edge char-size)
   "Resize WINDOW vertically by DELTA pixels.
@@ -3354,9 +3354,9 @@ actually take effect."
      ;; In an ortho-combination resize each child window by DELTA.
      (t
       (while sub
-	(window--resize-this-window
-	 sub delta horizontal ignore t trail edge char-size)
-	(setq sub (window-right sub)))))))
+        (window--resize-this-window
+         sub delta horizontal ignore t trail edge char-size)
+        (setq sub (window-right sub)))))))
 
 (defun window--resize-root-window (window delta horizontal ignore pixelwise)
   "Resize root window WINDOW vertically by DELTA lines.
@@ -3370,13 +3370,13 @@ This function is only called by the frame resizing routines.  It
 resizes windows proportionally and never deletes any windows."
   (when (and (windowp window) (numberp delta))
     (let ((pixel-delta
-	   (if pixelwise
-	       delta
-	     (window--size-to-pixel window delta horizontal))))
+           (if pixelwise
+               delta
+             (window--size-to-pixel window delta horizontal))))
       (when (window-sizable-p window pixel-delta horizontal ignore t)
-	(window--resize-reset (window-frame window) horizontal)
-	(window--resize-this-window
-	 window pixel-delta horizontal ignore t)))))
+        (window--resize-reset (window-frame window) horizontal)
+        (window--resize-this-window
+         window pixel-delta horizontal ignore t)))))
 
 (defun window--resize-root-window-vertically (window delta pixelwise)
   "Resize root window WINDOW vertically by DELTA lines.
@@ -3392,14 +3392,14 @@ pixels and return the number of pixels that were recovered.
 This function is called by the minibuffer window resizing
 routines."
   (let* ((frame (window-frame window))
-	 (pixel-delta
-	  (cond
-	   (pixelwise
-	    delta)
-	   ((numberp delta)
-	    (* (frame-char-height frame) delta))
-	   (t 0)))
-	 ignore)
+         (pixel-delta
+          (cond
+           (pixelwise
+            delta)
+           ((numberp delta)
+            (* (frame-char-height frame) delta))
+           (t 0)))
+         ignore)
     (cond
      ((zerop pixel-delta))
      ((< pixel-delta 0)
@@ -3417,15 +3417,15 @@ routines."
      ((> pixel-delta 0)
       (window--resize-reset frame)
       (unless (window-sizable window pixel-delta nil nil pixelwise)
-	(setq ignore t))
+        (setq ignore t))
       ;; When growing the root window, resize proportionally.  This
       ;; should give windows back their original sizes (hopefully).
       (window--resize-this-window
        window pixel-delta nil ignore t)))
-     ;; Return the possibly adjusted DELTA.
-     (if pixelwise
-	 pixel-delta
-       (/ pixel-delta (frame-char-height frame)))))
+    ;; Return the possibly adjusted DELTA.
+    (if pixelwise
+        pixel-delta
+      (/ pixel-delta (frame-char-height frame)))))
 
 (defun window--resize-mini-frame (frame)
   "Resize minibuffer-only frame FRAME."
@@ -3448,11 +3448,11 @@ may happen when the FRAME is not large enough to accommodate it."
     (walk-window-tree
      (lambda (window)
        (let  ((delta (- (window-min-size window horizontal nil t)
-			(window-size window horizontal t))))
-	 (when (> delta 0)
-	   (if (window-resizable-p window delta horizontal nil t)
-	       (window-resize window delta horizontal nil t)
-	     (setq value nil)))))
+                        (window-size window horizontal t))))
+         (when (> delta 0)
+           (if (window-resizable-p window delta horizontal nil t)
+               (window-resize window delta horizontal nil t)
+             (setq value nil)))))
      nil nil 'nomini)
     value))
 
@@ -3471,9 +3471,9 @@ the left.  If the edge can't be moved by DELTA lines or columns,
 move it as far as possible in the desired direction."
   (setq window (window-normalize-window window))
   (let* ((frame (window-frame window))
-	 (minibuffer-window (minibuffer-window frame))
-	 (right window)
-	 left first-left first-right this-delta min-delta max-delta ignore)
+         (minibuffer-window (minibuffer-window frame))
+         (right window)
+         left first-left first-right this-delta min-delta max-delta ignore)
 
     (unless pixelwise
       (setq pixelwise t)
@@ -3481,166 +3481,166 @@ move it as far as possible in the desired direction."
 
     ;; Find the edge we want to move.
     (while (and (or (not (window-combined-p right horizontal))
-		    (not (window-right right)))
-		(setq right (window-parent right))))
+                    (not (window-right right)))
+                (setq right (window-parent right))))
     (cond
      ((and (not right) (not horizontal)
-	   ;; Resize the minibuffer window if it's on the same frame as
-	   ;; and immediately below WINDOW and it's either active or
-	   ;; `resize-mini-windows' is nil.
-	   (eq (window-frame minibuffer-window) frame)
-	   (= (nth 1 (window-pixel-edges minibuffer-window))
-	      (nth 3 (window-pixel-edges window)))
-	   (or (not resize-mini-windows)
-	       (eq minibuffer-window (active-minibuffer-window))))
+           ;; Resize the minibuffer window if it's on the same frame as
+           ;; and immediately below WINDOW and it's either active or
+           ;; `resize-mini-windows' is nil.
+           (eq (window-frame minibuffer-window) frame)
+           (= (nth 1 (window-pixel-edges minibuffer-window))
+              (nth 3 (window-pixel-edges window)))
+           (or (not resize-mini-windows)
+               (eq minibuffer-window (active-minibuffer-window))))
       (window--resize-mini-window minibuffer-window (- delta)))
      ((or (not (setq left right)) (not (setq right (window-right right))))
       (if horizontal
-	  (user-error "No window on the right of this one")
-	(user-error "No window below this one")))
+          (user-error "No window on the right of this one")
+        (user-error "No window below this one")))
      (t
       ;; Set LEFT to the first resizable window on the left.  This step is
       ;; needed to handle fixed-size windows.
       (setq first-left left)
       (while (and left
-		  (or (window-size-fixed-p left horizontal)
-		      (and (< delta 0)
-			   (<= (window-size left horizontal t)
-			       (window-min-size left horizontal nil t)))))
-	(setq left
-	      (or (window-left left)
-		  (progn
-		    (while (and (setq left (window-parent left))
-				(not (window-combined-p left horizontal))))
-		    (window-left left)))))
+                  (or (window-size-fixed-p left horizontal)
+                      (and (< delta 0)
+                           (<= (window-size left horizontal t)
+                               (window-min-size left horizontal nil t)))))
+        (setq left
+              (or (window-left left)
+                  (progn
+                    (while (and (setq left (window-parent left))
+                                (not (window-combined-p left horizontal))))
+                    (window-left left)))))
       (unless left
-	;; We have to resize a size-preserved window.  Start again with
-	;; the window initially on the left.
-	(setq ignore 'preserved)
-	(setq left first-left)
-	(while (and left
-		    (or (window-size-fixed-p left horizontal 'preserved)
-			(and (< delta 0)
+        ;; We have to resize a size-preserved window.  Start again with
+        ;; the window initially on the left.
+        (setq ignore 'preserved)
+        (setq left first-left)
+        (while (and left
+                    (or (window-size-fixed-p left horizontal 'preserved)
+                        (and (< delta 0)
                              (<= (window-size left horizontal t)
                                  (window-min-size
                                   left horizontal 'preserved t)))))
-	  (setq left
-		(or (window-left left)
-		    (progn
-		      (while (and (setq left (window-parent left))
-				  (not (window-combined-p left horizontal))))
-		      (window-left left)))))
-
-	(unless left
-	  (if horizontal
-	      (user-error "No resizable window on the left of this one")
-	    (user-error "No resizable window above this one"))))
+          (setq left
+                (or (window-left left)
+                    (progn
+                      (while (and (setq left (window-parent left))
+                                  (not (window-combined-p left horizontal))))
+                      (window-left left)))))
+
+        (unless left
+          (if horizontal
+              (user-error "No resizable window on the left of this one")
+            (user-error "No resizable window above this one"))))
 
       ;; Set RIGHT to the first resizable window on the right.  This step
       ;; is needed to handle fixed-size windows.
       (setq first-right right)
       (while (and right
-		  (or (window-size-fixed-p right horizontal)
-		      (and (> delta 0)
-			   (<= (window-size right horizontal t)
-			       (window-min-size
+                  (or (window-size-fixed-p right horizontal)
+                      (and (> delta 0)
+                           (<= (window-size right horizontal t)
+                               (window-min-size
                                 right horizontal 'preserved t)))))
-	(setq right
-	      (or (window-right right)
-		  (progn
-		    (while (and (setq right (window-parent right))
-				(not (window-combined-p right horizontal))))
-		    (window-right right)))))
+        (setq right
+              (or (window-right right)
+                  (progn
+                    (while (and (setq right (window-parent right))
+                                (not (window-combined-p right horizontal))))
+                    (window-right right)))))
       (unless right
-	;; We have to resize a size-preserved window.  Start again with
-	;; the window initially on the right.
-	(setq ignore 'preserved)
-	(setq right first-right)
-	(while (and right
-		    (or (window-size-fixed-p right horizontal 'preserved)
+        ;; We have to resize a size-preserved window.  Start again with
+        ;; the window initially on the right.
+        (setq ignore 'preserved)
+        (setq right first-right)
+        (while (and right
+                    (or (window-size-fixed-p right horizontal 'preserved)
                         (and (> delta 0)
                              (<= (window-size right horizontal t)
                                  (window-min-size
                                   right horizontal 'preserved t)))))
-	  (setq right
-		(or (window-right right)
-		    (progn
-		      (while (and (setq right (window-parent right))
-				  (not (window-combined-p right horizontal))))
-		      (window-right right)))))
-	(unless right
-	  (if horizontal
-	      (user-error "No resizable window on the right of this one")
-	    (user-error "No resizable window below this one"))))
+          (setq right
+                (or (window-right right)
+                    (progn
+                      (while (and (setq right (window-parent right))
+                                  (not (window-combined-p right horizontal))))
+                      (window-right right)))))
+        (unless right
+          (if horizontal
+              (user-error "No resizable window on the right of this one")
+            (user-error "No resizable window below this one"))))
 
       ;; LEFT and RIGHT (which might be both internal windows) are now the
       ;; two windows we want to resize.
       (cond
        ((> delta 0)
-	(setq max-delta
-	      (window--max-delta-1
-	       left 0 horizontal ignore 'after nil pixelwise))
-	(setq min-delta
-	      (window--min-delta-1
-	       right (- delta) horizontal ignore 'before nil pixelwise))
-	(when (or (< max-delta delta) (> min-delta (- delta)))
-	  ;; We can't get the whole DELTA - move as far as possible.
-	  (setq delta (min max-delta (- min-delta))))
-	(unless (zerop delta)
-	  ;; Start resizing.
-	  (window--resize-reset frame horizontal)
-	  ;; Try to enlarge LEFT first.
-	  (setq this-delta
+        (setq max-delta
+              (window--max-delta-1
+               left 0 horizontal ignore 'after nil pixelwise))
+        (setq min-delta
+              (window--min-delta-1
+               right (- delta) horizontal ignore 'before nil pixelwise))
+        (when (or (< max-delta delta) (> min-delta (- delta)))
+          ;; We can't get the whole DELTA - move as far as possible.
+          (setq delta (min max-delta (- min-delta))))
+        (unless (zerop delta)
+          ;; Start resizing.
+          (window--resize-reset frame horizontal)
+          ;; Try to enlarge LEFT first.
+          (setq this-delta
                 (window--resizable
                  left delta horizontal ignore 'after nil nil pixelwise))
-	  (unless (zerop this-delta)
-	    (window--resize-this-window
-	     left this-delta horizontal ignore t 'before
-	     (if horizontal
-		 (+ (window-pixel-left left) (window-pixel-width left))
-	       (+ (window-pixel-top left) (window-pixel-height left)))))
-	  ;; Shrink windows on right of LEFT.
-	  (window--resize-siblings
-	   left delta horizontal ignore 'after
-	   (if horizontal
-	       (window-pixel-left right)
-	     (window-pixel-top right)))))
+          (unless (zerop this-delta)
+            (window--resize-this-window
+             left this-delta horizontal ignore t 'before
+             (if horizontal
+                 (+ (window-pixel-left left) (window-pixel-width left))
+               (+ (window-pixel-top left) (window-pixel-height left)))))
+          ;; Shrink windows on right of LEFT.
+          (window--resize-siblings
+           left delta horizontal ignore 'after
+           (if horizontal
+               (window-pixel-left right)
+             (window-pixel-top right)))))
        ((< delta 0)
-	(setq max-delta
-	      (window--max-delta-1
-	       right 0 horizontal ignore 'before nil pixelwise))
-	(setq min-delta
-	      (window--min-delta-1
-	       left delta horizontal ignore 'after nil pixelwise))
-	(when (or (< max-delta (- delta)) (> min-delta delta))
-	  ;; We can't get the whole DELTA - move as far as possible.
-	  (setq delta (max (- max-delta) min-delta)))
-	(unless (zerop delta)
-	  ;; Start resizing.
-	  (window--resize-reset frame horizontal)
-	  ;; Try to enlarge RIGHT.
-	  (setq this-delta
-		(window--resizable
-		 right (- delta) horizontal ignore 'before nil nil pixelwise))
-	  (unless (zerop this-delta)
-	    (window--resize-this-window
-	     right this-delta horizontal ignore t 'after
-	     (if horizontal
-		 (window-pixel-left right)
-	       (window-pixel-top right))))
-	  ;; Shrink windows on left of RIGHT.
-	  (window--resize-siblings
-	   right (- delta) horizontal ignore 'before
-	   (if horizontal
-	       (+ (window-pixel-left left) (window-pixel-width left))
-	     (+ (window-pixel-top left) (window-pixel-height left)))))))
+        (setq max-delta
+              (window--max-delta-1
+               right 0 horizontal ignore 'before nil pixelwise))
+        (setq min-delta
+              (window--min-delta-1
+               left delta horizontal ignore 'after nil pixelwise))
+        (when (or (< max-delta (- delta)) (> min-delta delta))
+          ;; We can't get the whole DELTA - move as far as possible.
+          (setq delta (max (- max-delta) min-delta)))
+        (unless (zerop delta)
+          ;; Start resizing.
+          (window--resize-reset frame horizontal)
+          ;; Try to enlarge RIGHT.
+          (setq this-delta
+                (window--resizable
+                 right (- delta) horizontal ignore 'before nil nil pixelwise))
+          (unless (zerop this-delta)
+            (window--resize-this-window
+             right this-delta horizontal ignore t 'after
+             (if horizontal
+                 (window-pixel-left right)
+               (window-pixel-top right))))
+          ;; Shrink windows on left of RIGHT.
+          (window--resize-siblings
+           right (- delta) horizontal ignore 'before
+           (if horizontal
+               (+ (window-pixel-left left) (window-pixel-width left))
+             (+ (window-pixel-top left) (window-pixel-height left)))))))
       (unless (zerop delta)
-	;; Don't report an error in the standard case.
-	(when (window--resize-apply-p frame horizontal)
-	  (if (window-resize-apply frame horizontal)
-	      (window--pixel-to-total frame horizontal)
-	    ;; But do report an error if applying the changes fails.
-	    (error "Failed adjusting window %s" window))))))))
+        ;; Don't report an error in the standard case.
+        (when (window--resize-apply-p frame horizontal)
+          (if (window-resize-apply frame horizontal)
+              (window--pixel-to-total frame horizontal)
+            ;; But do report an error if applying the changes fails.
+            (error "Failed adjusting window %s" window))))))))
 
 (defun enlarge-window (delta &optional horizontal)
   "Make the selected window DELTA lines taller.
@@ -3658,13 +3658,13 @@ negative, shrink selected window by -DELTA lines or columns."
       (user-error "Selected window has fixed size"))
      ((window-minibuffer-p)
       (if horizontal
-	  (user-error "Cannot resize minibuffer window horizontally")
-	(window--resize-mini-window
+          (user-error "Cannot resize minibuffer window horizontally")
+        (window--resize-mini-window
          (selected-window) (* delta (frame-char-height)))))
      ((and (not horizontal)
-	   (window-full-height-p)
-	   (eq (window-frame minibuffer-window) (selected-frame))
-	   (not resize-mini-windows))
+           (window-full-height-p)
+           (eq (window-frame minibuffer-window) (selected-frame))
+           (not resize-mini-windows))
       ;; If the selected window is full height and `resize-mini-windows'
       ;; is nil, resize the minibuffer window.
       (window--resize-mini-window
@@ -3674,15 +3674,15 @@ negative, shrink selected window by -DELTA lines or columns."
      ((window--resizable-p nil delta horizontal 'preserved)
       (window-resize nil delta horizontal 'preserved))
      ((eq this-command
-	  (if horizontal 'enlarge-window-horizontally 'enlarge-window))
+          (if horizontal 'enlarge-window-horizontally 'enlarge-window))
       ;; For backward compatibility don't signal an error unless this
       ;; command is `enlarge-window(-horizontally)'.
       (user-error "Cannot enlarge selected window"))
      (t
       (window-resize
        nil (if (> delta 0)
-	       (window-max-delta nil horizontal)
-	     (- (window-min-delta nil horizontal)))
+               (window-max-delta nil horizontal)
+             (- (window-min-delta nil horizontal)))
        horizontal)))))
 
 (defun shrink-window (delta &optional horizontal)
@@ -3701,13 +3701,13 @@ negative, enlarge selected window by -DELTA lines or columns."
       (user-error "Selected window has fixed size"))
      ((window-minibuffer-p)
       (if horizontal
-	  (user-error "Cannot resize minibuffer window horizontally")
-	(window--resize-mini-window
+          (user-error "Cannot resize minibuffer window horizontally")
+        (window--resize-mini-window
          (selected-window) (* (- delta) (frame-char-height)))))
      ((and (not horizontal)
-	   (window-full-height-p)
-	   (eq (window-frame minibuffer-window) (selected-frame))
-	   (not resize-mini-windows))
+           (window-full-height-p)
+           (eq (window-frame minibuffer-window) (selected-frame))
+           (not resize-mini-windows))
       ;; If the selected window is full height and `resize-mini-windows'
       ;; is nil, resize the minibuffer window.
       (window--resize-mini-window
@@ -3717,15 +3717,15 @@ negative, enlarge selected window by -DELTA lines or columns."
      ((window--resizable-p nil (- delta) horizontal 'preserved)
       (window-resize nil (- delta) horizontal 'preserved))
      ((eq this-command
-	  (if horizontal 'shrink-window-horizontally 'shrink-window))
+          (if horizontal 'shrink-window-horizontally 'shrink-window))
       ;; For backward compatibility don't signal an error unless this
       ;; command is `shrink-window(-horizontally)'.
       (user-error "Cannot shrink selected window"))
      (t
       (window-resize
        nil (if (> delta 0)
-	       (- (window-min-delta nil horizontal))
-	     (window-max-delta nil horizontal))
+               (- (window-min-delta nil horizontal))
+             (window-max-delta nil horizontal))
        horizontal)))))
 
 (defun maximize-window (&optional window)
@@ -3788,55 +3788,55 @@ the coordinates in pixels where the values for RIGHT and BOTTOM
 are one more than the actual value of these edges.  Note that if
 ABSOLUTE is non-nil, PIXELWISE is implicitly non-nil too."
   (let* ((window (window-normalize-window window body))
-	 (frame (window-frame window))
-	 (border-width (frame-internal-border-width frame))
-	 (char-width (frame-char-width frame))
-	 (char-height (frame-char-height frame))
-	 (left (if pixelwise
-		   (+ (window-pixel-left window) border-width)
-		 (+ (window-left-column window)
-		    (/ border-width char-width))))
-	 (left-body
-	  (when body
-	    (+ (window-pixel-left window) border-width
-	       (if (eq (car (window-current-scroll-bars window)) 'left)
-		   (window-scroll-bar-width window)
-		 0)
-	       (nth 0 (window-fringes window))
-	       (* (or (nth 0 (window-margins window)) 0) char-width))))
-	 (top (if pixelwise
-		  (+ (window-pixel-top window) border-width)
-		(+ (window-top-line window)
-		   (/ border-width char-height))))
-	 (top-body
-	  (when body
-	    (+ (window-pixel-top window) border-width
-	       (window-header-line-height window))))
-	 (right (+ left (if pixelwise
-			    (window-pixel-width window)
-			  (window-total-width window))))
-	 (right-body (and body (+ left-body (window-body-width window t))))
-	 (bottom (+ top (if pixelwise
-			    (window-pixel-height window)
-			  (window-total-height window))))
-	 (bottom-body (and body (+ top-body (window-body-height window t)))))
+         (frame (window-frame window))
+         (border-width (frame-internal-border-width frame))
+         (char-width (frame-char-width frame))
+         (char-height (frame-char-height frame))
+         (left (if pixelwise
+                   (+ (window-pixel-left window) border-width)
+                 (+ (window-left-column window)
+                    (/ border-width char-width))))
+         (left-body
+          (when body
+            (+ (window-pixel-left window) border-width
+               (if (eq (car (window-current-scroll-bars window)) 'left)
+                   (window-scroll-bar-width window)
+                 0)
+               (nth 0 (window-fringes window))
+               (* (or (nth 0 (window-margins window)) 0) char-width))))
+         (top (if pixelwise
+                  (+ (window-pixel-top window) border-width)
+                (+ (window-top-line window)
+                   (/ border-width char-height))))
+         (top-body
+          (when body
+            (+ (window-pixel-top window) border-width
+               (window-header-line-height window))))
+         (right (+ left (if pixelwise
+                            (window-pixel-width window)
+                          (window-total-width window))))
+         (right-body (and body (+ left-body (window-body-width window t))))
+         (bottom (+ top (if pixelwise
+                            (window-pixel-height window)
+                          (window-total-height window))))
+         (bottom-body (and body (+ top-body (window-body-height window t)))))
     (if absolute
-	(let* ((native-edges (frame-edges frame 'native-edges))
-	       (left-off (nth 0 native-edges))
-	       (top-off (nth 1 native-edges)))
-	      (if body
-		  (list (+ left-body left-off) (+ top-body top-off)
-			(+ right-body left-off) (+ bottom-body top-off))
-		(list (+ left left-off) (+ top top-off)
-		      (+ right left-off) (+ bottom top-off))))
+        (let* ((native-edges (frame-edges frame 'native-edges))
+               (left-off (nth 0 native-edges))
+               (top-off (nth 1 native-edges)))
+          (if body
+              (list (+ left-body left-off) (+ top-body top-off)
+                    (+ right-body left-off) (+ bottom-body top-off))
+            (list (+ left left-off) (+ top top-off)
+                  (+ right left-off) (+ bottom top-off))))
       (if body
-	  (if pixelwise
-	      (list left-body top-body right-body bottom-body)
-	    (list (/ left-body char-width) (/ top-body char-height)
-		  ;; Round up.
-		  (/ (+ right-body char-width -1) char-width)
-		  (/ (+ bottom-body char-height -1) char-height)))
-	(list left top right bottom)))))
+          (if pixelwise
+              (list left-body top-body right-body bottom-body)
+            (list (/ left-body char-width) (/ top-body char-height)
+                  ;; Round up.
+                  (/ (+ right-body char-width -1) char-width)
+                  (/ (+ bottom-body char-height -1) char-height)))
+        (list left top right bottom)))))
 
 (defun window-body-edges (&optional window)
   "Return a list of the edge coordinates of WINDOW's body.
@@ -3883,13 +3883,13 @@ WINDOW.
 WINDOW must be a live window and defaults to the selected window.
 POSITION defaults to the value of `window-point' of WINDOW."
   (let* ((window (window-normalize-window window t))
-	 (pos-in-window
-	  (pos-visible-in-window-p
-	   (or position (window-point window)) window t)))
+         (pos-in-window
+          (pos-visible-in-window-p
+           (or position (window-point window)) window t)))
     (when pos-in-window
       (let ((edges (window-absolute-body-pixel-edges window)))
-	(cons (+ (nth 0 edges) (nth 0 pos-in-window))
-	      (+ (nth 1 edges) (nth 1 pos-in-window)))))))
+        (cons (+ (nth 0 edges) (nth 0 pos-in-window))
+              (+ (nth 1 edges) (nth 1 pos-in-window)))))))
 \f
 (defun frame-root-window-p (window)
   "Return t if WINDOW is the root window of its frame."
@@ -3905,16 +3905,16 @@ return value."
   (let (list)
     (while window
       (setq list
-	    (cons
-	     (cond
-	      ((window-top-child window)
-	       (cons t (cons (window-edges window)
-			     (window--subtree (window-top-child window) t))))
-	      ((window-left-child window)
-	       (cons nil (cons (window-edges window)
-			       (window--subtree (window-left-child window) t))))
-	      (t window))
-	     list))
+            (cons
+             (cond
+              ((window-top-child window)
+               (cons t (cons (window-edges window)
+                             (window--subtree (window-top-child window) t))))
+              ((window-left-child window)
+               (cons nil (cons (window-edges window)
+                               (window--subtree (window-left-child window) t))))
+              (t window))
+             list))
       (setq window (when next (window-next-sibling window))))
     (nreverse list)))
 
@@ -3959,56 +3959,56 @@ always effectively nil."
   (interactive "p\ni\np")
   (let* ((window (selected-window))
          (original-window window)
-	 (function (and (not ignore-window-parameters)
-			(window-parameter window 'other-window)))
-	 old-window old-count)
+         (function (and (not ignore-window-parameters)
+                        (window-parameter window 'other-window)))
+         old-window old-count)
     (if (functionp function)
-	(funcall function count all-frames)
+        (funcall function count all-frames)
       ;; `next-window' and `previous-window' may return a window we are
       ;; not allowed to select.  Hence we need an exit strategy in case
       ;; all windows are non-selectable.
       (catch 'exit
-	(while (> count 0)
-	  (setq window (next-window window nil all-frames))
-	  (cond
-	   ((eq window old-window)
-	    (when (= count old-count)
-	      ;; Keep out of infinite loops.  When COUNT has not changed
-	      ;; since we last looked at `window' we're probably in one.
-	      (throw 'exit nil)))
-	   ((window-parameter window 'no-other-window)
-	    (unless old-window
-	      ;; The first non-selectable window `next-window' got us:
-	      ;; Remember it and the current value of COUNT.
-	      (setq old-window window)
-	      (setq old-count count)))
-	   (t
-	    (setq count (1- count)))))
-	(while (< count 0)
-	  (setq window (previous-window window nil all-frames))
-	  (cond
-	   ((eq window old-window)
-	    (when (= count old-count)
-	      ;; Keep out of infinite loops.  When COUNT has not changed
-	      ;; since we last looked at `window' we're probably in one.
-	      (throw 'exit nil)))
-	   ((window-parameter window 'no-other-window)
-	    (unless old-window
-	      ;; The first non-selectable window `previous-window' got
-	      ;; us: Remember it and the current value of COUNT.
-	      (setq old-window window)
-	      (setq old-count count)))
-	   (t
-	    (setq count (1+ count)))))
+        (while (> count 0)
+          (setq window (next-window window nil all-frames))
+          (cond
+           ((eq window old-window)
+            (when (= count old-count)
+              ;; Keep out of infinite loops.  When COUNT has not changed
+              ;; since we last looked at `window' we're probably in one.
+              (throw 'exit nil)))
+           ((window-parameter window 'no-other-window)
+            (unless old-window
+              ;; The first non-selectable window `next-window' got us:
+              ;; Remember it and the current value of COUNT.
+              (setq old-window window)
+              (setq old-count count)))
+           (t
+            (setq count (1- count)))))
+        (while (< count 0)
+          (setq window (previous-window window nil all-frames))
+          (cond
+           ((eq window old-window)
+            (when (= count old-count)
+              ;; Keep out of infinite loops.  When COUNT has not changed
+              ;; since we last looked at `window' we're probably in one.
+              (throw 'exit nil)))
+           ((window-parameter window 'no-other-window)
+            (unless old-window
+              ;; The first non-selectable window `previous-window' got
+              ;; us: Remember it and the current value of COUNT.
+              (setq old-window window)
+              (setq old-count count)))
+           (t
+            (setq count (1+ count)))))
 
         (when (and (eq window original-window)
                    interactive
                    (not (or executing-kbd-macro noninteractive)))
           (message "No other window to select"))
 
-	(select-window window)
-	;; Always return nil.
-	nil))))
+        (select-window window)
+        ;; Always return nil.
+        nil))))
 
 (defun other-window-prefix ()
   "Display the buffer of the next command in a new window.
@@ -4079,9 +4079,9 @@ Anything else means consider all windows on the selected frame
 and no others."
   (let ((base-window (selected-window)))
     (if (and nomini (eq base-window (minibuffer-window)))
-	(setq base-window (next-window base-window)))
+        (setq base-window (next-window base-window)))
     (eq base-window
-	(next-window base-window (if nomini 'arg) all-frames))))
+        (next-window base-window (if nomini 'arg) all-frames))))
 \f
 ;;; Deleting windows.
 (defun window-deletable-p (&optional window)
@@ -4093,7 +4093,7 @@ frame can be safely deleted."
   (setq window (window-normalize-window window))
 
   (unless (or ignore-window-parameters
-	      (eq (window-parameter window 'delete-window) t))
+              (eq (window-parameter window 'delete-window) t))
     ;; Handle atomicity.
     (when (window-parameter window 'window-atom)
       (setq window (window-atom-root window))))
@@ -4105,23 +4105,23 @@ frame can be safely deleted."
       ;; on the same terminal, and it does not contain the active
       ;; minibuffer.
       (unless (or (eq frame (next-frame frame 0))
-		  ;; We can delete our frame only if no other frame
-		  ;; currently uses our minibuffer window.
-		  (catch 'other
-		    (dolist (other (frame-list))
-		      (when (and (not (eq other frame))
-				 (eq (window-frame (minibuffer-window other))
-				     frame))
-			(throw 'other t))))
-		  (let ((minibuf (active-minibuffer-window)))
-		    (and minibuf (eq frame (window-frame minibuf)))))
-	'frame))
+                  ;; We can delete our frame only if no other frame
+                  ;; currently uses our minibuffer window.
+                  (catch 'other
+                    (dolist (other (frame-list))
+                      (when (and (not (eq other frame))
+                                 (eq (window-frame (minibuffer-window other))
+                                     frame))
+                        (throw 'other t))))
+                  (let ((minibuf (active-minibuffer-window)))
+                    (and minibuf (eq frame (window-frame minibuf)))))
+        'frame))
      ((window-minibuffer-p window)
       ;; If WINDOW is the minibuffer window of a non-minibuffer-only
       ;; frame, it cannot be deleted separately.
       nil)
      ((or ignore-window-parameters
-	  (not (eq window (window-main-window frame))))
+          (not (eq window (window-main-window frame))))
       ;; Otherwise, WINDOW can be deleted unless it is the main window
       ;; of its frame.
       t))))
@@ -4130,11 +4130,11 @@ frame can be safely deleted."
   "Return t if WINDOW is either ROOT or a member of ROOT's subtree."
   (or (eq window root)
       (let ((parent (window-parent window)))
-	(catch 'done
-	  (while parent
-	    (if (eq parent root)
-		(throw 'done t)
-	      (setq parent (window-parent parent))))))))
+        (catch 'done
+          (while parent
+            (if (eq parent root)
+                (throw 'done t)
+              (setq parent (window-parent parent))))))))
 
 ;; This function is called by `delete-window' and
 ;; `delete-other-windows' when `switch-to-buffer-preserve-window-point'
@@ -4193,9 +4193,9 @@ that is its frame's root window."
     (window--before-delete-windows))
   (setq window (window-normalize-window window))
   (let* ((frame (window-frame window))
-	 (function (window-parameter window 'delete-window))
-	 (parent (window-parent window))
-	 atom-root)
+         (function (window-parameter window 'delete-window))
+         (parent (window-parent window))
+         atom-root)
     (window--check frame)
     (catch 'done
       ;; Handle window parameters.
@@ -4204,58 +4204,58 @@ that is its frame's root window."
        ;; us so or `delete-window' equals t.
        ((or ignore-window-parameters (eq function t)))
        ((functionp function)
-	;; The `delete-window' parameter specifies the function to call.
-	;; If that function is `ignore' nothing is done.  It's up to the
-	;; function called here to avoid infinite recursion.
-	(throw 'done (funcall function window)))
+        ;; The `delete-window' parameter specifies the function to call.
+        ;; If that function is `ignore' nothing is done.  It's up to the
+        ;; function called here to avoid infinite recursion.
+        (throw 'done (funcall function window)))
        ((and (window-parameter window 'window-atom)
-	     (setq atom-root (window-atom-root window))
-	     (not (eq atom-root window)))
-	(if (eq atom-root (frame-root-window frame))
-	    (error "Root of atomic window is root window of its frame")
-	  (throw 'done (delete-window atom-root))))
+             (setq atom-root (window-atom-root window))
+             (not (eq atom-root window)))
+        (if (eq atom-root (frame-root-window frame))
+            (error "Root of atomic window is root window of its frame")
+          (throw 'done (delete-window atom-root))))
        ((not parent)
-	(error "Attempt to delete minibuffer or sole ordinary window"))
+        (error "Attempt to delete minibuffer or sole ordinary window"))
        ((eq window (window-main-window frame))
-	(error "Attempt to delete main window of frame %s" frame)))
+        (error "Attempt to delete main window of frame %s" frame)))
 
       (let* ((horizontal (window-left-child parent))
-	     (size (window-size window horizontal t))
+             (size (window-size window horizontal t))
              (window-combination-resize
               (or window-combination-resize
                   (window-parameter parent 'window-side)))
-	     (frame-selected
-	      (window--in-subtree-p (frame-selected-window frame) window))
-	     ;; Emacs 23 preferably gives WINDOW's space to its left
-	     ;; sibling.
-	     (sibling (or (window-left window) (window-right window))))
-	(window--resize-reset frame horizontal)
-	(cond
-	 ((and (not (eq window-combination-resize t))
-	       sibling (window-sizable-p sibling size horizontal nil t))
-	  ;; Resize WINDOW's sibling.
-	  (window--resize-this-window sibling size horizontal nil t)
-	  (set-window-new-normal
-	   sibling (+ (window-normal-size sibling horizontal)
-		      (window-normal-size window horizontal))))
-	 ((window--resizable-p window (- size) horizontal nil nil nil t t)
-	  ;; Can do without resizing fixed-size windows.
-	  (window--resize-siblings window (- size) horizontal))
-	 (t
-	  ;; Can't do without resizing fixed-size windows.
-	  (window--resize-siblings window (- size) horizontal t)))
-	;; Actually delete WINDOW.
-	(delete-window-internal window)
-	(window--pixel-to-total frame horizontal)
-	(when (and frame-selected
-		   (window-parameter
-		    (frame-selected-window frame) 'no-other-window))
-	  ;; `delete-window-internal' has selected a window that should
-	  ;; not be selected, fix this here.
-	  (other-window -1 frame))
-	(window--check frame)
-	;; Always return nil.
-	nil))))
+             (frame-selected
+              (window--in-subtree-p (frame-selected-window frame) window))
+             ;; Emacs 23 preferably gives WINDOW's space to its left
+             ;; sibling.
+             (sibling (or (window-left window) (window-right window))))
+        (window--resize-reset frame horizontal)
+        (cond
+         ((and (not (eq window-combination-resize t))
+               sibling (window-sizable-p sibling size horizontal nil t))
+          ;; Resize WINDOW's sibling.
+          (window--resize-this-window sibling size horizontal nil t)
+          (set-window-new-normal
+           sibling (+ (window-normal-size sibling horizontal)
+                      (window-normal-size window horizontal))))
+         ((window--resizable-p window (- size) horizontal nil nil nil t t)
+          ;; Can do without resizing fixed-size windows.
+          (window--resize-siblings window (- size) horizontal))
+         (t
+          ;; Can't do without resizing fixed-size windows.
+          (window--resize-siblings window (- size) horizontal t)))
+        ;; Actually delete WINDOW.
+        (delete-window-internal window)
+        (window--pixel-to-total frame horizontal)
+        (when (and frame-selected
+                   (window-parameter
+                    (frame-selected-window frame) 'no-other-window))
+          ;; `delete-window-internal' has selected a window that should
+          ;; not be selected, fix this here.
+          (other-window -1 frame))
+        (window--check frame)
+        ;; Always return nil.
+        nil))))
 
 (defun delete-other-windows (&optional window interactive)
   "Make WINDOW fill its frame.
@@ -4277,8 +4277,8 @@ any window whose `no-delete-other-windows' parameter is non-nil."
   (interactive "i\np")
   (setq window (window-normalize-window window))
   (let* ((frame (window-frame window))
-	 (function (window-parameter window 'delete-other-windows))
-	 atom-root main)
+         (function (window-parameter window 'delete-other-windows))
+         atom-root main)
     (window--check frame)
     (catch 'done
       (cond
@@ -4286,21 +4286,21 @@ any window whose `no-delete-other-windows' parameter is non-nil."
        ;; `delete-other-windows' is t.
        ((or ignore-window-parameters (eq function t)))
        ((functionp function)
-	;; The `delete-other-windows' parameter specifies the function
-	;; to call.  If the function is `ignore' no windows are deleted.
-	;; It's up to the function called to avoid infinite recursion.
-	(throw 'done (funcall function window)))
+        ;; The `delete-other-windows' parameter specifies the function
+        ;; to call.  If the function is `ignore' no windows are deleted.
+        ;; It's up to the function called to avoid infinite recursion.
+        (throw 'done (funcall function window)))
        ((and (window-parameter window 'window-atom)
-	     (setq atom-root (window-atom-root window))
-	     (not (eq atom-root window)))
-	(if (eq atom-root (frame-root-window frame))
-	    (error "Root of atomic window is root window of its frame")
-	  (throw 'done (delete-other-windows atom-root))))
+             (setq atom-root (window-atom-root window))
+             (not (eq atom-root window)))
+        (if (eq atom-root (frame-root-window frame))
+            (error "Root of atomic window is root window of its frame")
+          (throw 'done (delete-other-windows atom-root))))
        ((window-parameter window 'window-side)
-	(error "Cannot make side window the only window"))
+        (error "Cannot make side window the only window"))
        ((and (window-minibuffer-p window)
-	     (not (eq window (frame-root-window window))))
-	(error "Can't expand minibuffer to full frame")))
+             (not (eq window (frame-root-window window))))
+        (error "Can't expand minibuffer to full frame")))
 
       (cond
        ((or ignore-window-parameters
@@ -4343,8 +4343,8 @@ any window whose `no-delete-other-windows' parameter is non-nil."
           (when (and interactive
                      (not (or executing-kbd-macro noninteractive)))
             (message "No other windows to delete"))
-	(delete-other-windows-internal window main)
-	(window--check frame))
+        (delete-other-windows-internal window main)
+        (window--check frame))
       ;; Always return nil.
       nil)))
 
@@ -4398,8 +4398,8 @@ This may be a useful alternative binding for \\[delete-other-windows]
   "Record WINDOW's buffer.
 WINDOW must be a live window and defaults to the selected one."
   (let* ((window (window-normalize-window window t))
-	 (buffer (window-buffer window))
-	 (entry (assq buffer (window-prev-buffers window))))
+         (buffer (window-buffer window))
+         (entry (assq buffer (window-prev-buffers window))))
     ;; Reset WINDOW's next buffers.  If needed, they are resurrected by
     ;; `switch-to-prev-buffer' and `switch-to-next-buffer'.
     (set-window-next-buffers window nil)
@@ -4413,22 +4413,22 @@ WINDOW must be a live window and defaults to the selected one."
     (unless (eq (aref (buffer-name buffer) 0) ?\s)
       ;; Add an entry for buffer to WINDOW's previous buffers.
       (with-current-buffer buffer
-	(let ((start (window-start window))
-	      (point (window-point window)))
-	  (setq entry
-		(cons buffer
-		      (if entry
-			  ;; We have an entry, update marker positions.
-			  (list (set-marker (nth 1 entry) start)
-				(set-marker (nth 2 entry) point))
-			;; Make new markers.
-			(list (copy-marker start)
-			      (copy-marker
-			       ;; Preserve window-point-insertion-type
-			       ;; (Bug#12855).
-			       point window-point-insertion-type)))))
-	  (set-window-prev-buffers
-	   window (cons entry (window-prev-buffers window)))))
+        (let ((start (window-start window))
+              (point (window-point window)))
+          (setq entry
+                (cons buffer
+                      (if entry
+                          ;; We have an entry, update marker positions.
+                          (list (set-marker (nth 1 entry) start)
+                                (set-marker (nth 2 entry) point))
+                        ;; Make new markers.
+                        (list (copy-marker start)
+                              (copy-marker
+                               ;; Preserve window-point-insertion-type
+                               ;; (Bug#12855).
+                               point window-point-insertion-type)))))
+          (set-window-prev-buffers
+           window (cons entry (window-prev-buffers window)))))
 
       (run-hooks 'buffer-list-update-hook))))
 
@@ -4438,7 +4438,7 @@ WINDOW must be a live window and defaults to the selected one.
 BUFFER must be a live buffer and defaults to the buffer of
 WINDOW."
   (let* ((window (window-normalize-window window t))
-	 (buffer (or buffer (window-buffer window))))
+         (buffer (or buffer (window-buffer window))))
     (set-window-prev-buffers
      window (assq-delete-all buffer (window-prev-buffers window)))
     (set-window-next-buffers
@@ -4454,7 +4454,7 @@ point to POINT.  If WINDOW is selected this also sets BUFFER's
 before was current this also makes BUFFER the current buffer."
   (setq window (window-normalize-window window t))
   (let ((selected (eq window (selected-window)))
-	(current (eq (window-buffer window) (current-buffer))))
+        (current (eq (window-buffer window) (current-buffer))))
     (set-window-buffer window buffer)
     (when (and selected current)
       (set-buffer buffer))
@@ -4519,9 +4519,9 @@ this option, for example, when there is only one buffer left."
   :type
   '(choice (const :tag "Never" nil)
            (const :tag "This frame" this)
-	   (const :tag "Visible frames" visible)
-	   (const :tag "Visible and iconified frames" 0)
-	   (const :tag "Any frame" t)
+           (const :tag "Visible frames" visible)
+           (const :tag "Visible and iconified frames" 0)
+           (const :tag "Any frame" t)
            (function :tag "Function"))
   :version "27.1"
   :group 'windows)
@@ -4561,11 +4561,11 @@ buffers.
 This function is called by `prev-buffer'."
   (interactive)
   (let* ((window (window-normalize-window window t))
-	 (frame (window-frame window))
+         (frame (window-frame window))
          (window-side (window-parameter window 'window-side))
-	 (old-buffer (window-buffer window))
-	 ;; Save this since it's destroyed by `set-window-buffer'.
-	 (next-buffers (window-next-buffers window))
+         (old-buffer (window-buffer window))
+         ;; Save this since it's destroyed by `set-window-buffer'.
+         (next-buffers (window-next-buffers window))
          (pred (frame-parameter frame 'buffer-predicate))
          (skip
           (cond
@@ -4579,7 +4579,7 @@ This function is called by `prev-buffer'."
     (when (window-minibuffer-p window)
       ;; Don't switch in minibuffer window.
       (unless (setq window (minibuffer-selected-window))
-	(error "Window %s is a minibuffer window" window)))
+        (error "Window %s is a minibuffer window" window)))
 
     (unless (memq (window-dedicated-p window) '(nil side))
       ;; Don't switch in dedicated window.
@@ -4589,20 +4589,20 @@ This function is called by `prev-buffer'."
       ;; Scan WINDOW's previous buffers first, skipping entries of next
       ;; buffers.
       (dolist (entry (window-prev-buffers window))
-	(when (and (setq new-buffer (car entry))
-		   (or (buffer-live-p new-buffer)
-		       (not (setq killed-buffers
-				  (cons new-buffer killed-buffers))))
-		   (not (eq new-buffer old-buffer))
+        (when (and (setq new-buffer (car entry))
+                   (or (buffer-live-p new-buffer)
+                       (not (setq killed-buffers
+                                  (cons new-buffer killed-buffers))))
+                   (not (eq new-buffer old-buffer))
                    (or (null pred) (funcall pred new-buffer))
-		   ;; When BURY-OR-KILL is nil, avoid switching to a
-		   ;; buffer in WINDOW's next buffers list.
-		   (or bury-or-kill (not (memq new-buffer next-buffers))))
+                   ;; When BURY-OR-KILL is nil, avoid switching to a
+                   ;; buffer in WINDOW's next buffers list.
+                   (or bury-or-kill (not (memq new-buffer next-buffers))))
           (if (switch-to-prev-buffer-skip-p skip window new-buffer bury-or-kill)
-	      (setq skipped new-buffer)
-	    (set-window-buffer-start-and-point
-	     window new-buffer (nth 1 entry) (nth 2 entry))
-	    (throw 'found t))))
+              (setq skipped new-buffer)
+            (set-window-buffer-start-and-point
+             window new-buffer (nth 1 entry) (nth 2 entry))
+            (throw 'found t))))
       ;; Scan reverted buffer list of WINDOW's frame next, skipping
       ;; entries of next buffers.  Note that when we bury or kill a
       ;; buffer we don't reverse the global buffer list to avoid showing
@@ -4623,50 +4623,50 @@ This function is called by `prev-buffer'."
                      (not (buffer-local-value 'window--sides-shown buffer))
                      (or bury-or-kill (not (memq buffer next-buffers))))
             (if (switch-to-prev-buffer-skip-p skip window buffer bury-or-kill)
-	        (setq skipped (or skipped buffer))
+                (setq skipped (or skipped buffer))
               (setq new-buffer buffer)
               (set-window-buffer-start-and-point window new-buffer)
               (throw 'found t)))))
 
       (unless bury-or-kill
-	;; Scan reverted next buffers last (must not use nreverse
-	;; here!).
-	(dolist (buffer (reverse next-buffers))
-	  ;; Actually, buffer _must_ be live here since otherwise it
-	  ;; would have been caught in the scan of previous buffers.
-	  (when (and (or (buffer-live-p buffer)
-			 (not (setq killed-buffers
-				    (cons buffer killed-buffers))))
-		     (not (eq buffer old-buffer))
+        ;; Scan reverted next buffers last (must not use nreverse
+        ;; here!).
+        (dolist (buffer (reverse next-buffers))
+          ;; Actually, buffer _must_ be live here since otherwise it
+          ;; would have been caught in the scan of previous buffers.
+          (when (and (or (buffer-live-p buffer)
+                         (not (setq killed-buffers
+                                    (cons buffer killed-buffers))))
+                     (not (eq buffer old-buffer))
                      (or (null pred) (funcall pred buffer))
-		     (setq entry (assq buffer (window-prev-buffers window))))
+                     (setq entry (assq buffer (window-prev-buffers window))))
             (if (switch-to-prev-buffer-skip-p skip window buffer bury-or-kill)
-	        (setq skipped (or skipped buffer))
-	      (setq new-buffer buffer)
-	      (set-window-buffer-start-and-point
-	       window new-buffer (nth 1 entry) (nth 2 entry))
-	      (throw 'found t)))))
+                (setq skipped (or skipped buffer))
+              (setq new-buffer buffer)
+              (set-window-buffer-start-and-point
+               window new-buffer (nth 1 entry) (nth 2 entry))
+              (throw 'found t)))))
 
       (when skipped
         ;; Show first skipped buffer.
-	(setq new-buffer skipped)
-	(set-window-buffer-start-and-point window new-buffer)))
+        (setq new-buffer skipped)
+        (set-window-buffer-start-and-point window new-buffer)))
 
     (if bury-or-kill
-	(let ((entry (and (eq bury-or-kill 'append)
-			  (assq old-buffer (window-prev-buffers window)))))
-	  ;; Remove `old-buffer' from WINDOW's previous and (restored list
-	  ;; of) next buffers.
-	  (set-window-prev-buffers
-	   window (assq-delete-all old-buffer (window-prev-buffers window)))
-	  (set-window-next-buffers window (delq old-buffer next-buffers))
-	  (when entry
-	    ;; Append old-buffer's entry to list of WINDOW's previous
-	    ;; buffers so it's less likely to get switched to soon but
-	    ;; `display-buffer-in-previous-window' can nevertheless find
-	    ;; it.
-	    (set-window-prev-buffers
-	     window (append (window-prev-buffers window) (list entry)))))
+        (let ((entry (and (eq bury-or-kill 'append)
+                          (assq old-buffer (window-prev-buffers window)))))
+          ;; Remove `old-buffer' from WINDOW's previous and (restored list
+          ;; of) next buffers.
+          (set-window-prev-buffers
+           window (assq-delete-all old-buffer (window-prev-buffers window)))
+          (set-window-next-buffers window (delq old-buffer next-buffers))
+          (when entry
+            ;; Append old-buffer's entry to list of WINDOW's previous
+            ;; buffers so it's less likely to get switched to soon but
+            ;; `display-buffer-in-previous-window' can nevertheless find
+            ;; it.
+            (set-window-prev-buffers
+             window (append (window-prev-buffers window) (list entry)))))
       ;; Move `old-buffer' to head of WINDOW's restored list of next
       ;; buffers.
       (set-window-next-buffers
@@ -4675,10 +4675,10 @@ This function is called by `prev-buffer'."
     ;; Remove killed buffers from WINDOW's previous and next buffers.
     (when killed-buffers
       (dolist (buffer killed-buffers)
-	(set-window-prev-buffers
-	 window (assq-delete-all buffer (window-prev-buffers window)))
-	(set-window-next-buffers
-	 window (delq buffer (window-next-buffers window)))))
+        (set-window-prev-buffers
+         window (assq-delete-all buffer (window-prev-buffers window)))
+        (set-window-next-buffers
+         window (delq buffer (window-next-buffers window)))))
 
     ;; Return new-buffer.
     new-buffer))
@@ -4698,10 +4698,10 @@ buffers.
 This function is called by `next-buffer'."
   (interactive)
   (let* ((window (window-normalize-window window t))
-	 (frame (window-frame window))
+         (frame (window-frame window))
          (window-side (window-parameter window 'window-side))
-	 (old-buffer (window-buffer window))
-	 (next-buffers (window-next-buffers window))
+         (old-buffer (window-buffer window))
+         (next-buffers (window-next-buffers window))
          (pred (frame-parameter frame 'buffer-predicate))
          (skip
           (cond
@@ -4711,11 +4711,11 @@ This function is called by `next-buffer'."
            ((or switch-to-prev-buffer-skip
                 (not switch-to-visible-buffer))
             frame)))
-	 new-buffer entry killed-buffers skipped)
+         new-buffer entry killed-buffers skipped)
     (when (window-minibuffer-p window)
       ;; Don't switch in minibuffer window.
       (unless (setq window (minibuffer-selected-window))
-	(error "Window %s is a minibuffer window" window)))
+        (error "Window %s is a minibuffer window" window)))
 
     (unless (memq (window-dedicated-p window) '(nil side))
       ;; Don't switch in dedicated window.
@@ -4724,18 +4724,18 @@ This function is called by `next-buffer'."
     (catch 'found
       ;; Scan WINDOW's next buffers first.
       (dolist (buffer next-buffers)
-	(when (and (or (buffer-live-p buffer)
-		       (not (setq killed-buffers
-				  (cons buffer killed-buffers))))
-		   (not (eq buffer old-buffer))
+        (when (and (or (buffer-live-p buffer)
+                       (not (setq killed-buffers
+                                  (cons buffer killed-buffers))))
+                   (not (eq buffer old-buffer))
                    (or (null pred) (funcall pred buffer))
-		   (setq entry (assq buffer (window-prev-buffers window))))
+                   (setq entry (assq buffer (window-prev-buffers window))))
           (if (switch-to-prev-buffer-skip-p skip window buffer)
-	      (setq skipped buffer)
-	    (setq new-buffer buffer)
-	    (set-window-buffer-start-and-point
-	     window new-buffer (nth 1 entry) (nth 2 entry))
-	    (throw 'found t))))
+              (setq skipped buffer)
+            (setq new-buffer buffer)
+            (set-window-buffer-start-and-point
+             window new-buffer (nth 1 entry) (nth 2 entry))
+            (throw 'found t))))
       ;; Scan the buffer list of WINDOW's frame next, skipping previous
       ;; buffers entries.  Skip this step for side windows.
       (unless window-side
@@ -4749,29 +4749,29 @@ This function is called by `next-buffer'."
                      (not (buffer-local-value 'window--sides-shown buffer))
                      (not (assq buffer (window-prev-buffers window))))
             (if (switch-to-prev-buffer-skip-p skip window buffer)
-	        (setq skipped (or skipped buffer))
+                (setq skipped (or skipped buffer))
               (setq new-buffer buffer)
               (set-window-buffer-start-and-point window new-buffer)
               (throw 'found t)))))
       ;; Scan WINDOW's reverted previous buffers last (must not use
       ;; nreverse here!)
       (dolist (entry (reverse (window-prev-buffers window)))
-	(when (and (setq new-buffer (car entry))
-		   (or (buffer-live-p new-buffer)
-		       (not (setq killed-buffers
-				  (cons new-buffer killed-buffers))))
-		   (not (eq new-buffer old-buffer))
+        (when (and (setq new-buffer (car entry))
+                   (or (buffer-live-p new-buffer)
+                       (not (setq killed-buffers
+                                  (cons new-buffer killed-buffers))))
+                   (not (eq new-buffer old-buffer))
                    (or (null pred) (funcall pred new-buffer)))
           (if (switch-to-prev-buffer-skip-p skip window new-buffer)
-	      (setq skipped (or skipped new-buffer))
-	    (set-window-buffer-start-and-point
-	     window new-buffer (nth 1 entry) (nth 2 entry))
-	    (throw 'found t))))
+              (setq skipped (or skipped new-buffer))
+            (set-window-buffer-start-and-point
+             window new-buffer (nth 1 entry) (nth 2 entry))
+            (throw 'found t))))
 
       (when skipped
         ;; Show first skipped buffer.
-	(setq new-buffer skipped)
-	(set-window-buffer-start-and-point window new-buffer)))
+        (setq new-buffer skipped)
+        (set-window-buffer-start-and-point window new-buffer)))
 
     ;; Remove `new-buffer' from and restore WINDOW's next buffers.
     (set-window-next-buffers window (delq new-buffer next-buffers))
@@ -4779,10 +4779,10 @@ This function is called by `next-buffer'."
     ;; Remove killed buffers from WINDOW's previous and next buffers.
     (when killed-buffers
       (dolist (buffer killed-buffers)
-	(set-window-prev-buffers
-	 window (assq-delete-all buffer (window-prev-buffers window)))
-	(set-window-next-buffers
-	 window (delq buffer (window-next-buffers window)))))
+        (set-window-prev-buffers
+         window (assq-delete-all buffer (window-prev-buffers window)))
+        (set-window-next-buffers
+         window (delq buffer (window-next-buffers window)))))
 
     ;; Return new-buffer.
     new-buffer))
@@ -4799,16 +4799,16 @@ If BUFFER is non-nil, ignore occurrences of that buffer in LIST."
   ;; This logic is more or less copied from other-buffer.
   (setq frame (or frame (selected-frame)))
   (let ((pred (frame-parameter frame 'buffer-predicate))
-	found buf)
+        found buf)
     (while (and (not found) list)
       (setq buf (car list))
       (if (and (not (eq buffer buf))
-	       (buffer-live-p buf)
-	       (or (null pred) (funcall pred buf))
-	       (not (eq (aref (buffer-name buf) 0) ?\s))
-	       (or visible-ok (null (get-buffer-window buf 'visible))))
-	  (setq found buf)
-	(setq list (cdr list))))
+               (buffer-live-p buf)
+               (or (null pred) (funcall pred buf))
+               (not (eq (aref (buffer-name buf) 0) ?\s))
+               (or visible-ok (null (get-buffer-window buf 'visible))))
+          (setq found buf)
+        (setq list (cdr list))))
     (car list)))
 
 (defun last-buffer (&optional buffer visible-ok frame)
@@ -4821,11 +4821,11 @@ selected frame's buffer list.  If no such buffer exists, return
 the buffer `*scratch*', creating it if necessary."
   (setq frame (or frame (selected-frame)))
   (or (get-next-valid-buffer (nreverse (buffer-list frame))
- 			     buffer visible-ok frame)
+                             buffer visible-ok frame)
       (get-buffer "*scratch*")
       (let ((scratch (get-buffer-create "*scratch*")))
-	(set-buffer-major-mode scratch)
-	scratch)))
+        (set-buffer-major-mode scratch)
+        scratch)))
 
 (defcustom frame-auto-hide-function #'iconify-frame
   "Function called to automatically hide frames.
@@ -4854,18 +4854,18 @@ if WINDOW gets deleted or its frame is auto-hidden."
     (let ((deletable (window-deletable-p window)))
       (cond
        ((eq deletable 'frame)
-	(let ((frame (window-frame window)))
-	  (cond
-	   (kill
-	    (delete-frame frame))
+        (let ((frame (window-frame window)))
+          (cond
+           (kill
+            (delete-frame frame))
            ((functionp (frame-parameter frame 'auto-hide-function))
             (funcall (frame-parameter frame 'auto-hide-function)))
            ((functionp frame-auto-hide-function)
-	    (funcall frame-auto-hide-function frame))))
-	'frame)
+            (funcall frame-auto-hide-function frame))))
+        'frame)
        (deletable
-	(delete-window window)
-	t)))))
+        (delete-window window)
+        t)))))
 
 (defun bury-buffer (&optional buffer-or-name)
   "Put BUFFER-OR-NAME at the end of the list of all buffers.
@@ -4982,25 +4982,25 @@ that does not show that buffer, remove the buffer from that
 window's lists of previous and next buffers."
   (interactive "bDelete 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))))
+        ;; 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)
-	  (let ((deletable (window-deletable-p window)))
-	    (cond
-	     ((and (eq deletable 'frame) (window-dedicated-p window))
-	      ;; Delete frame if and only if window is dedicated.
-	      (delete-frame (window-frame window)))
-	     ((eq deletable t)
-	      ;; Delete window.
-	      (delete-window window))
-	     (t
-	      ;; In window switch to previous buffer.
-	      (set-window-dedicated-p window nil)
-	      (switch-to-prev-buffer window 'bury))))
-	;; If a window doesn't show BUFFER, unrecord BUFFER in it.
-	(unrecord-window-buffer window buffer)))))
+          (let ((deletable (window-deletable-p window)))
+            (cond
+             ((and (eq deletable 'frame) (window-dedicated-p window))
+              ;; Delete frame if and only if window is dedicated.
+              (delete-frame (window-frame window)))
+             ((eq deletable t)
+              ;; Delete window.
+              (delete-window window))
+             (t
+              ;; In window switch to previous buffer.
+              (set-window-dedicated-p window nil)
+              (switch-to-prev-buffer window 'bury))))
+        ;; If a window doesn't show BUFFER, unrecord BUFFER in it.
+        (unrecord-window-buffer window buffer)))))
 
 (defun replace-buffer-in-windows (&optional buffer-or-name)
   "Replace BUFFER-OR-NAME with some other buffer in all windows showing it.
@@ -5019,12 +5019,12 @@ all window-local buffer lists."
   (let ((buffer (window-normalize-buffer buffer-or-name)))
     (dolist (window (window-list-1 nil nil t))
       (if (eq (window-buffer window) buffer)
-	  (unless (window--delete window t t)
-	    ;; Switch to another buffer in window.
-	    (set-window-dedicated-p window nil)
-	    (switch-to-prev-buffer window 'kill))
-	;; Unrecord BUFFER in WINDOW.
-	(unrecord-window-buffer window buffer)))))
+          (unless (window--delete window t t)
+            ;; Switch to another buffer in window.
+            (set-window-dedicated-p window nil)
+            (switch-to-prev-buffer window 'kill))
+        ;; Unrecord BUFFER in WINDOW.
+        (unrecord-window-buffer window buffer)))))
 
 (defcustom quit-window-hook nil
   "Hook run before performing any other actions in the `quit-window' command."
@@ -5065,79 +5065,79 @@ nil means to not handle the buffer in a particular way.  This
 `kill' means to kill WINDOW's buffer."
   (setq window (window-normalize-window window t))
   (let* ((buffer (window-buffer window))
-	 (quit-restore (window-parameter window 'quit-restore))
-	 (prev-buffer
-	  (let* ((prev-buffers (window-prev-buffers window))
-		 (prev-buffer (caar prev-buffers)))
-	    (and (or (not (eq prev-buffer buffer))
-		     (and (cdr prev-buffers)
-			  (not (eq (setq prev-buffer (cadr prev-buffers))
-				   buffer))))
-		 prev-buffer)))
-	 quad entry)
+         (quit-restore (window-parameter window 'quit-restore))
+         (prev-buffer
+          (let* ((prev-buffers (window-prev-buffers window))
+                 (prev-buffer (caar prev-buffers)))
+            (and (or (not (eq prev-buffer buffer))
+                     (and (cdr prev-buffers)
+                          (not (eq (setq prev-buffer (cadr prev-buffers))
+                                   buffer))))
+                 prev-buffer)))
+         quad entry)
     (cond
      ((and (not prev-buffer)
-	   (eq (nth 1 quit-restore) 'tab)
-	   (eq (nth 3 quit-restore) buffer))
+           (eq (nth 1 quit-restore) 'tab)
+           (eq (nth 3 quit-restore) buffer))
       (tab-bar-close-tab)
       ;; If the previously selected window is still alive, select it.
       (when (window-live-p (nth 2 quit-restore))
-	(select-window (nth 2 quit-restore))))
+        (select-window (nth 2 quit-restore))))
      ((and (not prev-buffer)
-	   (or (eq (nth 1 quit-restore) 'frame)
-	       (and (eq (nth 1 quit-restore) 'window)
-		    ;; If the window has been created on an existing
-		    ;; frame and ended up as the sole window on that
-		    ;; frame, do not delete it (Bug#12764).
-		    (not (eq window (frame-root-window window)))))
-	   (eq (nth 3 quit-restore) buffer)
-	   ;; Delete WINDOW if possible.
-	   (window--delete window nil (eq bury-or-kill 'kill)))
+           (or (eq (nth 1 quit-restore) 'frame)
+               (and (eq (nth 1 quit-restore) 'window)
+                    ;; If the window has been created on an existing
+                    ;; frame and ended up as the sole window on that
+                    ;; frame, do not delete it (Bug#12764).
+                    (not (eq window (frame-root-window window)))))
+           (eq (nth 3 quit-restore) buffer)
+           ;; Delete WINDOW if possible.
+           (window--delete window nil (eq bury-or-kill 'kill)))
       ;; If the previously selected window is still alive, select it.
       (when (window-live-p (nth 2 quit-restore))
-	(select-window (nth 2 quit-restore))))
+        (select-window (nth 2 quit-restore))))
      ((and (listp (setq quad (nth 1 quit-restore)))
-	   (buffer-live-p (car quad))
-	   (eq (nth 3 quit-restore) buffer))
+           (buffer-live-p (car quad))
+           (eq (nth 3 quit-restore) buffer))
       ;; Show another buffer stored in quit-restore parameter.
       (when (and (integerp (nth 3 quad))
-		 (if (window-combined-p window)
+                 (if (window-combined-p window)
                      (/= (nth 3 quad) (window-total-height window))
                    (/= (nth 3 quad) (window-total-width window))))
-	;; Try to resize WINDOW to its old height but don't signal an
-	;; error.
-	(condition-case nil
-	    (window-resize
+        ;; Try to resize WINDOW to its old height but don't signal an
+        ;; error.
+        (condition-case nil
+            (window-resize
              window
              (- (nth 3 quad) (if (window-combined-p window)
                                  (window-total-height window)
                                (window-total-width window)))
              (window-combined-p window t))
-	  (error nil)))
+          (error nil)))
       (set-window-dedicated-p window nil)
       ;; Restore WINDOW's previous buffer, start and point position.
       (set-window-buffer-start-and-point
        window (nth 0 quad) (nth 1 quad) (nth 2 quad))
       ;; Deal with the buffer we just removed from WINDOW.
       (setq entry (and (eq bury-or-kill 'append)
-		       (assq buffer (window-prev-buffers window))))
+                       (assq buffer (window-prev-buffers window))))
       (when bury-or-kill
-	;; Remove buffer from WINDOW's previous and next buffers.
-	(set-window-prev-buffers
-	 window (assq-delete-all buffer (window-prev-buffers window)))
-	(set-window-next-buffers
-	 window (delq buffer (window-next-buffers window))))
+        ;; Remove buffer from WINDOW's previous and next buffers.
+        (set-window-prev-buffers
+         window (assq-delete-all buffer (window-prev-buffers window)))
+        (set-window-next-buffers
+         window (delq buffer (window-next-buffers window))))
       (when entry
-	;; Append old buffer's entry to list of WINDOW's previous
-	;; buffers so it's less likely to get switched to soon but
-	;; `display-buffer-in-previous-window' can nevertheless find it.
-	(set-window-prev-buffers
-	 window (append (window-prev-buffers window) (list entry))))
+        ;; Append old buffer's entry to list of WINDOW's previous
+        ;; buffers so it's less likely to get switched to soon but
+        ;; `display-buffer-in-previous-window' can nevertheless find it.
+        (set-window-prev-buffers
+         window (append (window-prev-buffers window) (list entry))))
       ;; Reset the quit-restore parameter.
       (set-window-parameter window 'quit-restore nil)
       ;; Select old window.
       (when (window-live-p (nth 2 quit-restore))
-	(select-window (nth 2 quit-restore))))
+        (select-window (nth 2 quit-restore))))
      (t
       ;; Show some other buffer in WINDOW and reset the quit-restore
       ;; parameter.
@@ -5185,14 +5185,14 @@ 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))))
+        ;; 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)))))
+          (quit-window kill window)
+        ;; If a window doesn't show BUFFER, unrecord BUFFER in it.
+        (unrecord-window-buffer window buffer)))))
 \f
 (defun window--combination-resizable (parent &optional horizontal)
   "Return number of pixels recoverable from height of window PARENT.
@@ -5203,12 +5203,12 @@ by their number plus 1.  If HORIZONTAL is non-nil, return the sum
 of the pixel widths of all non-fixed width child windows of
 PARENT divided by their number plus 1."
   (let ((sibling (window-child parent))
-	(number 0)
-	(size 0))
+        (number 0)
+        (size 0))
     (while sibling
       (unless (window-size-fixed-p sibling horizontal)
-	(setq number (1+ number))
-	(setq size (+ (window-size sibling horizontal t) size)))
+        (setq number (1+ number))
+        (setq size (+ (window-size sibling horizontal t) size)))
       (setq sibling (window-next-sibling sibling)))
     (/ size (1+ number))))
 
@@ -5262,28 +5262,28 @@ new window are inherited from the window selected on WINDOW's
 frame.  The selected window is not changed by this function."
   (setq window (window-normalize-window window))
   (let* ((side (cond
-		((not side) 'below)
+                ((not side) 'below)
                 ((eq side 'up) 'above)
                 ((eq side 'down) 'below)
-		((memq side '(below above right left)) side)
-		(t 'right)))
-	 (horizontal (not (memq side '(below above))))
-	 (frame (window-frame window))
-	 (parent (window-parent window))
-	 (function (window-parameter window 'split-window))
-	 (window-side (window-parameter window 'window-side))
-	 ;; Rebind the following two variables since in some cases we
-	 ;; have to override their value.
-	 (window-combination-limit window-combination-limit)
-	 (window-combination-resize window-combination-resize)
-	 (char-size (frame-char-size window horizontal))
-	 (pixel-size
-	  (when (numberp size)
-	    (window--size-to-pixel window size horizontal pixelwise t)))
-	 (divider-width (if horizontal
-			    (frame-right-divider-width frame)
-			  (frame-bottom-divider-width frame)))
-	 atom-root ignore)
+                ((memq side '(below above right left)) side)
+                (t 'right)))
+         (horizontal (not (memq side '(below above))))
+         (frame (window-frame window))
+         (parent (window-parent window))
+         (function (window-parameter window 'split-window))
+         (window-side (window-parameter window 'window-side))
+         ;; Rebind the following two variables since in some cases we
+         ;; have to override their value.
+         (window-combination-limit window-combination-limit)
+         (window-combination-resize window-combination-resize)
+         (char-size (frame-char-size window horizontal))
+         (pixel-size
+          (when (numberp size)
+            (window--size-to-pixel window size horizontal pixelwise t)))
+         (divider-width (if horizontal
+                            (frame-right-divider-width frame)
+                          (frame-bottom-divider-width frame)))
+         atom-root ignore)
     (window--check frame)
     (catch 'done
       (cond
@@ -5291,210 +5291,210 @@ frame.  The selected window is not changed by this function."
        ;; is t or the 'split-window' parameter equals t.
        ((or ignore-window-parameters (eq function t)))
        ((functionp function)
-	;; The 'split-window' parameter specifies the function to call.
-	;; If that function is `ignore', do nothing.
-	(throw 'done (funcall function window size side)))
+        ;; The 'split-window' parameter specifies the function to call.
+        ;; If that function is `ignore', do nothing.
+        (throw 'done (funcall function window size side)))
        ;; If WINDOW is part of an atomic window, split the root window
        ;; of that atomic window instead.
        ((and (window-parameter window 'window-atom)
-	     (setq atom-root (window-atom-root window))
-	     (not (eq atom-root window)))
-	(throw 'done (split-window atom-root size side pixelwise)))
+             (setq atom-root (window-atom-root window))
+             (not (eq atom-root window)))
+        (throw 'done (split-window atom-root size side pixelwise)))
        ;; If WINDOW is a side window or its first or last child is a
        ;; side window, throw an error unless `window-combination-resize'
        ;; equals 'side.
        ((and (not (eq window-combination-resize 'side))
-	     (window-parameter window 'window-side))
-	(error "Cannot split side window or parent of side window"))
+             (window-parameter window 'window-side))
+        (error "Cannot split side window or parent of side window"))
        ;; If `window-combination-resize' is 'side and window has a side
        ;; window sibling, bind `window-combination-limit' to t.
        ((and (not (eq window-combination-resize 'side))
-	     (or (and (window-prev-sibling window)
-		      (window-parameter
-		       (window-prev-sibling window) 'window-side))
-		 (and (window-next-sibling window)
-		      (window-parameter
-		       (window-next-sibling window) 'window-side))))
-	(setq window-combination-limit t)))
+             (or (and (window-prev-sibling window)
+                      (window-parameter
+                       (window-prev-sibling window) 'window-side))
+                 (and (window-next-sibling window)
+                      (window-parameter
+                       (window-next-sibling window) 'window-side))))
+        (setq window-combination-limit t)))
 
       ;; If `window-combination-resize' is t and SIZE is non-negative,
       ;; bind `window-combination-limit' to t.
       (when (and (eq window-combination-resize t)
-		 pixel-size (> pixel-size 0))
-	(setq window-combination-limit t))
+                 pixel-size (> pixel-size 0))
+        (setq window-combination-limit t))
 
       (let* ((parent-pixel-size
-	      ;; 'parent-pixel-size' is the pixel size of WINDOW's
-	      ;; parent, provided it has one.
-	      (when parent (window-size parent horizontal t)))
-	     ;; 'resize' non-nil means we are supposed to resize other
-	     ;; windows in WINDOW's combination.
-	     (resize
-	      (and window-combination-resize
-		   (or (window-parameter window 'window-side)
-		       (not (eq window-combination-resize 'side)))
-		   (not (eq window-combination-limit t))
-		   ;; Resize makes sense in iso-combinations only.
-		   (window-combined-p window horizontal)))
-	     ;; 'old-pixel-size' is the current pixel size of WINDOW.
-	     (old-pixel-size (window-size window horizontal t))
-	     ;; 'new-size' is the specified or calculated size of the
-	     ;; new window.
-	     new-pixel-size new-parent new-normal)
-	(cond
-	 ((not pixel-size)
-	  (setq new-pixel-size
-		(if resize
-		    ;; When resizing try to give the new window the
-		    ;; average size of a window in its combination.
-		    (max (min (- parent-pixel-size
-				 (window-min-size parent horizontal nil t))
-			      (window--combination-resizable parent horizontal))
-			 (window-min-pixel-size))
-		  ;; Else try to give the new window half the size
-		  ;; of WINDOW (plus an eventual odd pixel).
-		  (/ old-pixel-size 2)))
-	  (unless window-resize-pixelwise
-	    ;; Round to nearest char-size multiple.
-	    (setq new-pixel-size
-		  (* char-size (round new-pixel-size char-size)))))
-	 ((>= pixel-size 0)
-	  ;; SIZE non-negative specifies the new size of WINDOW.
-
-	  ;; Note: Specifying a non-negative SIZE is practically
-	  ;; always done as workaround for making the new window
-	  ;; appear above or on the left of the new window (the
-	  ;; ispell window is a typical example of that).  In all
-	  ;; these cases the SIDE argument should be set to 'above
-	  ;; or 'left in order to support the 'resize option.
-	  ;; Here we have to nest the windows instead, see above.
-	  (setq new-pixel-size (- old-pixel-size pixel-size)))
-	 (t
-	  ;; SIZE negative specifies the size of the new window.
-	  (setq new-pixel-size (- pixel-size))))
-
-	;; Check SIZE.
-	(cond
-	 ((not pixel-size)
-	  (cond
-	   (resize
-	    ;; SIZE unspecified, resizing.
-	    (unless (or (window-sizable-p
-			 parent (- (+ new-pixel-size divider-width)) horizontal
-			 nil t)
-			(window-sizable-p
-			 parent (- (+ new-pixel-size divider-width)) horizontal
-			 (setq ignore 'preserved) t))
-	      (error "Window %s too small for splitting" parent)))
-	   ((and (> (+ new-pixel-size divider-width
-		       (window-min-size window horizontal nil t))
-		    old-pixel-size)
-		 (> (+ new-pixel-size divider-width
-		       (window-min-size
-			window horizontal (setq ignore 'preserved) t))
-		    old-pixel-size))
-	    ;; SIZE unspecified, no resizing.
-	    (error "Window %s too small for splitting" window))))
-	 ((and (>= pixel-size 0)
-	       (or (>= pixel-size old-pixel-size)
-		   (< new-pixel-size
-		      (window-safe-min-pixel-size window horizontal))))
-	  ;; SIZE specified as new size of old window.  If the new size
-	  ;; is larger than the old size or the size of the new window
-	  ;; would be less than the safe minimum, signal an error.
-	  (error "Window %s too small for splitting" window))
-	 (resize
-	  ;; SIZE specified, resizing.
-	  (unless (or (window-sizable-p
-		       parent (- (+ new-pixel-size divider-width)) horizontal
-		       nil t)
-		      (window-sizable-p
-		       parent (- (+ new-pixel-size divider-width)) horizontal
-		       (setq ignore 'preserved) t))
-	    ;; If we cannot resize the parent give up.
-	    (error "Window %s too small for splitting" parent)))
-	 ((or (< new-pixel-size
-		 (window-safe-min-pixel-size window horizontal))
-	      (< (- old-pixel-size new-pixel-size)
-		 (window-safe-min-pixel-size window horizontal)))
-	  ;; SIZE specification violates minimum size restrictions.
-	  (error "Window %s too small for splitting" window)))
-
-	(window--resize-reset frame horizontal)
-
-	(setq new-parent
-	      ;; Make new-parent non-nil if we need a new parent window;
-	      ;; either because we want to nest or because WINDOW is not
-	      ;; iso-combined.
-	      (or (eq window-combination-limit t)
-		  (not (window-combined-p window horizontal))))
-	(setq new-normal
-	      ;; Make new-normal the normal size of the new window.
-	      (cond
-	       (pixel-size (/ (float new-pixel-size)
-			      (if new-parent old-pixel-size parent-pixel-size)))
-	       (new-parent 0.5)
-	       (resize (/ 1.0 (1+ (window-combinations parent horizontal t))))
-	       (t (/ (window-normal-size window horizontal) 2.0))))
-
-	(if resize
-	    ;; Try to get space from OLD's siblings.  We could go "up" and
-	    ;; try getting additional space from surrounding windows but
-	    ;; we won't be able to return space to those windows when we
-	    ;; delete the one we create here.  Hence we do not go up.
-	    (progn
-	      (window--resize-child-windows
-	       parent (- new-pixel-size) horizontal nil ignore)
-	      (let* ((normal (- 1.0 new-normal))
-		     (sub (window-child parent)))
-		(while sub
-		  (set-window-new-normal
-		   sub (* (window-normal-size sub horizontal) normal))
-		  (setq sub (window-right sub)))))
-	  ;; Get entire space from WINDOW.
-	  (set-window-new-pixel
-	   window (- old-pixel-size new-pixel-size))
-	  (window--resize-this-window
-	   window (- new-pixel-size) horizontal ignore)
-	  (set-window-new-normal
-	   window (- (if new-parent 1.0 (window-normal-size window horizontal))
-		     new-normal)))
-
-	(let* ((new (split-window-internal window new-pixel-size side new-normal)))
-	  (window--pixel-to-total frame horizontal)
-	  ;; Assign window-side parameters, if any.
-	  (cond
-	   ((eq window-combination-resize 'side)
-	    (let ((window-side
-		   (cond
-		    (window-side window-side)
-		    ((eq side 'above) 'top)
-		    ((eq side 'below) 'bottom)
-		    (t side))))
-	      ;; We made a new side window.
-	      (set-window-parameter new 'window-side window-side)
-	      (when (and new-parent (window-parameter window 'window-side))
-		;; We've been splitting a side root window.  Give the
-		;; new parent the same window-side parameter.
-		(set-window-parameter
-		 (window-parent new) 'window-side window-side))))
-	   ((eq window-combination-resize 'atom)
-	    ;; Make sure `window--check-frame' won't destroy an existing
-	    ;; atomic window in case the new window gets nested inside.
-	    (unless (window-parameter window 'window-atom)
-	      (set-window-parameter window 'window-atom t))
-	    (when new-parent
-	      (set-window-parameter (window-parent new) 'window-atom t))
-	    (set-window-parameter new 'window-atom t)))
-
-	  ;; Sanitize sizes unless SIZE was specified.
-	  (unless size
+              ;; 'parent-pixel-size' is the pixel size of WINDOW's
+              ;; parent, provided it has one.
+              (when parent (window-size parent horizontal t)))
+             ;; 'resize' non-nil means we are supposed to resize other
+             ;; windows in WINDOW's combination.
+             (resize
+              (and window-combination-resize
+                   (or (window-parameter window 'window-side)
+                       (not (eq window-combination-resize 'side)))
+                   (not (eq window-combination-limit t))
+                   ;; Resize makes sense in iso-combinations only.
+                   (window-combined-p window horizontal)))
+             ;; 'old-pixel-size' is the current pixel size of WINDOW.
+             (old-pixel-size (window-size window horizontal t))
+             ;; 'new-size' is the specified or calculated size of the
+             ;; new window.
+             new-pixel-size new-parent new-normal)
+        (cond
+         ((not pixel-size)
+          (setq new-pixel-size
+                (if resize
+                    ;; When resizing try to give the new window the
+                    ;; average size of a window in its combination.
+                    (max (min (- parent-pixel-size
+                                 (window-min-size parent horizontal nil t))
+                              (window--combination-resizable parent horizontal))
+                         (window-min-pixel-size))
+                  ;; Else try to give the new window half the size
+                  ;; of WINDOW (plus an eventual odd pixel).
+                  (/ old-pixel-size 2)))
+          (unless window-resize-pixelwise
+            ;; Round to nearest char-size multiple.
+            (setq new-pixel-size
+                  (* char-size (round new-pixel-size char-size)))))
+         ((>= pixel-size 0)
+          ;; SIZE non-negative specifies the new size of WINDOW.
+
+          ;; Note: Specifying a non-negative SIZE is practically
+          ;; always done as workaround for making the new window
+          ;; appear above or on the left of the new window (the
+          ;; ispell window is a typical example of that).  In all
+          ;; these cases the SIDE argument should be set to 'above
+          ;; or 'left in order to support the 'resize option.
+          ;; Here we have to nest the windows instead, see above.
+          (setq new-pixel-size (- old-pixel-size pixel-size)))
+         (t
+          ;; SIZE negative specifies the size of the new window.
+          (setq new-pixel-size (- pixel-size))))
+
+        ;; Check SIZE.
+        (cond
+         ((not pixel-size)
+          (cond
+           (resize
+            ;; SIZE unspecified, resizing.
+            (unless (or (window-sizable-p
+                         parent (- (+ new-pixel-size divider-width)) horizontal
+                         nil t)
+                        (window-sizable-p
+                         parent (- (+ new-pixel-size divider-width)) horizontal
+                         (setq ignore 'preserved) t))
+              (error "Window %s too small for splitting" parent)))
+           ((and (> (+ new-pixel-size divider-width
+                       (window-min-size window horizontal nil t))
+                    old-pixel-size)
+                 (> (+ new-pixel-size divider-width
+                       (window-min-size
+                        window horizontal (setq ignore 'preserved) t))
+                    old-pixel-size))
+            ;; SIZE unspecified, no resizing.
+            (error "Window %s too small for splitting" window))))
+         ((and (>= pixel-size 0)
+               (or (>= pixel-size old-pixel-size)
+                   (< new-pixel-size
+                      (window-safe-min-pixel-size window horizontal))))
+          ;; SIZE specified as new size of old window.  If the new size
+          ;; is larger than the old size or the size of the new window
+          ;; would be less than the safe minimum, signal an error.
+          (error "Window %s too small for splitting" window))
+         (resize
+          ;; SIZE specified, resizing.
+          (unless (or (window-sizable-p
+                       parent (- (+ new-pixel-size divider-width)) horizontal
+                       nil t)
+                      (window-sizable-p
+                       parent (- (+ new-pixel-size divider-width)) horizontal
+                       (setq ignore 'preserved) t))
+            ;; If we cannot resize the parent give up.
+            (error "Window %s too small for splitting" parent)))
+         ((or (< new-pixel-size
+                 (window-safe-min-pixel-size window horizontal))
+              (< (- old-pixel-size new-pixel-size)
+                 (window-safe-min-pixel-size window horizontal)))
+          ;; SIZE specification violates minimum size restrictions.
+          (error "Window %s too small for splitting" window)))
+
+        (window--resize-reset frame horizontal)
+
+        (setq new-parent
+              ;; Make new-parent non-nil if we need a new parent window;
+              ;; either because we want to nest or because WINDOW is not
+              ;; iso-combined.
+              (or (eq window-combination-limit t)
+                  (not (window-combined-p window horizontal))))
+        (setq new-normal
+              ;; Make new-normal the normal size of the new window.
+              (cond
+               (pixel-size (/ (float new-pixel-size)
+                              (if new-parent old-pixel-size parent-pixel-size)))
+               (new-parent 0.5)
+               (resize (/ 1.0 (1+ (window-combinations parent horizontal t))))
+               (t (/ (window-normal-size window horizontal) 2.0))))
+
+        (if resize
+            ;; Try to get space from OLD's siblings.  We could go "up" and
+            ;; try getting additional space from surrounding windows but
+            ;; we won't be able to return space to those windows when we
+            ;; delete the one we create here.  Hence we do not go up.
+            (progn
+              (window--resize-child-windows
+               parent (- new-pixel-size) horizontal nil ignore)
+              (let* ((normal (- 1.0 new-normal))
+                     (sub (window-child parent)))
+                (while sub
+                  (set-window-new-normal
+                   sub (* (window-normal-size sub horizontal) normal))
+                  (setq sub (window-right sub)))))
+          ;; Get entire space from WINDOW.
+          (set-window-new-pixel
+           window (- old-pixel-size new-pixel-size))
+          (window--resize-this-window
+           window (- new-pixel-size) horizontal ignore)
+          (set-window-new-normal
+           window (- (if new-parent 1.0 (window-normal-size window horizontal))
+                     new-normal)))
+
+        (let* ((new (split-window-internal window new-pixel-size side new-normal)))
+          (window--pixel-to-total frame horizontal)
+          ;; Assign window-side parameters, if any.
+          (cond
+           ((eq window-combination-resize 'side)
+            (let ((window-side
+                   (cond
+                    (window-side window-side)
+                    ((eq side 'above) 'top)
+                    ((eq side 'below) 'bottom)
+                    (t side))))
+              ;; We made a new side window.
+              (set-window-parameter new 'window-side window-side)
+              (when (and new-parent (window-parameter window 'window-side))
+                ;; We've been splitting a side root window.  Give the
+                ;; new parent the same window-side parameter.
+                (set-window-parameter
+                 (window-parent new) 'window-side window-side))))
+           ((eq window-combination-resize 'atom)
+            ;; Make sure `window--check-frame' won't destroy an existing
+            ;; atomic window in case the new window gets nested inside.
+            (unless (window-parameter window 'window-atom)
+              (set-window-parameter window 'window-atom t))
+            (when new-parent
+              (set-window-parameter (window-parent new) 'window-atom t))
+            (set-window-parameter new 'window-atom t)))
+
+          ;; Sanitize sizes unless SIZE was specified.
+          (unless size
             (window--sanitize-window-sizes horizontal))
 
-	  (run-window-scroll-functions new)
-	  (window--check frame)
-	  ;; Always return the new window.
-	  new)))))
+          (run-window-scroll-functions new)
+          (window--check frame)
+          ;; Always return the new window.
+          new)))))
 
 (defun split-window-no-error (&optional window size side pixelwise)
   "Make a new window adjacent to WINDOW.
@@ -5533,8 +5533,8 @@ Otherwise, the window starts are chosen so as to minimize the
 amount of redisplay; this is convenient on slow terminals."
   (interactive "P")
   (let ((old-window (selected-window))
-	(old-point (window-point))
-	(size (and size (prefix-numeric-value size)))
+        (old-point (window-point))
+        (size (and size (prefix-numeric-value size)))
         moved-by-window-height moved new-window bottom)
     (when (and size (< size 0) (< (- size) window-min-height))
       ;; `split-window' would not signal an error here.
@@ -5542,31 +5542,31 @@ amount of redisplay; this is convenient on slow terminals."
     (setq new-window (split-window nil size))
     (unless split-window-keep-point
       (with-current-buffer (window-buffer)
-	;; Use `save-excursion' around vertical movements below
-	;; (Bug#10971).  Note: When the selected window's buffer has a
-	;; header line, up to two lines of the buffer may not show up
-	;; in the resulting configuration.
-	(save-excursion
-	  (goto-char (window-start))
-	  (setq moved (vertical-motion (window-height)))
-	  (set-window-start new-window (point))
-	  (when (> (point) (window-point new-window))
-	    (set-window-point new-window (point)))
-	  (when (= moved (window-height))
-	    (setq moved-by-window-height t)
-	    (vertical-motion -1))
-	  (setq bottom (point)))
-	(and moved-by-window-height
-	     (<= bottom (point))
-	     (set-window-point old-window (1- bottom)))
-	(and moved-by-window-height
-	     (<= (window-start new-window) old-point)
-	     (set-window-point new-window old-point)
-	     (select-window new-window))))
+        ;; Use `save-excursion' around vertical movements below
+        ;; (Bug#10971).  Note: When the selected window's buffer has a
+        ;; header line, up to two lines of the buffer may not show up
+        ;; in the resulting configuration.
+        (save-excursion
+          (goto-char (window-start))
+          (setq moved (vertical-motion (window-height)))
+          (set-window-start new-window (point))
+          (when (> (point) (window-point new-window))
+            (set-window-point new-window (point)))
+          (when (= moved (window-height))
+            (setq moved-by-window-height t)
+            (vertical-motion -1))
+          (setq bottom (point)))
+        (and moved-by-window-height
+             (<= bottom (point))
+             (set-window-point old-window (1- bottom)))
+        (and moved-by-window-height
+             (<= (window-start new-window) old-point)
+             (set-window-point new-window old-point)
+             (select-window new-window))))
     ;; Always copy quit-restore parameter in interactive use.
     (let ((quit-restore (window-parameter old-window 'quit-restore)))
       (when quit-restore
-	(set-window-parameter new-window 'quit-restore quit-restore)))
+        (set-window-parameter new-window 'quit-restore quit-restore)))
     new-window))
 
 (defalias 'split-window-vertically 'split-window-below)
@@ -5586,8 +5586,8 @@ bars, it includes the width of the divider column to the window's
 right, if any."
   (interactive "P")
   (let ((old-window (selected-window))
-	(size (and size (prefix-numeric-value size)))
-	new-window)
+        (size (and size (prefix-numeric-value size)))
+        new-window)
     (when (and size (< size 0) (< (- size) window-min-width))
       ;; `split-window' would not signal an error here.
       (error "Size of new window too small"))
@@ -5595,7 +5595,7 @@ right, if any."
     ;; Always copy quit-restore parameter in interactive use.
     (let ((quit-restore (window-parameter old-window 'quit-restore)))
       (when quit-restore
-	(set-window-parameter new-window 'quit-restore quit-restore)))
+        (set-window-parameter new-window 'quit-restore quit-restore)))
     new-window))
 
 (defalias 'split-window-horizontally 'split-window-right)
@@ -5614,20 +5614,20 @@ right, if any."
 WINDOW must be a vertical combination (horizontal if HORIZONTAL
 is non-nil)."
   (let* ((char-size (if window-resize-pixelwise
-			1
-		      (frame-char-size window horizontal)))
-	 (first (window-child window))
-	 (sub first)
-	 (number-of-children 0)
-	 (parent-size (window-new-pixel window))
-	 (total-sum parent-size)
-	 failed size sub-total sub-delta sub-amount rest)
+                        1
+                      (frame-char-size window horizontal)))
+         (first (window-child window))
+         (sub first)
+         (number-of-children 0)
+         (parent-size (window-new-pixel window))
+         (total-sum parent-size)
+         failed size sub-total sub-delta sub-amount rest)
     (while sub
       (if (window-size-fixed-p sub horizontal)
           (progn
             (setq total-sum
-	          (- total-sum (window-size sub horizontal t)))
-	    (set-window-new-normal sub 'ignore))
+                  (- total-sum (window-size sub horizontal t)))
+            (set-window-new-normal sub 'ignore))
         (setq number-of-children (1+ number-of-children)))
       (setq sub (window-right sub)))
 
@@ -5637,21 +5637,21 @@ is non-nil)."
       (setq failed nil)
       (setq sub first)
       (while (and sub (not failed))
-	;; Ignore child windows that should be ignored or are stuck.
-	(unless (window--resize-child-windows-skip-p sub)
-	  (setq sub-total (window-size sub horizontal t))
-	  (setq sub-delta (- size sub-total))
-	  (setq sub-amount
-		(window-sizable sub sub-delta horizontal nil t))
-	  ;; Register the new total size for this child window.
-	  (set-window-new-pixel sub (+ sub-total sub-amount))
-	  (unless (= sub-amount sub-delta)
-	    (setq total-sum (- total-sum sub-total sub-amount))
-	    (setq number-of-children (1- number-of-children))
-	    ;; We failed and need a new round.
-	    (setq failed t)
-	    (set-window-new-normal sub 'skip)))
-	(setq sub (window-right sub))))
+        ;; Ignore child windows that should be ignored or are stuck.
+        (unless (window--resize-child-windows-skip-p sub)
+          (setq sub-total (window-size sub horizontal t))
+          (setq sub-delta (- size sub-total))
+          (setq sub-amount
+                (window-sizable sub sub-delta horizontal nil t))
+          ;; Register the new total size for this child window.
+          (set-window-new-pixel sub (+ sub-total sub-amount))
+          (unless (= sub-amount sub-delta)
+            (setq total-sum (- total-sum sub-total sub-amount))
+            (setq number-of-children (1- number-of-children))
+            ;; We failed and need a new round.
+            (setq failed t)
+            (set-window-new-normal sub 'skip)))
+        (setq sub (window-right sub))))
 
     (when (> number-of-children 0)
       (setq rest (% total-sum number-of-children))
@@ -5660,8 +5660,8 @@ is non-nil)."
       (setq sub first)
       (while (and sub (> rest 0))
         (unless (window--resize-child-windows-skip-p window)
-	  (set-window-new-pixel sub (min rest char-size) t)
-	  (setq rest (- rest char-size)))
+          (set-window-new-pixel sub (min rest char-size) t)
+          (setq rest (- rest char-size)))
         (setq sub (window-right sub))))
 
     ;; Fix rounding by trying to enlarge stuck windows by one line
@@ -5669,8 +5669,8 @@ is non-nil)."
     (setq sub first)
     (while (and sub (> rest 0))
       (unless (eq (window-new-normal sub) 'ignore)
-	(set-window-new-pixel sub (min rest char-size) t)
-	(setq rest (- rest char-size)))
+        (set-window-new-pixel sub (min rest char-size) t)
+        (setq rest (- rest char-size)))
       (setq sub (window-right sub)))
 
     (setq sub first)
@@ -5678,9 +5678,9 @@ is non-nil)."
       ;; Record new normal sizes.
       (set-window-new-normal
        sub (/ (if (eq (window-new-normal sub) 'ignore)
-		  (window-size sub horizontal t)
-		(window-new-pixel sub))
-	      (float parent-size)))
+                  (window-size sub horizontal t)
+                (window-new-pixel sub))
+              (float parent-size)))
       ;; Recursively balance each window's child windows.
       (balance-windows-1 sub horizontal)
       (setq sub (window-right sub)))))
@@ -5689,13 +5689,13 @@ is non-nil)."
   "Subroutine of `balance-windows'."
   (if (window-child window)
       (let ((sub (window-child window)))
-	(if (window-combined-p sub horizontal)
-	    (balance-windows-2 window horizontal)
-	  (let ((size (window-new-pixel window)))
-	    (while sub
-	      (set-window-new-pixel sub size)
-	      (balance-windows-1 sub horizontal)
-	      (setq sub (window-right sub))))))))
+        (if (window-combined-p sub horizontal)
+            (balance-windows-2 window horizontal)
+          (let ((size (window-new-pixel window)))
+            (while sub
+              (set-window-new-pixel sub size)
+              (balance-windows-1 sub horizontal)
+              (setq sub (window-right sub))))))))
 
 (defun balance-windows (&optional window-or-frame)
   "Balance the sizes of windows of WINDOW-OR-FRAME.
@@ -5706,16 +5706,16 @@ recursively balance the sizes of all child windows of that
 window."
   (interactive)
   (let* ((window
-	  (cond
-	   ((or (not window-or-frame)
-		(frame-live-p window-or-frame))
-	    (frame-root-window window-or-frame))
-	   ((or (window-live-p window-or-frame)
-		(window-child window-or-frame))
-	    window-or-frame)
-	   (t
-	    (error "Not a window or frame %s" window-or-frame))))
-	 (frame (window-frame window)))
+          (cond
+           ((or (not window-or-frame)
+                (frame-live-p window-or-frame))
+            (frame-root-window window-or-frame))
+           ((or (window-live-p window-or-frame)
+                (window-child window-or-frame))
+            window-or-frame)
+           (t
+            (error "Not a window or frame %s" window-or-frame))))
+         (frame (window-frame window)))
     ;; Balance vertically.
     (window--resize-reset (window-frame window))
     (balance-windows-1 window)
@@ -5736,8 +5736,8 @@ nil (i.e. any), `height' or `width'."
   (with-current-buffer (window-buffer window)
     (and window-size-fixed
          (not (and direction
-		   (member (cons direction window-size-fixed)
-			   '((height . width) (width . height))))))))
+                   (member (cons direction window-size-fixed)
+                           '((height . width) (width . height))))))))
 
 ;;; A different solution to balance-windows.
 (defvar window-area-factor 1
@@ -5753,10 +5753,10 @@ Arguments WINDOW, DELTA and HORIZONTAL are passed on to that function."
   (while (>= (abs delta) 1)
     (condition-case nil
         (progn
-	  ;; It was wrong to use `window-resize' here.  Somehow
-	  ;; `balance-windows-area' depends on resizing windows
-	  ;; asymmetrically.
-	  (adjust-window-trailing-edge window delta horizontal pixelwise)
+          ;; It was wrong to use `window-resize' here.  Somehow
+          ;; `balance-windows-area' depends on resizing windows
+          ;; asymmetrically.
+          (adjust-window-trailing-edge window delta horizontal pixelwise)
           (setq delta 0))
       (error
        ;;(message "adjust: %s" (error-message-string err))
@@ -5773,8 +5773,8 @@ specific buffers."
                                    (if (not (window-fixed-size-p win)) win))
                                  (window-list nil 'nomini))))
          (changelog nil)
-	 (pixelwise window-resize-pixelwise)
-	 next)
+         (pixelwise window-resize-pixelwise)
+         next)
     ;; Resizing a window changes the size of surrounding windows in complex
     ;; ways, so it's difficult to balance them all.  The introduction of
     ;; `adjust-window-trailing-edge' made it a bit easier, but it is still
@@ -5800,11 +5800,11 @@ specific buffers."
         (let* ((horiz
                 (< (car (window-pixel-edges win)) (car (window-pixel-edges next))))
                (areadiff (/ (- (* (window-size next nil pixelwise)
-				  (window-size next t pixelwise)
+                                  (window-size next t pixelwise)
                                   (buffer-local-value 'window-area-factor
                                                       (window-buffer next)))
                                (* (window-size win nil pixelwise)
-				  (window-size win t pixelwise)
+                                  (window-size win t pixelwise)
                                   (buffer-local-value 'window-area-factor
                                                       (window-buffer win))))
                             (max (buffer-local-value 'window-area-factor
@@ -5813,9 +5813,9 @@ specific buffers."
                                                      (window-buffer next)))))
                (edgesize (if horiz
                              (+ (window-size win nil pixelwise)
-				(window-size next nil pixelwise))
+                                (window-size next nil pixelwise))
                            (+ (window-size win t pixelwise)
-			      (window-size next t pixelwise))))
+                              (window-size next t pixelwise))))
                (diff (/ areadiff edgesize)))
           (when (zerop diff)
             ;; Maybe diff is actually closer to 1 than to 0.
@@ -5828,9 +5828,9 @@ specific buffers."
               ;; Make sure negligible differences don't accumulate to
               ;; become significant.
               (setq carry (+ carry areadiff))
-	    ;; This used `adjust-window-trailing-edge' before and uses
-	    ;; `window-resize' now.  Error wrapping is still needed.
-	    (balance-windows-area-adjust win diff horiz pixelwise)
+            ;; This used `adjust-window-trailing-edge' before and uses
+            ;; `window-resize' now.  Error wrapping is still needed.
+            (balance-windows-area-adjust win diff horiz pixelwise)
             ;; (sit-for 0.5)
             (let ((change (cons win (window-pixel-edges win))))
               ;; If the same change has been seen already for this window,
@@ -5850,23 +5850,23 @@ specific buffers."
 (defun window--state-get-1 (window &optional writable)
   "Helper function for `window-state-get'."
   (let* ((type
-	  (cond
-	   ((window-top-child window) 'vc)
-	   ((window-left-child window) 'hc)
-	   (t 'leaf)))
-	 (buffer (window-buffer window))
-	 (selected (eq window (selected-window)))
-	 (next-buffers (when (window-live-p window)
-	                 (delq nil (mapcar (lambda (buffer)
+          (cond
+           ((window-top-child window) 'vc)
+           ((window-left-child window) 'hc)
+           (t 'leaf)))
+         (buffer (window-buffer window))
+         (selected (eq window (selected-window)))
+         (next-buffers (when (window-live-p window)
+                         (delq nil (mapcar (lambda (buffer)
                                              (and (buffer-live-p buffer) buffer))
                                            (window-next-buffers window)))))
-	 (prev-buffers (when (window-live-p window)
-	                 (delq nil (mapcar (lambda (entry)
+         (prev-buffers (when (window-live-p window)
+                         (delq nil (mapcar (lambda (entry)
                                              (and (buffer-live-p (nth 0 entry))
                                                   entry))
                                            (window-prev-buffers window)))))
-	 (head
-	  `(,type
+         (head
+          `(,type
             ,@(unless (window-next-sibling window) '((last . t)))
             (pixel-width . ,(window-pixel-width window))
             (pixel-height . ,(window-pixel-height window))
@@ -5877,44 +5877,44 @@ specific buffers."
             ,@(unless (window-live-p window)
                 `((combination-limit . ,(window-combination-limit window))))
             ,@(let ((parameters (window-parameters window))
-		    list)
-		;; Make copies of those window parameters whose
-		;; persistence property is `writable' if WRITABLE is
-		;; non-nil and non-nil if WRITABLE is nil.
+                    list)
+                ;; Make copies of those window parameters whose
+                ;; persistence property is `writable' if WRITABLE is
+                ;; non-nil and non-nil if WRITABLE is nil.
                 (dolist (par parameters)
-		  (let ((pers (cdr (assq (car par)
-					 window-persistent-parameters))))
-		    (when (and pers (or (not writable) (eq pers 'writable)))
-		      (setq list (cons (cons (car par) (cdr par)) list)))))
-		;; Add `clone-of' parameter if necessary.
-		(let ((pers (cdr (assq 'clone-of
-				       window-persistent-parameters))))
-		  (when (and pers (or (not writable) (eq pers 'writable))
-			     (not (assq 'clone-of list)))
-		    (setq list (cons (cons 'clone-of window) list))))
+                  (let ((pers (cdr (assq (car par)
+                                         window-persistent-parameters))))
+                    (when (and pers (or (not writable) (eq pers 'writable)))
+                      (setq list (cons (cons (car par) (cdr par)) list)))))
+                ;; Add `clone-of' parameter if necessary.
+                (let ((pers (cdr (assq 'clone-of
+                                       window-persistent-parameters))))
+                  (when (and pers (or (not writable) (eq pers 'writable))
+                             (not (assq 'clone-of list)))
+                    (setq list (cons (cons 'clone-of window) list))))
                 (when list
                   `((parameters . ,list))))
             ,@(when buffer
                 ;; All buffer related things go in here.
-		(let ((point (window-point window))
-		      (start (window-start window)))
-		  `((buffer
-		     ,(if writable (buffer-name buffer) buffer)
-		     (selected . ,selected)
-		     (hscroll . ,(window-hscroll window))
-		     (fringes . ,(window-fringes window))
-		     (margins . ,(window-margins window))
-		     (scroll-bars . ,(window-scroll-bars window))
-		     (vscroll . ,(window-vscroll window))
-		     (dedicated . ,(window-dedicated-p window))
-		     (point . ,(if writable
+                (let ((point (window-point window))
+                      (start (window-start window)))
+                  `((buffer
+                     ,(if writable (buffer-name buffer) buffer)
+                     (selected . ,selected)
+                     (hscroll . ,(window-hscroll window))
+                     (fringes . ,(window-fringes window))
+                     (margins . ,(window-margins window))
+                     (scroll-bars . ,(window-scroll-bars window))
+                     (vscroll . ,(window-vscroll window))
+                     (dedicated . ,(window-dedicated-p window))
+                     (point . ,(if writable
                                    point
                                  (with-current-buffer buffer
                                    (copy-marker point
                                                 (buffer-local-value
                                                  'window-point-insertion-type
                                                  buffer)))))
-		     (start . ,(if writable
+                     (start . ,(if writable
                                    start
                                  (with-current-buffer buffer
                                    (copy-marker start))))))))
@@ -5933,14 +5933,14 @@ specific buffers."
                                           (marker-position (nth 2 entry))))
                                   prev-buffers)
                         prev-buffers))))))
-	 (tail
-	  (when (memq type '(vc hc))
-	    (let (list)
-	      (setq window (window-child window))
-	      (while window
-		(setq list (cons (window--state-get-1 window writable) list))
-		(setq window (window-right window)))
-	      (nreverse list)))))
+         (tail
+          (when (memq type '(vc hc))
+            (let (list)
+              (setq window (window-child window))
+              (while window
+                (setq list (cons (window--state-get-1 window writable) list))
+                (setq window (window-right window)))
+              (nreverse list)))))
     (append head tail)))
 
 (defun window-state-get (&optional window writable)
@@ -5961,11 +5961,11 @@ The return value can be used as argument for `window-state-put'
 to put the state recorded here into an arbitrary window.  The
 value can be also stored on disk and read back in a new session."
   (setq window
-	(if window
-	    (if (window-valid-p window)
-		window
-	      (error "%s is not a live or internal window" window))
-	  (frame-root-window)))
+        (if window
+            (if (window-valid-p window)
+                window
+              (error "%s is not a live or internal window" window))
+          (frame-root-window)))
   ;; The return value is a cons whose car specifies some constraints on
   ;; the size of WINDOW.  The cdr lists the states of the child windows
   ;; of WINDOW.
@@ -6003,163 +6003,163 @@ value can be also stored on disk and read back in a new session."
       (push (cons window state) window-state-put-list))
      ((memq type '(vc hc))
       (let* ((horizontal (eq type 'hc))
-	     (total (window-size window horizontal pixelwise))
+             (total (window-size window horizontal pixelwise))
              (first t)
              (window-combination-limit (cdr (assq 'combination-limit state)))
-	     size new)
-	(dolist (item state)
-	  ;; Find the next child window.  WINDOW always points to the
-	  ;; real window that we want to fill with what we find here.
-	  (when (memq (car item) '(leaf vc hc))
-	    (if (assq 'last item)
-		;; The last child window.  Below `window--state-put-1'
-		;; will put into it whatever ITEM has in store.
-		(setq new nil)
-	      ;; Not the last child window, prepare for splitting
-	      ;; WINDOW.  SIZE is the new (and final) size of the old
-	      ;; window.
-	      (setq size
-		    (if totals
-			;; Use total size.
-			(if pixelwise
-			    (cdr (assq (if horizontal
-					   'pixel-width
-					 'pixel-height)
-				       item))
-			  (cdr (assq (if horizontal
-					 'total-width
-				       'total-height)
-				     item)))
-		      ;; Use normalized size and round.
-		      (round
-		       (* total
-			  (cdr (assq (if horizontal 'normal-width 'normal-height)
-				     item))))))
-
-	      ;; Use safe sizes, we try to resize later.
-	      (setq size (max size
-			      (if horizontal
-				  (* window-safe-min-width
-				     (if pixelwise
-					 (frame-char-width (window-frame window))
-				       1))
-				(* window-safe-min-height
-				   (if pixelwise
-				       (frame-char-height (window-frame window))
-				     1)))))
-	      (if (window-sizable-p window (- size) horizontal 'safe pixelwise)
+             size new)
+        (dolist (item state)
+          ;; Find the next child window.  WINDOW always points to the
+          ;; real window that we want to fill with what we find here.
+          (when (memq (car item) '(leaf vc hc))
+            (if (assq 'last item)
+                ;; The last child window.  Below `window--state-put-1'
+                ;; will put into it whatever ITEM has in store.
+                (setq new nil)
+              ;; Not the last child window, prepare for splitting
+              ;; WINDOW.  SIZE is the new (and final) size of the old
+              ;; window.
+              (setq size
+                    (if totals
+                        ;; Use total size.
+                        (if pixelwise
+                            (cdr (assq (if horizontal
+                                           'pixel-width
+                                         'pixel-height)
+                                       item))
+                          (cdr (assq (if horizontal
+                                         'total-width
+                                       'total-height)
+                                     item)))
+                      ;; Use normalized size and round.
+                      (round
+                       (* total
+                          (cdr (assq (if horizontal 'normal-width 'normal-height)
+                                     item))))))
+
+              ;; Use safe sizes, we try to resize later.
+              (setq size (max size
+                              (if horizontal
+                                  (* window-safe-min-width
+                                     (if pixelwise
+                                         (frame-char-width (window-frame window))
+                                       1))
+                                (* window-safe-min-height
+                                   (if pixelwise
+                                       (frame-char-height (window-frame window))
+                                     1)))))
+              (if (window-sizable-p window (- size) horizontal 'safe pixelwise)
                   (progn
                     (setq new (split-window-no-error
                                window size horizontal pixelwise))
                     (setq window-combination-limit nil))
-		;; Give up if we can't resize window down to safe sizes.
-		(error "Cannot resize window %s" window))
-
-	      (when first
-		(setq first nil)
-		;; When creating the first child window add for parent
-		;; unprocessed entries to `window-state-put-list'.
-		(setq window-state-put-list
-		      (cons (cons (window-parent window) state)
-			    window-state-put-list))))
-
-	    ;; Now process the current window (either the one we've just
-	    ;; split or the last child of its parent).
-	    (window--state-put-1 item window ignore totals)
-	    ;; Continue with the last window split off.
-	    (setq window new))))))))
+                ;; Give up if we can't resize window down to safe sizes.
+                (error "Cannot resize window %s" window))
+
+              (when first
+                (setq first nil)
+                ;; When creating the first child window add for parent
+                ;; unprocessed entries to `window-state-put-list'.
+                (setq window-state-put-list
+                      (cons (cons (window-parent window) state)
+                            window-state-put-list))))
+
+            ;; Now process the current window (either the one we've just
+            ;; split or the last child of its parent).
+            (window--state-put-1 item window ignore totals)
+            ;; Continue with the last window split off.
+            (setq window new))))))))
 
 (defun window--state-put-2 (ignore pixelwise)
   "Helper function for `window-state-put'."
   (dolist (item window-state-put-list)
     (let ((window (car item))
-	  (combination-limit (cdr (assq 'combination-limit item)))
-	  (parameters (cdr (assq 'parameters item)))
-	  (state (cdr (assq 'buffer item)))
-	  (next-buffers (cdr (assq 'next-buffers item)))
-	  (prev-buffers (cdr (assq 'prev-buffers item))))
+          (combination-limit (cdr (assq 'combination-limit item)))
+          (parameters (cdr (assq 'parameters item)))
+          (state (cdr (assq 'buffer item)))
+          (next-buffers (cdr (assq 'next-buffers item)))
+          (prev-buffers (cdr (assq 'prev-buffers item))))
       (when combination-limit
-	(set-window-combination-limit window combination-limit))
+        (set-window-combination-limit window combination-limit))
       ;; Reset window's parameters and assign saved ones (we might want
       ;; a `remove-window-parameters' function here).
       (dolist (parameter (window-parameters window))
-	(set-window-parameter window (car parameter) nil))
+        (set-window-parameter window (car parameter) nil))
       (when parameters
-	(dolist (parameter parameters)
-	  (set-window-parameter window (car parameter) (cdr parameter))))
+        (dolist (parameter parameters)
+          (set-window-parameter window (car parameter) (cdr parameter))))
       ;; Process buffer related state.
       (when state
-	(let ((buffer (get-buffer (car state)))
-	      (state (cdr state)))
-	  (if buffer
-	      (with-current-buffer buffer
-		(set-window-buffer window buffer)
-		(set-window-hscroll window (cdr (assq 'hscroll state)))
-		(apply 'set-window-fringes
-		       (cons window (cdr (assq 'fringes state))))
-		(let ((margins (cdr (assq 'margins state))))
-		  (set-window-margins window (car margins) (cdr margins)))
-		(let ((scroll-bars (cdr (assq 'scroll-bars state))))
-		  (set-window-scroll-bars
-		   window (car scroll-bars) (nth 2 scroll-bars)
-		   (nth 3 scroll-bars) (nth 5 scroll-bars) (nth 6 scroll-bars)))
-		(set-window-vscroll window (cdr (assq 'vscroll state)))
-		;; Adjust vertically.
-		(if (or (memq window-size-fixed '(t height))
+        (let ((buffer (get-buffer (car state)))
+              (state (cdr state)))
+          (if buffer
+              (with-current-buffer buffer
+                (set-window-buffer window buffer)
+                (set-window-hscroll window (cdr (assq 'hscroll state)))
+                (apply 'set-window-fringes
+                       (cons window (cdr (assq 'fringes state))))
+                (let ((margins (cdr (assq 'margins state))))
+                  (set-window-margins window (car margins) (cdr margins)))
+                (let ((scroll-bars (cdr (assq 'scroll-bars state))))
+                  (set-window-scroll-bars
+                   window (car scroll-bars) (nth 2 scroll-bars)
+                   (nth 3 scroll-bars) (nth 5 scroll-bars) (nth 6 scroll-bars)))
+                (set-window-vscroll window (cdr (assq 'vscroll state)))
+                ;; Adjust vertically.
+                (if (or (memq window-size-fixed '(t height))
                         (window-preserved-size window))
-		    ;; A fixed height window, try to restore the
-		    ;; original size.
-		    (let ((delta
-			   (- (cdr (assq
-				    (if pixelwise 'pixel-height 'total-height)
-				    item))
-			      (window-size window nil pixelwise)))
-			  window-size-fixed)
-		      (when (window--resizable-p
-			     window delta nil nil nil nil nil pixelwise)
-			(window-resize window delta nil nil pixelwise)))
-		  ;; Else check whether the window is not high enough.
-		  (let* ((min-size
-			  (window-min-size window nil ignore pixelwise))
-			 (delta
-			  (- min-size (window-size window nil pixelwise))))
-		    (when (and (> delta 0)
-			       (window--resizable-p
-				window delta nil ignore nil nil nil pixelwise))
-		      (window-resize window delta nil ignore pixelwise))))
-		;; Adjust horizontally.
-		(if (or (memq window-size-fixed '(t width))
+                    ;; A fixed height window, try to restore the
+                    ;; original size.
+                    (let ((delta
+                           (- (cdr (assq
+                                    (if pixelwise 'pixel-height 'total-height)
+                                    item))
+                              (window-size window nil pixelwise)))
+                          window-size-fixed)
+                      (when (window--resizable-p
+                             window delta nil nil nil nil nil pixelwise)
+                        (window-resize window delta nil nil pixelwise)))
+                  ;; Else check whether the window is not high enough.
+                  (let* ((min-size
+                          (window-min-size window nil ignore pixelwise))
+                         (delta
+                          (- min-size (window-size window nil pixelwise))))
+                    (when (and (> delta 0)
+                               (window--resizable-p
+                                window delta nil ignore nil nil nil pixelwise))
+                      (window-resize window delta nil ignore pixelwise))))
+                ;; Adjust horizontally.
+                (if (or (memq window-size-fixed '(t width))
                         (window-preserved-size window t))
-		    ;; A fixed width window, try to restore the original
-		    ;; size.
-		    (let ((delta
-			   (- (cdr (assq
-				    (if pixelwise 'pixel-width 'total-width)
-				    item))
-			      (window-size window t pixelwise)))
-			  window-size-fixed)
-		      (when (window--resizable-p
-			     window delta t nil nil nil nil pixelwise)
-			(window-resize window delta t nil pixelwise)))
-		  ;; Else check whether the window is not wide enough.
-		  (let* ((min-size (window-min-size window t ignore pixelwise))
-			 (delta (- min-size (window-size window t pixelwise))))
-		    (when (and (> delta 0)
-			       (window--resizable-p
-				window delta t ignore nil nil nil pixelwise))
-		      (window-resize window delta t ignore pixelwise))))
-		;; Set dedicated status.
-		(set-window-dedicated-p window (cdr (assq 'dedicated state)))
-		;; Install positions (maybe we should do this after all
-		;; windows have been created and sized).
-		(ignore-errors
+                    ;; A fixed width window, try to restore the original
+                    ;; size.
+                    (let ((delta
+                           (- (cdr (assq
+                                    (if pixelwise 'pixel-width 'total-width)
+                                    item))
+                              (window-size window t pixelwise)))
+                          window-size-fixed)
+                      (when (window--resizable-p
+                             window delta t nil nil nil nil pixelwise)
+                        (window-resize window delta t nil pixelwise)))
+                  ;; Else check whether the window is not wide enough.
+                  (let* ((min-size (window-min-size window t ignore pixelwise))
+                         (delta (- min-size (window-size window t pixelwise))))
+                    (when (and (> delta 0)
+                               (window--resizable-p
+                                window delta t ignore nil nil nil pixelwise))
+                      (window-resize window delta t ignore pixelwise))))
+                ;; Set dedicated status.
+                (set-window-dedicated-p window (cdr (assq 'dedicated state)))
+                ;; Install positions (maybe we should do this after all
+                ;; windows have been created and sized).
+                (ignore-errors
                   ;; Set 'noforce argument to avoid that window start
                   ;; overrides window point set below (Bug#24240).
-		  (set-window-start window (cdr (assq 'start state)) 'noforce)
-		  (set-window-point window (cdr (assq 'point state))))
-		;; Select window if it's the selected one.
-		(when (cdr (assq 'selected state))
-		  (select-window window))
+                  (set-window-start window (cdr (assq 'start state)) 'noforce)
+                  (set-window-point window (cdr (assq 'point state))))
+                ;; Select window if it's the selected one.
+                (when (cdr (assq 'selected state))
+                  (select-window window))
                 (when next-buffers
                   (set-window-next-buffers
                    window
@@ -6183,12 +6183,12 @@ value can be also stored on disk and read back in a new session."
                                                    (set-marker (make-marker) m2
                                                                buffer))))))
                                      prev-buffers)))))
-	    ;; We don't want to raise an error in case the buffer does
-	    ;; not exist anymore, so we switch to a previous one and
-	    ;; save the window with the intention of deleting it later
-	    ;; if possible.
-	    (switch-to-prev-buffer window)
-	    (push window window-state-put-stale-windows)))))))
+            ;; We don't want to raise an error in case the buffer does
+            ;; not exist anymore, so we switch to a previous one and
+            ;; save the window with the intention of deleting it later
+            ;; if possible.
+            (switch-to-prev-buffer window)
+            (push window window-state-put-stale-windows)))))))
 
 (defun window-state-put (state &optional window ignore)
   "Put window state STATE into WINDOW.
@@ -6226,70 +6226,70 @@ windows can get as small as `window-safe-min-height' and
   (set-window-dedicated-p window nil)
 
   (let* ((frame (window-frame window))
-	 (head (car state))
-	 ;; We check here (1) whether the total sizes of root window of
-	 ;; STATE and that of WINDOW are equal so we can avoid
-	 ;; calculating new sizes, and (2) if we do have to resize
-	 ;; whether we can do so without violating size restrictions.
-	 (pixelwise (and (cdr (assq 'pixel-width state))
-			 (cdr (assq 'pixel-height state))))
-	 (totals (or (and pixelwise
-			  (= (window-pixel-width window)
-			     (cdr (assq 'pixel-width state)))
-			  (= (window-pixel-height window)
-			     (cdr (assq 'pixel-height state))))
-		     (and (= (window-total-width window)
-			     (cdr (assq 'total-width state)))
-			  (= (window-total-height window)
-			     (cdr (assq 'total-height state))))))
-	 (min-height (cdr (assq
-			   (if pixelwise 'min-pixel-height 'min-height)
-			   head)))
-	 (min-width (cdr (assq
-			  (if pixelwise 'min-pixel-width 'min-weight)
-			  head))))
+         (head (car state))
+         ;; We check here (1) whether the total sizes of root window of
+         ;; STATE and that of WINDOW are equal so we can avoid
+         ;; calculating new sizes, and (2) if we do have to resize
+         ;; whether we can do so without violating size restrictions.
+         (pixelwise (and (cdr (assq 'pixel-width state))
+                         (cdr (assq 'pixel-height state))))
+         (totals (or (and pixelwise
+                          (= (window-pixel-width window)
+                             (cdr (assq 'pixel-width state)))
+                          (= (window-pixel-height window)
+                             (cdr (assq 'pixel-height state))))
+                     (and (= (window-total-width window)
+                             (cdr (assq 'total-width state)))
+                          (= (window-total-height window)
+                             (cdr (assq 'total-height state))))))
+         (min-height (cdr (assq
+                           (if pixelwise 'min-pixel-height 'min-height)
+                           head)))
+         (min-width (cdr (assq
+                          (if pixelwise 'min-pixel-width 'min-weight)
+                          head))))
     (if (and (not totals)
-	     (or (> min-height (window-size window nil pixelwise))
-		 (> min-width (window-size window t pixelwise)))
-	     (or (not ignore)
-		 (and (setq min-height
-			    (cdr (assq
-				  (if pixelwise
-				      'min-pixel-height-ignore
-				    'min-height-ignore)
-				  head)))
-		      (setq min-width
-			    (cdr (assq
-				  (if pixelwise
-				      'min-pixel-width-ignore
-				    'min-width-ignore)
-				  head)))
-		      (or (> min-height
-			     (window-size window nil pixelwise))
-			  (> min-width
-			     (window-size window t pixelwise)))
-		      (or (not (eq ignore 'safe))
-			  (and (setq min-height
-				     (cdr (assq
-					   (if pixelwise
-					       'min-pixel-height-safe
-					     'min-height-safe)
-					   head)))
-			       (setq min-width
-				     (cdr (assq
-					   (if pixelwise
-					       'min-pixel-width-safe
-					     'min-width-safe)
-					   head)))
-			       (or (> min-height
-				      (window-size window nil pixelwise))
-				   (> min-width
-				      (window-size window t pixelwise))))))))
-	;; The check above might not catch all errors due to rounding
-	;; issues - so IGNORE equal 'safe might not always produce the
-	;; minimum possible state.  But such configurations hardly make
-	;; sense anyway.
-	(error "Window %s too small to accommodate state" window)
+             (or (> min-height (window-size window nil pixelwise))
+                 (> min-width (window-size window t pixelwise)))
+             (or (not ignore)
+                 (and (setq min-height
+                            (cdr (assq
+                                  (if pixelwise
+                                      'min-pixel-height-ignore
+                                    'min-height-ignore)
+                                  head)))
+                      (setq min-width
+                            (cdr (assq
+                                  (if pixelwise
+                                      'min-pixel-width-ignore
+                                    'min-width-ignore)
+                                  head)))
+                      (or (> min-height
+                             (window-size window nil pixelwise))
+                          (> min-width
+                             (window-size window t pixelwise)))
+                      (or (not (eq ignore 'safe))
+                          (and (setq min-height
+                                     (cdr (assq
+                                           (if pixelwise
+                                               'min-pixel-height-safe
+                                             'min-height-safe)
+                                           head)))
+                               (setq min-width
+                                     (cdr (assq
+                                           (if pixelwise
+                                               'min-pixel-width-safe
+                                             'min-width-safe)
+                                           head)))
+                               (or (> min-height
+                                      (window-size window nil pixelwise))
+                                   (> min-width
+                                      (window-size window t pixelwise))))))))
+        ;; The check above might not catch all errors due to rounding
+        ;; issues - so IGNORE equal 'safe might not always produce the
+        ;; minimum possible state.  But such configurations hardly make
+        ;; sense anyway.
+        (error "Window %s too small to accommodate state" window)
       (setq state (cdr state))
       (setq window-state-put-list nil)
       ;; Work on the windows of a temporary buffer to make sure that
@@ -6297,13 +6297,13 @@ windows can get as small as `window-safe-min-height' and
       ;; `window-size-fixed'.  Release that buffer after the buffers of
       ;; all live windows have been set by `window--state-put-2'.
       (with-temp-buffer
-	(set-window-buffer window (current-buffer))
-	(window--state-put-1 state window nil totals pixelwise)
-	(window--state-put-2 ignore pixelwise))
+        (set-window-buffer window (current-buffer))
+        (window--state-put-1 state window nil totals pixelwise)
+        (window--state-put-2 ignore pixelwise))
       (while window-state-put-stale-windows
-	(let ((window (pop window-state-put-stale-windows)))
-	  (when (eq (window-deletable-p window) t)
-	    (delete-window window))))
+        (let ((window (pop window-state-put-stale-windows)))
+          (when (eq (window-deletable-p window) t)
+            (delete-window window))))
       (window--check frame))))
 
 (defun window-state-buffers (state)
@@ -6409,30 +6409,30 @@ fourth element is BUFFER."
   (cond
    ((eq type 'reuse)
     (if (eq (window-buffer window) buffer)
-	;; WINDOW shows BUFFER already.  Update WINDOW's quit-restore
-	;; parameter, if any.
-	(let ((quit-restore (window-parameter window 'quit-restore)))
-	  (when (consp quit-restore)
-	    (setcar quit-restore 'same)
-	    ;; The selected-window might have changed in
-	    ;; between (Bug#20353).
-	    (unless (or (eq window (selected-window))
+        ;; WINDOW shows BUFFER already.  Update WINDOW's quit-restore
+        ;; parameter, if any.
+        (let ((quit-restore (window-parameter window 'quit-restore)))
+          (when (consp quit-restore)
+            (setcar quit-restore 'same)
+            ;; The selected-window might have changed in
+            ;; between (Bug#20353).
+            (unless (or (eq window (selected-window))
                         (eq window (nth 2 quit-restore)))
-	      (setcar (cddr quit-restore) (selected-window)))))
+              (setcar (cddr quit-restore) (selected-window)))))
       ;; WINDOW shows another buffer.
       (with-current-buffer (window-buffer window)
-	(set-window-parameter
-	 window 'quit-restore
-	 (list 'other
-	       ;; A quadruple of WINDOW's buffer, start, point and height.
-	       (list (current-buffer) (window-start window)
-		     ;; Preserve window-point-insertion-type (Bug#12855).
-		     (copy-marker
-		      (window-point window) window-point-insertion-type)
-		     (if (window-combined-p window)
+        (set-window-parameter
+         window 'quit-restore
+         (list 'other
+               ;; A quadruple of WINDOW's buffer, start, point and height.
+               (list (current-buffer) (window-start window)
+                     ;; Preserve window-point-insertion-type (Bug#12855).
+                     (copy-marker
+                      (window-point window) window-point-insertion-type)
+                     (if (window-combined-p window)
                          (window-total-height window)
                        (window-total-width window)))
-	       (selected-window) buffer)))))
+               (selected-window) buffer)))))
    ((eq type 'window)
     ;; WINDOW has been created on an existing frame.
     (set-window-parameter
@@ -6460,12 +6460,12 @@ The specified function should call `display-buffer-record-window'
 with corresponding arguments to set up the quit-restore parameter
 of the window used."
   :type '(choice
-	  (const nil)
-	  (function :tag "function"))
+          (const nil)
+          (function :tag "function"))
   :group 'windows)
 
 (make-obsolete-variable 'display-buffer-function
-			'display-buffer-alist "24.3")
+                        'display-buffer-alist "24.3")
 
 ;; Eventually, we want to turn this into a defvar; instead of
 ;; customizing this, the user should use a `pop-up-frame-parameters'
@@ -6481,8 +6481,8 @@ the automatic generation of new frames via `display-buffer' and
 all functions based on it.  The behavior of `make-frame' is not
 affected by this variable."
   :type '(repeat (cons :format "%v"
-		       (symbol :tag "Parameter")
-		       (sexp :tag "Value")))
+                       (symbol :tag "Parameter")
+                       (sexp :tag "Value")))
   :group 'frames)
 
 (defcustom pop-up-frame-function
@@ -6539,23 +6539,23 @@ this one.
 
 See also `special-display-regexps'."
   :type '(repeat
-	  (choice :tag "Buffer"
-		  :value ""
-		  (string :format "%v")
-		  (cons :tag "With parameters"
-			:format "%v"
-			:value ("" . nil)
-			(string :format "%v")
-			(repeat :tag "Parameters"
-				(cons :format "%v"
-				      (symbol :tag "Parameter")
-				      (sexp :tag "Value"))))
-		  (list :tag "With function"
-			:format "%v"
-			:value ("" . nil)
-			(string :format "%v")
-			(function :tag "Function")
-			(repeat :tag "Arguments" (sexp)))))
+          (choice :tag "Buffer"
+                  :value ""
+                  (string :format "%v")
+                  (cons :tag "With parameters"
+                        :format "%v"
+                        :value ("" . nil)
+                        (string :format "%v")
+                        (repeat :tag "Parameters"
+                                (cons :format "%v"
+                                      (symbol :tag "Parameter")
+                                      (sexp :tag "Value"))))
+                  (list :tag "With function"
+                        :format "%v"
+                        :value ("" . nil)
+                        (string :format "%v")
+                        (function :tag "Function")
+                        (repeat :tag "Arguments" (sexp)))))
   :group 'windows
   :group 'frames)
 (make-obsolete-variable 'special-display-buffer-names 'display-buffer-alist "24.3")
@@ -6606,23 +6606,23 @@ this one.
 
 See also `special-display-buffer-names'."
   :type '(repeat
-	  (choice :tag "Buffer"
-		  :value ""
-		  (regexp :format "%v")
-		  (cons :tag "With parameters"
-			:format "%v"
-			:value ("" . nil)
-			(regexp :format "%v")
-			(repeat :tag "Parameters"
-				(cons :format "%v"
-				      (symbol :tag "Parameter")
-				      (sexp :tag "Value"))))
-		  (list :tag "With function"
-			:format "%v"
-			:value ("" . nil)
-			(regexp :format "%v")
-			(function :tag "Function")
-			(repeat :tag "Arguments" (sexp)))))
+          (choice :tag "Buffer"
+                  :value ""
+                  (regexp :format "%v")
+                  (cons :tag "With parameters"
+                        :format "%v"
+                        :value ("" . nil)
+                        (regexp :format "%v")
+                        (repeat :tag "Parameters"
+                                (cons :format "%v"
+                                      (symbol :tag "Parameter")
+                                      (sexp :tag "Value"))))
+                  (list :tag "With function"
+                        :format "%v"
+                        :value ("" . nil)
+                        (regexp :format "%v")
+                        (function :tag "Function")
+                        (repeat :tag "Arguments" (sexp)))))
   :group 'windows
   :group 'frames)
 (make-obsolete-variable 'special-display-regexps 'display-buffer-alist "24.3")
@@ -6643,14 +6643,14 @@ entry."
      ((setq tmp (assoc buffer-name special-display-buffer-names))
       (cdr tmp))
      ((catch 'found
-	(dolist (regexp special-display-regexps)
-	  (cond
-	   ((stringp regexp)
-	    (when (string-match-p regexp buffer-name)
-	      (throw 'found t)))
-	   ((and (consp regexp) (stringp (car regexp))
-		 (string-match-p (car regexp) buffer-name))
-	    (throw 'found (cdr regexp))))))))))
+        (dolist (regexp special-display-regexps)
+          (cond
+           ((stringp regexp)
+            (when (string-match-p regexp buffer-name)
+              (throw 'found t)))
+           ((and (consp regexp) (stringp (car regexp))
+                 (string-match-p (car regexp) buffer-name))
+            (throw 'found (cdr regexp))))))))))
 
 (defcustom special-display-frame-alist
   '((height . 14) (width . 80) (unsplittable . t))
@@ -6665,8 +6665,8 @@ This variable can be set in your init file, like this:
 
 These supersede the values given in `default-frame-alist'."
   :type '(repeat (cons :format "%v"
-			 (symbol :tag "Parameter")
-			 (sexp :tag "Value")))
+                       (symbol :tag "Parameter")
+                       (sexp :tag "Value")))
   :group 'frames)
 (make-obsolete-variable 'special-display-frame-alist 'display-buffer-alist "24.3")
 
@@ -6692,33 +6692,33 @@ pass the elements of (cdr ARGS) as the remaining arguments."
       (or
        ;; If we have a window already, make it visible.
        (when window
-	 (let ((frame (window-frame window)))
-	   (make-frame-visible frame)
-	   (raise-frame frame)
-	   (display-buffer-record-window 'reuse window buffer)
-	   window))
+         (let ((frame (window-frame window)))
+           (make-frame-visible frame)
+           (raise-frame frame)
+           (display-buffer-record-window 'reuse window buffer)
+           window))
        ;; Reuse the current window if the user requested it.
        (when (cdr (assq 'same-window args))
-	 (condition-case nil
-	     (progn (switch-to-buffer buffer nil t) (selected-window))
-	   (error nil)))
+         (condition-case nil
+             (progn (switch-to-buffer buffer nil t) (selected-window))
+           (error nil)))
        ;; Stay on the same frame if requested.
        (when (or (cdr (assq 'same-frame args)) (cdr (assq 'same-window args)))
-	 (let* ((pop-up-windows t)
-		pop-up-frames
-		special-display-buffer-names special-display-regexps)
-	   (display-buffer buffer)))
+         (let* ((pop-up-windows t)
+                pop-up-frames
+                special-display-buffer-names special-display-regexps)
+           (display-buffer buffer)))
        ;; If no window yet, make one in a new frame.
        (let* ((frame
-	       (with-current-buffer buffer
-		 (make-frame (append args special-display-frame-alist))))
-	      (window (frame-selected-window frame)))
-	 (display-buffer-record-window 'frame window buffer)
-	 (unless (eq buffer (window-buffer window))
-	   (set-window-buffer window buffer)
-	   (set-window-prev-buffers window nil))
-	 (set-window-dedicated-p window t)
-	 window)))))
+               (with-current-buffer buffer
+                 (make-frame (append args special-display-frame-alist))))
+              (window (frame-selected-window frame)))
+         (display-buffer-record-window 'frame window buffer)
+         (unless (eq buffer (window-buffer window))
+           (set-window-buffer window buffer)
+           (set-window-prev-buffers window nil))
+         (set-window-dedicated-p window t)
+         window)))))
 
 (defcustom special-display-function 'special-display-popup-frame
   "Function to call for displaying special buffers.
@@ -6752,8 +6752,8 @@ the buffer name.  This is for compatibility with
 ignored.
 
 See also `same-window-regexps'."
- :type '(repeat (string :format "%v"))
- :group 'windows)
+  :type '(repeat (string :format "%v"))
+  :group 'windows)
 
 (defcustom same-window-regexps nil
   "List of regexps saying which buffers should appear in the \"same\" window.
@@ -6784,13 +6784,13 @@ selected rather than (as usual) some other window.  See
    ((assoc buffer-name same-window-buffer-names))
    ((catch 'found
       (dolist (regexp same-window-regexps)
-	;; The elements of `same-window-regexps' can be regexps
-	;; or cons cells whose cars are regexps.
-	(when (or (and (stringp regexp)
-		       (string-match-p regexp buffer-name))
-		  (and (consp regexp) (stringp (car regexp))
-		       (string-match-p (car regexp) buffer-name)))
-	  (throw 'found t)))))))
+        ;; The elements of `same-window-regexps' can be regexps
+        ;; or cons cells whose cars are regexps.
+        (when (or (and (stringp regexp)
+                       (string-match-p regexp buffer-name))
+                  (and (consp regexp) (stringp (car regexp))
+                       (string-match-p (car regexp) buffer-name)))
+          (throw 'found t)))))))
 
 (defcustom pop-up-frames nil
   "Whether `display-buffer' should make a separate frame.
@@ -6799,9 +6799,9 @@ If the value is `graphic-only', make a separate frame
 on graphic displays only.
 Any other non-nil value means always make a separate frame."
   :type '(choice
-	  (const :tag "Never" nil)
-	  (const :tag "On graphic displays only" graphic-only)
-	  (const :tag "Always" t))
+          (const :tag "Never" nil)
+          (const :tag "On graphic displays only" graphic-only)
+          (const :tag "Always" t))
   :group 'windows)
 
 (defcustom display-buffer-reuse-frames nil
@@ -6901,28 +6901,28 @@ hold:
              (not (window-parameter window 'window-side)))
     (with-current-buffer (window-buffer window)
       (if horizontal
-	  ;; A window can be split horizontally when its width is not
-	  ;; fixed, it is at least `split-width-threshold' columns wide
-	  ;; and at least twice as wide as `window-min-width' and 2 (the
-	  ;; latter value is hardcoded).
-	  (and (memq window-size-fixed '(nil height))
-	       ;; Testing `window-full-width-p' here hardly makes any
-	       ;; sense nowadays.  This can be done more intuitively by
-	       ;; setting up `split-width-threshold' appropriately.
-	       (numberp split-width-threshold)
-	       (>= (window-width window)
-		   (max split-width-threshold
-			(* 2 (max window-min-width 2)))))
-	;; A window can be split vertically when its height is not
-	;; fixed, it is at least `split-height-threshold' lines high,
-	;; and it is at least twice as high as `window-min-height' and 2
-	;; if it has a mode line or 1.
-	(and (memq window-size-fixed '(nil width))
-	     (numberp split-height-threshold)
-	     (>= (window-height window)
-		 (max split-height-threshold
-		      (* 2 (max window-min-height
-				(if mode-line-format 2 1))))))))))
+          ;; A window can be split horizontally when its width is not
+          ;; fixed, it is at least `split-width-threshold' columns wide
+          ;; and at least twice as wide as `window-min-width' and 2 (the
+          ;; latter value is hardcoded).
+          (and (memq window-size-fixed '(nil height))
+               ;; Testing `window-full-width-p' here hardly makes any
+               ;; sense nowadays.  This can be done more intuitively by
+               ;; setting up `split-width-threshold' appropriately.
+               (numberp split-width-threshold)
+               (>= (window-width window)
+                   (max split-width-threshold
+                        (* 2 (max window-min-width 2)))))
+        ;; A window can be split vertically when its height is not
+        ;; fixed, it is at least `split-height-threshold' lines high,
+        ;; and it is at least twice as high as `window-min-height' and 2
+        ;; if it has a mode line or 1.
+        (and (memq window-size-fixed '(nil width))
+             (numberp split-height-threshold)
+             (>= (window-height window)
+                 (max split-height-threshold
+                      (* 2 (max window-min-height
+                                (if mode-line-format 2 1))))))))))
 
 (defun split-window-sensibly (&optional window)
   "Split WINDOW in a way suitable for `display-buffer'.
@@ -6958,14 +6958,14 @@ know how `split-window-sensibly' determines whether WINDOW can be
 split."
   (let ((window (or window (selected-window))))
     (or (and (window-splittable-p window)
-	     ;; Split window vertically.
-	     (with-selected-window window
-	       (split-window-below)))
-	(and (window-splittable-p window t)
-	     ;; Split window horizontally.
-	     (with-selected-window window
-	       (split-window-right)))
-	(and
+             ;; Split window vertically.
+             (with-selected-window window
+               (split-window-below)))
+        (and (window-splittable-p window t)
+             ;; Split window horizontally.
+             (with-selected-window window
+               (split-window-right)))
+        (and
          ;; If WINDOW is the only usable window on its frame (it is
          ;; the only one or, not being the only one, all the other
          ;; ones are dedicated) and is not the minibuffer window, try
@@ -6981,37 +6981,37 @@ split."
                                     (throw 'done nil)))
                                 frame nil 'nomini)
               t)))
-	 (not (window-minibuffer-p window))
-	 (let ((split-height-threshold 0))
-	   (when (window-splittable-p window)
-	     (with-selected-window window
-	       (split-window-below))))))))
+         (not (window-minibuffer-p window))
+         (let ((split-height-threshold 0))
+           (when (window-splittable-p window)
+             (with-selected-window window
+               (split-window-below))))))))
 
 (defun window--try-to-split-window (window &optional alist)
   "Try to split WINDOW.
 Return value returned by `split-window-preferred-function' if it
 represents a live window, nil otherwise."
-      (and (window-live-p window)
-	   (not (frame-parameter (window-frame window) 'unsplittable))
-	   (let* ((window-combination-limit
-		   ;; When `window-combination-limit' equals
-		   ;; `display-buffer' or equals `resize-window' and a
-		   ;; `window-height' or `window-width' alist entry are
-		   ;; present, bind it to t so resizing steals space
-		   ;; preferably from the window that was split.
-		   (if (or (eq window-combination-limit 'display-buffer)
-			   (and (eq window-combination-limit 'window-size)
-				(or (cdr (assq 'window-height alist))
-				    (cdr (assq 'window-width alist)))))
-		       t
-		     window-combination-limit))
-		  (new-window
-		   ;; Since `split-window-preferred-function' might
-		   ;; throw an error use `condition-case'.
-		   (condition-case nil
-		       (funcall split-window-preferred-function window)
-		     (error nil))))
-	     (and (window-live-p new-window) new-window))))
+  (and (window-live-p window)
+       (not (frame-parameter (window-frame window) 'unsplittable))
+       (let* ((window-combination-limit
+               ;; When `window-combination-limit' equals
+               ;; `display-buffer' or equals `resize-window' and a
+               ;; `window-height' or `window-width' alist entry are
+               ;; present, bind it to t so resizing steals space
+               ;; preferably from the window that was split.
+               (if (or (eq window-combination-limit 'display-buffer)
+                       (and (eq window-combination-limit 'window-size)
+                            (or (cdr (assq 'window-height alist))
+                                (cdr (assq 'window-width alist)))))
+                   t
+                 window-combination-limit))
+              (new-window
+               ;; Since `split-window-preferred-function' might
+               ;; throw an error use `condition-case'.
+               (condition-case nil
+                   (funcall split-window-preferred-function window)
+                 (error nil))))
+         (and (window-live-p new-window) new-window))))
 
 (defun window--frame-usable-p (frame)
   "Return FRAME if it can be used to display a buffer."
@@ -7029,7 +7029,7 @@ represents a live window, nil otherwise."
                        ;; when displaying same-frame windows.
                        nil ; (eq t (window-dedicated-p window))
                        ))
-	frame))))
+        frame))))
 
 (defvaralias 'even-window-heights 'even-window-sizes)
 (defcustom even-window-sizes t
@@ -7039,10 +7039,10 @@ alone.  Special values are `height-only' to even heights only and
 `width-only' to even widths only.  Any other value means to even
 any of them."
   :type '(choice
-	  (const :tag "Never" nil)
-	  (const :tag "Side-by-side windows only" width-only)
-	  (const :tag "Windows above or below only" height-only)
-	  (const :tag "Always" t))
+          (const :tag "Never" nil)
+          (const :tag "Side-by-side windows only" width-only)
+          (const :tag "Windows above or below only" height-only)
+          (const :tag "Always" t))
   :version "25.1"
   :group 'windows)
 
@@ -7123,76 +7123,76 @@ Return WINDOW if BUFFER and WINDOW are live."
         (funcall (cdr (assq 'body-function alist)) window)))
 
     (let ((quit-restore (window-parameter window 'quit-restore))
-	  (height (cdr (assq 'window-height alist)))
-	  (width (cdr (assq 'window-width alist)))
-	  (size (cdr (assq 'window-size alist)))
-	  (preserve-size (cdr (assq 'preserve-size alist))))
+          (height (cdr (assq 'window-height alist)))
+          (width (cdr (assq 'window-width alist)))
+          (size (cdr (assq 'window-size alist)))
+          (preserve-size (cdr (assq 'preserve-size alist))))
       (cond
        ((or (eq type 'frame)
-	    (and (eq (car quit-restore) 'same)
-		 (eq (nth 1 quit-restore) 'frame)))
-	;; A window that never showed another buffer but BUFFER ever
+            (and (eq (car quit-restore) 'same)
+                 (eq (nth 1 quit-restore) 'frame)))
+        ;; A window that never showed another buffer but BUFFER ever
         ;; since it was created on a new frame.
         ;;
         ;; Adjust size of frame if asked for.  We probably should do
         ;; that only for a single window frame.
-	(cond
-	 ((not size))
-	 ((consp size)
-	  (let ((width (car size))
-		(height (cdr size))
-		(frame (window-frame window)))
-	    (when (and (numberp width) (numberp height))
-	      (set-frame-height
-	       frame (+ (frame-height frame)
-			(- height (window-total-height window))))
-	      (set-frame-width
-	       frame (+ (frame-width frame)
-			(- width (window-total-width window)))))))
-	 ((functionp size)
-	  (ignore-errors (funcall size window)))))
+        (cond
+         ((not size))
+         ((consp size)
+          (let ((width (car size))
+                (height (cdr size))
+                (frame (window-frame window)))
+            (when (and (numberp width) (numberp height))
+              (set-frame-height
+               frame (+ (frame-height frame)
+                        (- height (window-total-height window))))
+              (set-frame-width
+               frame (+ (frame-width frame)
+                        (- width (window-total-width window)))))))
+         ((functionp size)
+          (ignore-errors (funcall size window)))))
        ((or (eq type 'window)
-	    (and (eq (car quit-restore) 'same)
-		 (eq (nth 1 quit-restore) 'window)))
-	;; A window that never showed another buffer but BUFFER ever
+            (and (eq (car quit-restore) 'same)
+                 (eq (nth 1 quit-restore) 'window)))
+        ;; A window that never showed another buffer but BUFFER ever
         ;; since it was created on an existing frame.
         ;;
         ;; Adjust width and/or height of window if asked for.
-	(cond
-	 ((not height))
-	 ((numberp height)
-	  (let* ((new-height
-		  (if (integerp height)
-		      height
-		    (round
-		     (* (window-total-height (frame-root-window window))
-			height))))
-		 (delta (- new-height (window-total-height window))))
-	    (when (and (window--resizable-p window delta nil 'safe)
-		       (window-combined-p window))
-	      (window-resize window delta nil 'safe))))
-	 ((functionp height)
-	  (ignore-errors (funcall height window))))
-	;; Adjust width of window if asked for.
-	(cond
-	 ((not width))
-	 ((numberp width)
-	  (let* ((new-width
-		  (if (integerp width)
-		      width
-		    (round
-		     (* (window-total-width (frame-root-window window))
-			width))))
-		 (delta (- new-width (window-total-width window))))
-	    (when (and (window--resizable-p window delta t 'safe)
-		       (window-combined-p window t))
-	      (window-resize window delta t 'safe))))
-	 ((functionp width)
-	  (ignore-errors (funcall width window))))
-	;; Preserve window size if asked for.
-	(when (consp preserve-size)
-	  (window-preserve-size window t (car preserve-size))
-	  (window-preserve-size window nil (cdr preserve-size)))))
+        (cond
+         ((not height))
+         ((numberp height)
+          (let* ((new-height
+                  (if (integerp height)
+                      height
+                    (round
+                     (* (window-total-height (frame-root-window window))
+                        height))))
+                 (delta (- new-height (window-total-height window))))
+            (when (and (window--resizable-p window delta nil 'safe)
+                       (window-combined-p window))
+              (window-resize window delta nil 'safe))))
+         ((functionp height)
+          (ignore-errors (funcall height window))))
+        ;; Adjust width of window if asked for.
+        (cond
+         ((not width))
+         ((numberp width)
+          (let* ((new-width
+                  (if (integerp width)
+                      width
+                    (round
+                     (* (window-total-width (frame-root-window window))
+                        width))))
+                 (delta (- new-width (window-total-width window))))
+            (when (and (window--resizable-p window delta t 'safe)
+                       (window-combined-p window t))
+              (window-resize window delta t 'safe))))
+         ((functionp width)
+          (ignore-errors (funcall width window))))
+        ;; Preserve window size if asked for.
+        (when (consp preserve-size)
+          (window-preserve-size window t (car preserve-size))
+          (window-preserve-size window nil (cdr preserve-size)))))
       ;; Assign any window parameters specified.
       (let ((parameters (cdr (assq 'window-parameters alist))))
         (dolist (parameter parameters)
@@ -7206,11 +7206,11 @@ Return WINDOW if BUFFER and WINDOW are live."
               ;; Don't raise frames that should not get focus.
               (frame-parameter frame 'no-accept-focus)
               ;; Assume the selected frame is already visible enough.
-	      (eq frame (selected-frame))
-	      ;; Assume the frame from which we invoked the
-	      ;; minibuffer is visible.
-	      (and (minibuffer-window-active-p (selected-window))
-		   (eq frame (window-frame (minibuffer-selected-window)))))
+              (eq frame (selected-frame))
+              ;; Assume the frame from which we invoked the
+              ;; minibuffer is visible.
+              (and (minibuffer-window-active-p (selected-window))
+                   (eq frame (window-frame (minibuffer-selected-window)))))
     (raise-frame frame)))
 
 ;; FIXME: Not implemented.
@@ -7226,30 +7226,30 @@ The actual non-nil value of this variable will be copied to the
 
 (defconst display-buffer--action-function-custom-type
   '(choice :tag "Function"
-	   (const :tag "--" ignore) ; default for insertion
-	   (const display-buffer-reuse-window)
-	   (const display-buffer-pop-up-window)
-	   (const display-buffer-same-window)
-	   (const display-buffer-pop-up-frame)
-	   (const display-buffer-in-child-frame)
-	   (const display-buffer-below-selected)
-	   (const display-buffer-at-bottom)
-	   (const display-buffer-in-previous-window)
-	   (const display-buffer-use-some-window)
-	   (const display-buffer-use-some-frame)
-	   (function :tag "Other function"))
+           (const :tag "--" ignore) ; default for insertion
+           (const display-buffer-reuse-window)
+           (const display-buffer-pop-up-window)
+           (const display-buffer-same-window)
+           (const display-buffer-pop-up-frame)
+           (const display-buffer-in-child-frame)
+           (const display-buffer-below-selected)
+           (const display-buffer-at-bottom)
+           (const display-buffer-in-previous-window)
+           (const display-buffer-use-some-window)
+           (const display-buffer-use-some-frame)
+           (function :tag "Other function"))
   "Custom type for `display-buffer' action functions.")
 
 (defconst display-buffer--action-custom-type
   `(cons :tag "Action"
-	 (choice :tag "Action functions"
-		 ,display-buffer--action-function-custom-type
-		 (repeat
-		  :tag "List of functions"
-		  ,display-buffer--action-function-custom-type))
-	 (alist :tag "Action arguments"
-		:key-type symbol
-		:value-type (sexp :tag "Value")))
+         (choice :tag "Action functions"
+                 ,display-buffer--action-function-custom-type
+                 (repeat
+                  :tag "List of functions"
+                  ,display-buffer--action-function-custom-type))
+         (alist :tag "Action arguments"
+                :key-type symbol
+                :value-type (sexp :tag "Value")))
   "Custom type for `display-buffer' actions.")
 
 (defvar display-buffer-overriding-action '(nil . nil)
@@ -7294,10 +7294,10 @@ matching regular expression or the function specified by a
 condition returns non-nil.  In any of these cases, it adds the
 associated action to the list of actions it will try."
   :type `(alist :key-type
-		(choice :tag "Condition"
-			regexp
-			(function :tag "Matcher function"))
-		:value-type ,display-buffer--action-custom-type)
+                (choice :tag "Condition"
+                        regexp
+                        (function :tag "Matcher function"))
+                :value-type ,display-buffer--action-custom-type)
   :risky t
   :version "24.1"
   :group 'windows)
@@ -7345,11 +7345,11 @@ action argument passed to `display-buffer'."
   (catch 'match
     (dolist (entry alist)
       (let ((key (car entry)))
-	(when (or (and (stringp key)
-		       (string-match-p key buffer-name))
-		  (and (functionp key)
-		       (funcall key buffer-name action)))
-	  (throw 'match (cdr entry)))))))
+        (when (or (and (stringp key)
+                       (string-match-p key buffer-name))
+                  (and (functionp key)
+                       (funcall key buffer-name action)))
+          (throw 'match (cdr entry)))))))
 
 (defvar display-buffer--same-window-action
   '(display-buffer-same-window
@@ -7470,48 +7470,48 @@ The optional third argument FRAME, if non-nil, acts like a
 \(reusable-frames . FRAME) entry appended to the action alist
 specified by the ACTION argument."
   (interactive (list (read-buffer "Display buffer: " (other-buffer))
-		     (if current-prefix-arg t)))
+                     (if current-prefix-arg t)))
   (let ((buffer (if (bufferp buffer-or-name)
-		    buffer-or-name
-		  (get-buffer buffer-or-name)))
-	;; Make sure that when we split windows the old window keeps
-	;; point, bug#14829.
-	(split-window-keep-point t)
-	;; Handle the old form of the first argument.
-	(inhibit-same-window (and action (not (listp action)))))
+                    buffer-or-name
+                  (get-buffer buffer-or-name)))
+        ;; Make sure that when we split windows the old window keeps
+        ;; point, bug#14829.
+        (split-window-keep-point t)
+        ;; Handle the old form of the first argument.
+        (inhibit-same-window (and action (not (listp action)))))
     (unless (listp action) (setq action nil))
     (if display-buffer-function
-	;; If `display-buffer-function' is defined, let it do the job.
-	(funcall display-buffer-function buffer inhibit-same-window)
+        ;; If `display-buffer-function' is defined, let it do the job.
+        (funcall display-buffer-function buffer inhibit-same-window)
       ;; Otherwise, use the defined actions.
       (let* ((user-action
-	      (display-buffer-assq-regexp
-	       (buffer-name buffer) display-buffer-alist action))
+              (display-buffer-assq-regexp
+               (buffer-name buffer) display-buffer-alist action))
              (special-action (display-buffer--special-action buffer))
-	     ;; Extra actions from the arguments to this function:
-	     (extra-action
-	      (cons nil (append (if inhibit-same-window
-				    '((inhibit-same-window . t)))
-				(if frame
-				    `((reusable-frames . ,frame))))))
-	     ;; Construct action function list and action alist.
-	     (actions (list display-buffer-overriding-action
-			    user-action special-action action extra-action
-			    display-buffer-base-action
-			    display-buffer-fallback-action))
-	     (functions (apply 'append
-			       (mapcar (lambda (x)
-					 (setq x (car x))
-					 (if (functionp x) (list x) x))
-				       actions)))
-	     (alist (apply 'append (mapcar 'cdr actions)))
-	     window)
-	(unless (buffer-live-p buffer)
-	  (error "Invalid buffer"))
-	(while (and functions (not window))
-	  (setq window (funcall (car functions) buffer alist)
-	  	functions (cdr functions)))
-	(and (windowp window) window)))))
+             ;; Extra actions from the arguments to this function:
+             (extra-action
+              (cons nil (append (if inhibit-same-window
+                                    '((inhibit-same-window . t)))
+                                (if frame
+                                    `((reusable-frames . ,frame))))))
+             ;; Construct action function list and action alist.
+             (actions (list display-buffer-overriding-action
+                            user-action special-action action extra-action
+                            display-buffer-base-action
+                            display-buffer-fallback-action))
+             (functions (apply 'append
+                               (mapcar (lambda (x)
+                                         (setq x (car x))
+                                         (if (functionp x) (list x) x))
+                                       actions)))
+             (alist (apply 'append (mapcar 'cdr actions)))
+             window)
+        (unless (buffer-live-p buffer)
+          (error "Invalid buffer"))
+        (while (and functions (not window))
+          (setq window (funcall (car functions) buffer alist)
+                functions (cdr functions)))
+        (and (windowp window) window)))))
 
 (defun display-buffer-other-frame (buffer)
   "Display buffer BUFFER preferably in another frame.
@@ -7579,8 +7579,8 @@ node `(elisp) Buffer Display Action Functions'.  It should be
 called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (unless (or (cdr (assq 'inhibit-same-window alist))
-	      (window-minibuffer-p)
-	      (window-dedicated-p))
+              (window-minibuffer-p)
+              (window-dedicated-p))
     (window--display-buffer buffer (selected-window) 'reuse alist)))
 
 (defun display-buffer--maybe-same-window (buffer alist)
@@ -7629,16 +7629,16 @@ node `(elisp) Buffer Display Action Functions'.  It should be
 called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (let* ((alist-entry (assq 'reusable-frames alist))
-	 (frames (cond (alist-entry (cdr alist-entry))
-		       ((if (eq pop-up-frames 'graphic-only)
-			    (display-graphic-p)
-			  pop-up-frames)
-			0)
-		       (display-buffer-reuse-frames 0)
-		       (t (last-nonminibuffer-frame))))
-	 (window (if (and (eq buffer (window-buffer))
-			  (not (cdr (assq 'inhibit-same-window alist))))
-		     (selected-window)
+         (frames (cond (alist-entry (cdr alist-entry))
+                       ((if (eq pop-up-frames 'graphic-only)
+                            (display-graphic-p)
+                          pop-up-frames)
+                        0)
+                       (display-buffer-reuse-frames 0)
+                       (t (last-nonminibuffer-frame))))
+         (window (if (and (eq buffer (window-buffer))
+                          (not (cdr (assq 'inhibit-same-window alist))))
+                     (selected-window)
                    ;; Preferably use a window on the selected frame,
                    ;; if such a window exists (Bug#36680).
                    (let* ((windows (delq (selected-window)
@@ -7656,8 +7656,8 @@ indirectly called by the latter."
                       (t first))))))
     (when (window-live-p window)
       (prog1 (window--display-buffer buffer window 'reuse alist)
-	(unless (cdr (assq 'inhibit-switch-frame alist))
-	  (window--maybe-raise-frame (window-frame window)))))))
+        (unless (cdr (assq 'inhibit-switch-frame alist))
+          (window--maybe-raise-frame (window-frame window)))))))
 
 (defun display-buffer-reuse-mode-window (buffer alist)
   "Return a window based on the mode of the buffer it displays.
@@ -7685,15 +7685,15 @@ called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (let* ((alist-entry (assq 'reusable-frames alist))
          (alist-mode-entry (assq 'mode alist))
-	 (frames (cond (alist-entry (cdr alist-entry))
-		       ((if (eq pop-up-frames 'graphic-only)
-			    (display-graphic-p)
-			  pop-up-frames)
-			0)
-		       (display-buffer-reuse-frames 0)
-		       (t (last-nonminibuffer-frame))))
+         (frames (cond (alist-entry (cdr alist-entry))
+                       ((if (eq pop-up-frames 'graphic-only)
+                            (display-graphic-p)
+                          pop-up-frames)
+                        0)
+                       (display-buffer-reuse-frames 0)
+                       (t (last-nonminibuffer-frame))))
          (inhibit-same-window-p (cdr (assq 'inhibit-same-window alist)))
-	 (windows (window-list-1 nil 'nomini frames))
+         (windows (window-list-1 nil 'nomini frames))
          (buffer-mode (with-current-buffer buffer major-mode))
          (allowed-modes (if alist-mode-entry
                             (cdr alist-mode-entry)
@@ -7741,7 +7741,7 @@ See `display-buffer' for the format of display actions."
        ;; `special-display-p' returns either t or a list of frame
        ;; parameters to pass to `special-display-function'.
        (let ((pars (special-display-p (buffer-name buffer))))
-	 (when pars
+         (when pars
            (list (list #'display-buffer-reuse-window
                        (lambda (buffer _alist)
                          (funcall special-display-function
@@ -7765,18 +7765,18 @@ node `(elisp) Buffer Display Action Functions'.  It should be
 called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (let* ((params (cdr (assq 'pop-up-frame-parameters alist)))
-	 (pop-up-frame-alist (append params pop-up-frame-alist))
-	 (fun pop-up-frame-function)
-	 frame window)
+         (pop-up-frame-alist (append params pop-up-frame-alist))
+         (fun pop-up-frame-function)
+         frame window)
     (when (and fun
-	       ;; Make BUFFER current so `make-frame' will use it as the
-	       ;; new frame's buffer (Bug#15133).
-	       (with-current-buffer buffer
-		 (setq frame (funcall fun)))
-	       (setq window (frame-selected-window frame)))
+               ;; Make BUFFER current so `make-frame' will use it as the
+               ;; new frame's buffer (Bug#15133).
+               (with-current-buffer buffer
+                 (setq frame (funcall fun)))
+               (setq window (frame-selected-window frame)))
       (prog1 (window--display-buffer buffer window 'frame alist)
-	(unless (cdr (assq 'inhibit-switch-frame alist))
-	  (window--maybe-raise-frame frame))))))
+        (unless (cdr (assq 'inhibit-switch-frame alist))
+          (window--maybe-raise-frame frame))))))
 
 (defun display-buffer-pop-up-window (buffer alist)
   "Display BUFFER by popping up a new window.
@@ -7797,24 +7797,24 @@ node `(elisp) Buffer Display Action Functions'.  It should be
 called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (let ((frame (or (window--frame-usable-p (selected-frame))
-		   (window--frame-usable-p (last-nonminibuffer-frame))))
-	window)
+                   (window--frame-usable-p (last-nonminibuffer-frame))))
+        window)
     (when (and (or (not (frame-parameter frame 'unsplittable))
-		   ;; If the selected frame cannot be split, look at
-		   ;; `last-nonminibuffer-frame'.
-		   (and (eq frame (selected-frame))
-			(setq frame (last-nonminibuffer-frame))
-			(window--frame-usable-p frame)
-			(not (frame-parameter frame 'unsplittable))))
-	       ;; Attempt to split largest or least recently used window.
-	       (setq window (or (window--try-to-split-window
-				 (get-largest-window frame t) alist)
-				(window--try-to-split-window
-				 (get-lru-window frame t) alist))))
+                   ;; If the selected frame cannot be split, look at
+                   ;; `last-nonminibuffer-frame'.
+                   (and (eq frame (selected-frame))
+                        (setq frame (last-nonminibuffer-frame))
+                        (window--frame-usable-p frame)
+                        (not (frame-parameter frame 'unsplittable))))
+               ;; Attempt to split largest or least recently used window.
+               (setq window (or (window--try-to-split-window
+                                 (get-largest-window frame t) alist)
+                                (window--try-to-split-window
+                                 (get-lru-window frame t) alist))))
 
       (prog1 (window--display-buffer buffer window 'window alist)
-	(unless (cdr (assq 'inhibit-switch-frame alist))
-	  (window--maybe-raise-frame (window-frame window)))))))
+        (unless (cdr (assq 'inhibit-switch-frame alist))
+          (window--maybe-raise-frame (window-frame window)))))))
 
 (defun display-buffer--maybe-pop-up-frame-or-window (buffer alist)
   "Try displaying BUFFER based on `pop-up-frames' or `pop-up-windows'.
@@ -7838,8 +7838,8 @@ ALIST is an association list of action symbols and values.  See
 Info node `(elisp) Buffer Display Action Alists' for details of
 such alists."
   (and (if (eq pop-up-frames 'graphic-only)
-	   (display-graphic-p)
-	 pop-up-frames)
+           (display-graphic-p)
+         pop-up-frames)
        (display-buffer-pop-up-frame buffer alist)))
 
 (defun display-buffer--maybe-pop-up-window (buffer alist)
@@ -7873,7 +7873,7 @@ indirectly called by the latter."
           (append
            (cdr (assq 'child-frame-parameters alist))
            `((parent-frame . ,(selected-frame)))))
-	 (parent (or (assq 'parent-frame parameters)
+         (parent (or (assq 'parent-frame parameters)
                      (selected-frame)))
          (share (assq 'share-child-frame parameters))
          share1 frame window type)
@@ -7898,7 +7898,7 @@ indirectly called by the latter."
 
     (prog1 (window--display-buffer buffer window type alist)
       (unless (cdr (assq 'inhibit-switch-frame alist))
-	(window--maybe-raise-frame frame)))))
+        (window--maybe-raise-frame frame)))))
 
 (defun windows-sharing-edge (&optional window edge within)
   "Return list of live windows sharing the same edge with WINDOW.
@@ -7919,28 +7919,28 @@ edge of any window returned."
   (when (and within (window-live-p window))
     (error "Cannot share edge from within live window %s" window))
   (let ((window-edges (window-edges window nil nil t))
-	(horizontal (memq edge '(left right)))
-	(n (pcase edge
-	     ('left 0) ('above 1) ('right 2) ('below 3))))
+        (horizontal (memq edge '(left right)))
+        (n (pcase edge
+             ('left 0) ('above 1) ('right 2) ('below 3))))
     (unless (numberp n)
       (error "Invalid EDGE %s" edge))
     (let ((o (mod (+ 2 n) 4))
-	  (p (if horizontal 1 0))
-	  (q (if horizontal 3 2))
-	  windows)
+          (p (if horizontal 1 0))
+          (q (if horizontal 3 2))
+          windows)
       (walk-window-tree
        (lambda (other)
-	 (let ((other-edges (window-edges other nil nil t)))
-	   (when (and (not (eq window other))
-		      (= (nth n window-edges)
-			 (nth (if within n o) other-edges))
-		      (cond
-		       ((= (nth p window-edges) (nth p other-edges)))
-		       ((< (nth p window-edges) (nth p other-edges))
-			(< (nth p other-edges) (nth q window-edges)))
-		       (t
-			(< (nth p window-edges) (nth q other-edges)))))
-	     (setq windows (cons other windows)))))
+         (let ((other-edges (window-edges other nil nil t)))
+           (when (and (not (eq window other))
+                      (= (nth n window-edges)
+                         (nth (if within n o) other-edges))
+                      (cond
+                       ((= (nth p window-edges) (nth p other-edges)))
+                       ((< (nth p window-edges) (nth p other-edges))
+                        (< (nth p other-edges) (nth q window-edges)))
+                       (t
+                        (< (nth p window-edges) (nth q other-edges)))))
+             (setq windows (cons other windows)))))
        (window-frame window) nil 'nomini)
       (reverse windows))))
 
@@ -7950,19 +7950,19 @@ DIRECTION is passed as SIDE argument to `split-window-no-error'.
 ALIST is a buffer display alist."
   (and (not (frame-parameter (window-frame window) 'unsplittable))
        (let* ((window-combination-limit
-	       ;; When `window-combination-limit' equals
-	       ;; `display-buffer' or equals `resize-window' and a
-	       ;; `window-height' or `window-width' alist entry are
-	       ;; present, bind it to t so resizing steals space
-	       ;; preferably from the window that was split.
-	       (if (or (eq window-combination-limit 'display-buffer)
-		       (and (eq window-combination-limit 'window-size)
-			    (or (cdr (assq 'window-height alist))
-				(cdr (assq 'window-width alist)))))
-		   t
-		 window-combination-limit))
-	      (new-window (split-window-no-error window nil direction)))
-	 (and (window-live-p new-window) new-window))))
+               ;; When `window-combination-limit' equals
+               ;; `display-buffer' or equals `resize-window' and a
+               ;; `window-height' or `window-width' alist entry are
+               ;; present, bind it to t so resizing steals space
+               ;; preferably from the window that was split.
+               (if (or (eq window-combination-limit 'display-buffer)
+                       (and (eq window-combination-limit 'window-size)
+                            (or (cdr (assq 'window-height alist))
+                                (cdr (assq 'window-width alist)))))
+                   t
+                 window-combination-limit))
+              (new-window (split-window-no-error window nil direction)))
+         (and (window-live-p new-window) new-window))))
 
 (defun display-buffer-in-direction (buffer alist)
   "Try to display BUFFER in a direction specified by ALIST.
@@ -7999,59 +7999,59 @@ indirectly called by the latter."
   (let ((direction (cdr (assq 'direction alist))))
     (when direction
       (let ((window (cdr (assq 'window alist)))
-	    within windows other-window-shows-buffer other-window)
-	;; Sanitize WINDOW.
-	(cond
-	 ((or (eq window 'main)
+            within windows other-window-shows-buffer other-window)
+        ;; Sanitize WINDOW.
+        (cond
+         ((or (eq window 'main)
               (memq direction '(top bottom leftmost rightmost)))
-	  (setq window (window-main-window)))
-	 ((eq window 'root)
-	  (setq window (frame-root-window)))
-	 ((window-valid-p window))
-	 (t
-	  (setq window (selected-window))))
-	(setq within (not (window-live-p window)))
-	;; Sanitize DIRECTION
-	(cond
-	 ((memq direction '(left above right below)))
-	 ((eq direction 'leftmost)
-	  (setq direction 'left))
-	 ((memq direction '(top up))
-	  (setq direction 'above))
-	 ((eq direction 'rightmost)
-	  (setq direction 'right))
-	 ((memq direction '(bottom down))
-	  (setq direction 'below))
-	 (t
-	  (setq direction 'below)))
-
-	(setq alist
-	      (append alist
-		      `(,(if temp-buffer-resize-mode
-		             '(window-height . resize-temp-buffer-window)
-	                   '(window-height . fit-window-to-buffer))
-	                ,(when temp-buffer-resize-mode
-	                   '(preserve-size . (nil . t))))))
-
-	(setq windows (windows-sharing-edge window direction within))
-	(dolist (other windows)
-	  (cond
-	   ((and (not other-window-shows-buffer)
-		 (eq buffer (window-buffer other)))
-	    (setq other-window-shows-buffer t)
-	    (setq other-window other))
-	   ((not other-window)
-	    (setq other-window other))))
-	(or (and other-window-shows-buffer
-		 (window--display-buffer buffer other-window 'reuse alist))
-	    (and (setq other-window
-		       (window--try-to-split-window-in-direction
-			window direction alist))
-		 (window--display-buffer buffer other-window 'window alist))
-	    (and (setq window other-window)
-		 (not (window-dedicated-p other-window))
-		 (not (window-minibuffer-p other-window))
-		 (window--display-buffer buffer other-window 'reuse alist)))))))
+          (setq window (window-main-window)))
+         ((eq window 'root)
+          (setq window (frame-root-window)))
+         ((window-valid-p window))
+         (t
+          (setq window (selected-window))))
+        (setq within (not (window-live-p window)))
+        ;; Sanitize DIRECTION
+        (cond
+         ((memq direction '(left above right below)))
+         ((eq direction 'leftmost)
+          (setq direction 'left))
+         ((memq direction '(top up))
+          (setq direction 'above))
+         ((eq direction 'rightmost)
+          (setq direction 'right))
+         ((memq direction '(bottom down))
+          (setq direction 'below))
+         (t
+          (setq direction 'below)))
+
+        (setq alist
+              (append alist
+                      `(,(if temp-buffer-resize-mode
+                             '(window-height . resize-temp-buffer-window)
+                           '(window-height . fit-window-to-buffer))
+                        ,(when temp-buffer-resize-mode
+                           '(preserve-size . (nil . t))))))
+
+        (setq windows (windows-sharing-edge window direction within))
+        (dolist (other windows)
+          (cond
+           ((and (not other-window-shows-buffer)
+                 (eq buffer (window-buffer other)))
+            (setq other-window-shows-buffer t)
+            (setq other-window other))
+           ((not other-window)
+            (setq other-window other))))
+        (or (and other-window-shows-buffer
+                 (window--display-buffer buffer other-window 'reuse alist))
+            (and (setq other-window
+                       (window--try-to-split-window-in-direction
+                        window direction alist))
+                 (window--display-buffer buffer other-window 'window alist))
+            (and (setq window other-window)
+                 (not (window-dedicated-p other-window))
+                 (not (window-minibuffer-p other-window))
+                 (window--display-buffer buffer other-window 'reuse alist)))))))
 
 ;; This should be rewritten as
 ;; (display-buffer-in-direction buffer (cons '(direction . below) alist))
@@ -8078,42 +8078,42 @@ node `(elisp) Buffer Display Action Functions'.  It should be
 called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (let ((min-height (cdr (assq 'window-min-height alist)))
-	window)
+        window)
     (or (and (setq window (window-in-direction 'below))
              (eq buffer (window-buffer window))
-	     (or (not (numberp min-height))
-		 (>= (window-height window) min-height)
-		 ;; 'window--display-buffer' can resize this window if
-		 ;; and only if it has a 'quit-restore' parameter
-		 ;; certifying that it always showed BUFFER before.
-		 (let ((height (window-height window))
-		       (quit-restore (window-parameter window 'quit-restore)))
-		   (and quit-restore
-			(eq (nth 1 quit-restore) 'window)
-			(window-resizable-p window (- min-height height)))))
-	     (window--display-buffer buffer window 'reuse alist))
-	(and (not (frame-parameter nil 'unsplittable))
              (or (not (numberp min-height))
-		 (window-sizable-p nil (- min-height)))
+                 (>= (window-height window) min-height)
+                 ;; 'window--display-buffer' can resize this window if
+                 ;; and only if it has a 'quit-restore' parameter
+                 ;; certifying that it always showed BUFFER before.
+                 (let ((height (window-height window))
+                       (quit-restore (window-parameter window 'quit-restore)))
+                   (and quit-restore
+                        (eq (nth 1 quit-restore) 'window)
+                        (window-resizable-p window (- min-height height)))))
+             (window--display-buffer buffer window 'reuse alist))
+        (and (not (frame-parameter nil 'unsplittable))
+             (or (not (numberp min-height))
+                 (window-sizable-p nil (- min-height)))
              (let ((split-height-threshold 0)
-		   split-width-threshold)
+                   split-width-threshold)
                (setq window (window--try-to-split-window
                              (selected-window) alist)))
              (window--display-buffer buffer window 'window alist))
-	(and (setq window (window-in-direction 'below))
+        (and (setq window (window-in-direction 'below))
              (not (window-dedicated-p window))
-	     (or (not (numberp min-height))
-		 ;; A window that showed another buffer before cannot
-		 ;; be resized.
-		 (>= (window-height window) min-height))
-	     (window--display-buffer buffer window 'reuse alist)))))
+             (or (not (numberp min-height))
+                 ;; A window that showed another buffer before cannot
+                 ;; be resized.
+                 (>= (window-height window) min-height))
+             (window--display-buffer buffer window 'reuse alist)))))
 
 (defun display-buffer--maybe-at-bottom (buffer alist)
   (let ((alist (append alist `(,(if temp-buffer-resize-mode
-		                    '(window-height . resize-temp-buffer-window)
-	                          '(window-height . fit-window-to-buffer))
-	                       ,(when temp-buffer-resize-mode
-	                          '(preserve-size . (nil . t)))))))
+                                    '(window-height . resize-temp-buffer-window)
+                                  '(window-height . fit-window-to-buffer))
+                               ,(when temp-buffer-resize-mode
+                                  '(preserve-size . (nil . t)))))))
     (or (display-buffer--maybe-same-window buffer alist)
         (display-buffer-reuse-window buffer alist)
         (display-buffer--maybe-pop-up-frame buffer alist)
@@ -8140,22 +8140,22 @@ indirectly called by the latter."
     (walk-window-tree
      (lambda (window)
        (cond
-	((window-in-direction 'below window))
-	((and (not bottom-window-shows-buffer)
-	      (eq buffer (window-buffer window)))
-	 (setq bottom-window-shows-buffer t)
-	 (setq bottom-window window))
-	((not bottom-window)
-	 (setq bottom-window window))))
+        ((window-in-direction 'below window))
+        ((and (not bottom-window-shows-buffer)
+              (eq buffer (window-buffer window)))
+         (setq bottom-window-shows-buffer t)
+         (setq bottom-window window))
+        ((not bottom-window)
+         (setq bottom-window window))))
      nil nil 'nomini)
     (or (and bottom-window-shows-buffer
-	     (window--display-buffer buffer bottom-window 'reuse alist))
-	(and (not (frame-parameter nil 'unsplittable))
-	     (setq window (split-window-no-error (window-main-window)))
-	     (window--display-buffer buffer window 'window alist))
-	(and (setq window bottom-window)
-	     (not (window-dedicated-p window))
-	     (window--display-buffer buffer window 'reuse alist)))))
+             (window--display-buffer buffer bottom-window 'reuse alist))
+        (and (not (frame-parameter nil 'unsplittable))
+             (setq window (split-window-no-error (window-main-window)))
+             (window--display-buffer buffer window 'window alist))
+        (and (setq window bottom-window)
+             (not (window-dedicated-p window))
+             (window--display-buffer buffer window 'reuse alist)))))
 
 (defun display-buffer-in-previous-window (buffer alist)
   "Display BUFFER in a window previously showing it.
@@ -8199,37 +8199,37 @@ node `(elisp) Buffer Display Action Functions'.  It should be
 called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (let* ((alist-entry (assq 'reusable-frames alist))
-	 (inhibit-same-window
-	  (cdr (assq 'inhibit-same-window alist)))
-	 (frames (cond
-		  (alist-entry (cdr alist-entry))
-		  ((if (eq pop-up-frames 'graphic-only)
-		       (display-graphic-p)
-		     pop-up-frames)
-		   0)
-		  (display-buffer-reuse-frames 0)
-		  (t (last-nonminibuffer-frame))))
-	 best-window second-best-window window)
+         (inhibit-same-window
+          (cdr (assq 'inhibit-same-window alist)))
+         (frames (cond
+                  (alist-entry (cdr alist-entry))
+                  ((if (eq pop-up-frames 'graphic-only)
+                       (display-graphic-p)
+                     pop-up-frames)
+                   0)
+                  (display-buffer-reuse-frames 0)
+                  (t (last-nonminibuffer-frame))))
+         best-window second-best-window window)
     ;; Scan windows whether they have shown the buffer recently.
     (catch 'best
       (dolist (window (window-list-1 (frame-first-window) 'nomini frames))
-	(when (and (assq buffer (window-prev-buffers window))
-		   (not (window-dedicated-p window)))
-	  (if (eq window (selected-window))
-	      (unless inhibit-same-window
-		(setq second-best-window window))
-	    (setq best-window window)
-	    (throw 'best t)))))
+        (when (and (assq buffer (window-prev-buffers window))
+                   (not (window-dedicated-p window)))
+          (if (eq window (selected-window))
+              (unless inhibit-same-window
+                (setq second-best-window window))
+            (setq best-window window)
+            (throw 'best t)))))
     ;; When ALIST has a `previous-window' entry, that entry may override
     ;; anything we found so far.
     (when (and (setq window (cdr (assq 'previous-window alist)))
-	       (window-live-p window)
-	       (or (eq buffer (window-buffer window))
+               (window-live-p window)
+               (or (eq buffer (window-buffer window))
                    (not (window-dedicated-p window))))
       (if (eq window (selected-window))
-	  (unless inhibit-same-window
-	    (setq second-best-window window))
-	(setq best-window window)))
+          (unless inhibit-same-window
+            (setq second-best-window window))
+        (setq best-window window)))
     ;; Return best or second best window found.
     (when (setq window (or best-window second-best-window))
       (window--display-buffer buffer window 'reuse alist))))
@@ -8252,39 +8252,39 @@ node `(elisp) Buffer Display Action Functions'.  It should be
 called only by `display-buffer' or a function directly or
 indirectly called by the latter."
   (let* ((not-this-window (cdr (assq 'inhibit-same-window alist)))
-	 (frame (or (window--frame-usable-p (selected-frame))
-		    (window--frame-usable-p (last-nonminibuffer-frame))))
-	 (window
-	  ;; Reuse an existing window.
-	  (or (get-lru-window frame nil not-this-window)
-	      (let ((window (get-buffer-window buffer 'visible)))
-		(unless (and not-this-window
-			     (eq window (selected-window)))
-		  window))
-	      (get-largest-window 'visible nil not-this-window)
-	      (let ((window (get-buffer-window buffer 0)))
-		(unless (and not-this-window
-			     (eq window (selected-window)))
-		  window))
-	      (get-largest-window 0 nil not-this-window)))
-	 (quit-restore (and (window-live-p window)
-			    (window-parameter window 'quit-restore)))
-	 (quad (nth 1 quit-restore)))
+         (frame (or (window--frame-usable-p (selected-frame))
+                    (window--frame-usable-p (last-nonminibuffer-frame))))
+         (window
+          ;; Reuse an existing window.
+          (or (get-lru-window frame nil not-this-window)
+              (let ((window (get-buffer-window buffer 'visible)))
+                (unless (and not-this-window
+                             (eq window (selected-window)))
+                  window))
+              (get-largest-window 'visible nil not-this-window)
+              (let ((window (get-buffer-window buffer 0)))
+                (unless (and not-this-window
+                             (eq window (selected-window)))
+                  window))
+              (get-largest-window 0 nil not-this-window)))
+         (quit-restore (and (window-live-p window)
+                            (window-parameter window 'quit-restore)))
+         (quad (nth 1 quit-restore)))
     (when (window-live-p window)
       ;; If the window was used by `display-buffer' before, try to
       ;; resize it to its old height but don't signal an error.
       (when (and (listp quad)
-		 (integerp (nth 3 quad))
-		 (> (nth 3 quad) (window-total-height window)))
-	(condition-case nil
-	    (window-resize window (- (nth 3 quad) (window-total-height window)))
-	  (error nil)))
+                 (integerp (nth 3 quad))
+                 (> (nth 3 quad) (window-total-height window)))
+        (condition-case nil
+            (window-resize window (- (nth 3 quad) (window-total-height window)))
+          (error nil)))
 
       (prog1
-	  (window--display-buffer buffer window 'reuse alist)
-	(window--even-window-sizes window)
-	(unless (cdr (assq 'inhibit-switch-frame alist))
-	  (window--maybe-raise-frame (window-frame window)))))))
+          (window--display-buffer buffer window 'reuse alist)
+        (window--even-window-sizes window)
+        (unless (cdr (assq 'inhibit-switch-frame alist))
+          (window--maybe-raise-frame (window-frame window)))))))
 
 (defun display-buffer-no-window (_buffer alist)
   "Display BUFFER in no window.
@@ -8327,10 +8327,10 @@ input focus.
 Optional third arg NORECORD non-nil means do not put this buffer
 at the front of the list of recently selected ones."
   (interactive (list (read-buffer "Pop to buffer: " (other-buffer))
-		     (if current-prefix-arg t)))
+                     (if current-prefix-arg t)))
   (let* ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))
          (old-frame (selected-frame))
-	 (window (display-buffer buffer action)))
+         (window (display-buffer buffer action)))
     ;; Don't assume that `display-buffer' has supplied us with a window
     ;; (Bug#24332).
     (if window
@@ -8396,9 +8396,9 @@ exists, return that buffer.  If no such buffer exists, create a
 buffer with the name BUFFER-OR-NAME and return that buffer."
   (if buffer-or-name
       (or (get-buffer buffer-or-name)
-	  (let ((buffer (get-buffer-create buffer-or-name)))
-	    (set-buffer-major-mode buffer)
-	    buffer))
+          (let ((buffer (get-buffer-create buffer-or-name)))
+            (set-buffer-major-mode buffer)
+            buffer))
     (other-buffer)))
 
 (defcustom switch-to-buffer-preserve-window-point t
@@ -8417,9 +8417,9 @@ the selected window or never appeared in it before, or if
 or non-nil `switch-to-buffer-obey-display-actions' displays it
 in another window."
   :type '(choice
-	  (const :tag "Never" nil)
-	  (const :tag "If already displayed elsewhere" already-displayed)
-	  (const :tag "Always" t))
+          (const :tag "Never" nil)
+          (const :tag "If already displayed elsewhere" already-displayed)
+          (const :tag "Always" t))
   :group 'windows
   :version "26.1")
 
@@ -8443,10 +8443,10 @@ When called non-interactively, `switch-to-buffer' always signals
 an error when the selected window is dedicated to its buffer and
 FORCE-SAME-WINDOW is non-nil."
   :type '(choice
-	  (const :tag "Disallow" nil)
-	  (const :tag "Prompt" prompt)
-	  (const :tag "Pop" pop)
-	  (const :tag "Allow" t))
+          (const :tag "Disallow" nil)
+          (const :tag "Prompt" prompt)
+          (const :tag "Pop" pop)
+          (const :tag "Allow" t))
   :group 'windows
   :version "25.1")
 
@@ -8558,17 +8558,17 @@ Return the buffer switched to."
 
       (when set-window-start-and-point
         (let* ((entry (assq buffer (window-prev-buffers)))
-	       (displayed (and (eq switch-to-buffer-preserve-window-point
-				   'already-displayed)
-			       (get-buffer-window buffer 0))))
-	  (set-window-buffer nil buffer)
-	  (when (and entry
-		     (or (eq switch-to-buffer-preserve-window-point t)
-		         displayed))
-	    ;; Try to restore start and point of buffer in the selected
-	    ;; window (Bug#4041).
-	    (set-window-start (selected-window) (nth 1 entry) t)
-	    (set-window-point nil (nth 2 entry)))))))
+               (displayed (and (eq switch-to-buffer-preserve-window-point
+                                   'already-displayed)
+                               (get-buffer-window buffer 0))))
+          (set-window-buffer nil buffer)
+          (when (and entry
+                     (or (eq switch-to-buffer-preserve-window-point t)
+                         displayed))
+            ;; Try to restore start and point of buffer in the selected
+            ;; window (Bug#4041).
+            (set-window-start (selected-window) (nth 1 entry) t)
+            (set-window-point nil (nth 2 entry)))))))
 
     (unless norecord
       (select-window (selected-window)))
@@ -8662,12 +8662,12 @@ command echo keystrokes that should describe the current prefix state."
     (fset clearfun
           (lambda ()
             (unless (or
-		     ;; Remove the hook immediately
-		     ;; after exiting the minibuffer.
-		     (> (minibuffer-depth) minibuffer-depth)
-		     ;; But don't remove immediately after
-		     ;; adding the hook by the same command below.
-		     (eq this-command command))
+                     ;; Remove the hook immediately
+                     ;; after exiting the minibuffer.
+                     (> (minibuffer-depth) minibuffer-depth)
+                     ;; But don't remove immediately after
+                     ;; adding the hook by the same command below.
+                     (eq this-command command))
               (funcall exitfun))))
     ;; Reset display-buffer-overriding-action
     ;; after the next command finishes
@@ -8695,7 +8695,7 @@ where some error may be present."
       ;; windows one line tall, which means that there's no more space
       ;; for the mode line.
       (let ((window-min-height (min 2 height)))
-	(window-resize window delta)))))
+        (window-resize window delta)))))
 
 (defun enlarge-window-horizontally (delta)
   "Make selected window DELTA columns wider.
@@ -8769,11 +8769,11 @@ WINDOW must be a live window and defaults to the selected one."
   (setq window (window-normalize-window window t))
   (with-current-buffer (window-buffer window)
     (max 1
-	 (count-screen-lines (point-min) (point-max)
-			     ;; If buffer ends with a newline, ignore it when
-			     ;; counting height unless point is after it.
-			     (eobp)
-			     window))))
+         (count-screen-lines (point-min) (point-max)
+                             ;; If buffer ends with a newline, ignore it when
+                             ;; counting height unless point is after it.
+                             (eobp)
+                             window))))
 
 (defun window-default-font-height (&optional window)
   "Return height in pixels of WINDOW's default face font.
@@ -8782,10 +8782,10 @@ WINDOW must be a live window and defaults to the selected one.
 The return value accounts for any remapping of the default face
 font on WINDOW's frame."
   (let* ((window (window-normalize-window window t))
-	 (frame (window-frame window))
-	 (default-font (face-font 'default frame)))
+         (frame (window-frame window))
+         (default-font (face-font 'default frame)))
     (if (and (display-multi-font-p (frame-parameter frame 'display))
-	     (not (string-equal (frame-parameter frame 'font) default-font)))
+             (not (string-equal (frame-parameter frame 'font) default-font)))
         (aref (font-info default-font frame) 3)
       (frame-char-height frame))))
 
@@ -8797,14 +8797,14 @@ The return value includes any line spacing defined for WINDOW's
 buffer or frame and accounts for any remapping of the default
 face on WINDOW's frame."
   (let* ((window (window-normalize-window window t))
-	 (font-height (window-default-font-height window))
-	 (frame (window-frame window))
-	 (buffer (window-buffer window))
-	 (space-height
-	  (or (and (display-graphic-p frame)
-		   (or (buffer-local-value 'line-spacing buffer)
-		       (frame-parameter frame 'line-spacing)))
-	      0)))
+         (font-height (window-default-font-height window))
+         (frame (window-frame window))
+         (buffer (window-buffer window))
+         (space-height
+          (or (and (display-graphic-p frame)
+                   (or (buffer-local-value 'line-spacing buffer)
+                       (frame-parameter frame 'line-spacing)))
+              0)))
     (+ font-height
        (if (floatp space-height)
            (truncate (* (frame-char-height frame) space-height))
@@ -8846,30 +8846,30 @@ by that frame's `fit-frame-to-buffer-margins' parameter, if
 present.  See also `fit-frame-to-buffer-sizes'."
   :version "24.4"
   :type '(list
-	  (choice
-	   :tag "Left"
-	   :value nil
-	   :format "%[LeftMargin%] %v  "
-	   (const :tag "None" :format "%t" nil)
-	   (integer :tag "Pixels" :size 5))
-	  (choice
-	   :tag "Top"
-	   :value nil
-	   :format "%[TopMargin%] %v  "
-	   (const :tag "None" :format "%t" nil)
-	   (integer :tag "Pixels" :size 5))
-	  (choice
-	   :tag "Right"
-	   :value nil
-	   :format "%[RightMargin%] %v  "
-	   (const :tag "None" :format "%t" nil)
-	   (integer :tag "Pixels" :size 5))
-	  (choice
-	   :tag "Bottom"
-	   :value nil
-	   :format "%[BottomMargin%] %v  "
-	   (const :tag "None" :format "%t" nil)
-	   (integer :tag "Pixels" :size 5)))
+          (choice
+           :tag "Left"
+           :value nil
+           :format "%[LeftMargin%] %v  "
+           (const :tag "None" :format "%t" nil)
+           (integer :tag "Pixels" :size 5))
+          (choice
+           :tag "Top"
+           :value nil
+           :format "%[TopMargin%] %v  "
+           (const :tag "None" :format "%t" nil)
+           (integer :tag "Pixels" :size 5))
+          (choice
+           :tag "Right"
+           :value nil
+           :format "%[RightMargin%] %v  "
+           (const :tag "None" :format "%t" nil)
+           (integer :tag "Pixels" :size 5))
+          (choice
+           :tag "Bottom"
+           :value nil
+           :format "%[BottomMargin%] %v  "
+           (const :tag "None" :format "%t" nil)
+           (integer :tag "Pixels" :size 5)))
   :group 'help)
 
 (defcustom fit-frame-to-buffer-sizes '(nil nil nil nil)
@@ -8886,30 +8886,30 @@ appropriate minimum width value here can avoid such wrapping.
 See also `fit-frame-to-buffer-margins'."
   :version "24.4"
   :type '(list
-	  (choice
-	   :tag "Maximum Height"
-	   :value nil
-	   :format "%[MaxHeight%] %v  "
-	   (const :tag "None" :format "%t" nil)
-	   (integer :tag "Lines" :size 5))
-	  (choice
-	   :tag "Minimum Height"
-	   :value nil
-	   :format "%[MinHeight%] %v  "
-	   (const :tag "None" :format "%t" nil)
-	   (integer :tag "Lines" :size 5))
-	  (choice
-	   :tag "Maximum Width"
-	   :value nil
-	   :format "%[MaxWidth%] %v  "
-	   (const :tag "None" :format "%t" nil)
-	   (integer :tag "Columns" :size 5))
-	  (choice
-	   :tag "Minimum Width"
-	   :value nil
-	   :format "%[MinWidth%] %v\n"
-	   (const :tag "None" :format "%t" nil)
-	   (integer :tag "Columns" :size 5)))
+          (choice
+           :tag "Maximum Height"
+           :value nil
+           :format "%[MaxHeight%] %v  "
+           (const :tag "None" :format "%t" nil)
+           (integer :tag "Lines" :size 5))
+          (choice
+           :tag "Minimum Height"
+           :value nil
+           :format "%[MinHeight%] %v  "
+           (const :tag "None" :format "%t" nil)
+           (integer :tag "Lines" :size 5))
+          (choice
+           :tag "Maximum Width"
+           :value nil
+           :format "%[MaxWidth%] %v  "
+           (const :tag "None" :format "%t" nil)
+           (integer :tag "Columns" :size 5))
+          (choice
+           :tag "Minimum Width"
+           :value nil
+           :format "%[MinWidth%] %v\n"
+           (const :tag "None" :format "%t" nil)
+           (integer :tag "Columns" :size 5)))
   :group 'help)
 
 (declare-function x-display-pixel-height "xfns.c" (&optional terminal))
@@ -9176,12 +9176,12 @@ accessible position."
   (setq window (window-normalize-window window t))
   (if (eq window (frame-root-window window))
       (when fit-frame-to-buffer
-	;; Fit WINDOW's frame to buffer.
-	(fit-frame-to-buffer
-	 (window-frame window)
-	 max-height min-height max-width min-width
-	 (and (memq fit-frame-to-buffer '(vertically horizontally))
-	      fit-frame-to-buffer)))
+        ;; Fit WINDOW's frame to buffer.
+        (fit-frame-to-buffer
+         (window-frame window)
+         max-height min-height max-width min-width
+         (and (memq fit-frame-to-buffer '(vertically horizontally))
+              fit-frame-to-buffer)))
     (let* ((pixelwise window-resize-pixelwise)
            (frame (window-frame window))
            (char-height (frame-char-height frame)))
@@ -9189,111 +9189,111 @@ accessible position."
        ;; If WINDOW is vertically combined, try to resize it
        ;; vertically.
        ((and (not (eq fit-window-to-buffer-horizontally 'only))
-	     (not (window-size-fixed-p window 'preserved))
-	     (window-combined-p window))
+             (not (window-size-fixed-p window 'preserved))
+             (window-combined-p window))
         (let* ((line-height (window-default-line-height window))
-	       (total-height (window-size window nil pixelwise))
+               (total-height (window-size window nil pixelwise))
                (min-height
-	        ;; Sanitize MIN-HEIGHT.
-	        (if (numberp min-height)
-	            ;; Can't get smaller than `window-safe-min-height'.
-	            (max (if pixelwise
-			     (* line-height min-height)
-		           min-height)
-		         (if pixelwise
-			     (window-safe-min-pixel-height window)
-		           window-safe-min-height))
-	          ;; Preserve header and mode line if present.
-	          (max (if pixelwise
-		           (* line-height window-min-height)
-		         window-min-height)
-		       (window-min-size window nil window pixelwise))))
-	       (max-height
-	        ;; Sanitize MAX-HEIGHT.
-	        (if (numberp max-height)
-	            (min
-		     (+ total-height
-		        (window-max-delta
-		         window nil window nil t nil pixelwise))
-		     (if pixelwise
-		         (* line-height max-height)
-		       (/ (* line-height max-height) line-height)))
-	          (+ total-height (window-max-delta
-			           window nil window nil t nil pixelwise))))
-	       (height (+ (cdr (window-text-pixel-size
-			        window nil t nil (frame-pixel-height frame) t))
-		          (window-scroll-bar-height window)
-		          (window-bottom-divider-width window))))
-	  ;; Vertically we always want to fit the entire buffer.
-	  ;; WINDOW'S height can't get larger than its frame's pixel
-	  ;; height.  Its width remains fixed.
-	  ;; Round height.
-	  (unless pixelwise
-	    (setq height (/ (+ height char-height -1) char-height)))
+                ;; Sanitize MIN-HEIGHT.
+                (if (numberp min-height)
+                    ;; Can't get smaller than `window-safe-min-height'.
+                    (max (if pixelwise
+                             (* line-height min-height)
+                           min-height)
+                         (if pixelwise
+                             (window-safe-min-pixel-height window)
+                           window-safe-min-height))
+                  ;; Preserve header and mode line if present.
+                  (max (if pixelwise
+                           (* line-height window-min-height)
+                         window-min-height)
+                       (window-min-size window nil window pixelwise))))
+               (max-height
+                ;; Sanitize MAX-HEIGHT.
+                (if (numberp max-height)
+                    (min
+                     (+ total-height
+                        (window-max-delta
+                         window nil window nil t nil pixelwise))
+                     (if pixelwise
+                         (* line-height max-height)
+                       (/ (* line-height max-height) line-height)))
+                  (+ total-height (window-max-delta
+                                   window nil window nil t nil pixelwise))))
+               (height (+ (cdr (window-text-pixel-size
+                                window nil t nil (frame-pixel-height frame) t))
+                          (window-scroll-bar-height window)
+                          (window-bottom-divider-width window))))
+          ;; Vertically we always want to fit the entire buffer.
+          ;; WINDOW'S height can't get larger than its frame's pixel
+          ;; height.  Its width remains fixed.
+          ;; Round height.
+          (unless pixelwise
+            (setq height (/ (+ height char-height -1) char-height)))
           (setq height (max min-height (min max-height height)))
-	  (unless (= height total-height)
-	    (window-preserve-size window)
-	    (window-resize-no-error
-	     window (- height total-height) nil window pixelwise)
-	    (when preserve-size
-	      (window-preserve-size window nil t)))))
+          (unless (= height total-height)
+            (window-preserve-size window)
+            (window-resize-no-error
+             window (- height total-height) nil window pixelwise)
+            (when preserve-size
+              (window-preserve-size window nil t)))))
        ;; If WINDOW is horizontally combined, try to resize it
        ;; horizontally.
        ((and fit-window-to-buffer-horizontally
-	     (not (window-size-fixed-p window t 'preserved))
-	     (window-combined-p window t))
-	(let* ((char-width (frame-char-width frame))
+             (not (window-size-fixed-p window t 'preserved))
+             (window-combined-p window t))
+        (let* ((char-width (frame-char-width frame))
                (total-width (window-size window t pixelwise))
-	       (min-width
-		;; Sanitize MIN-WIDTH.
-		(if (numberp min-width)
-		    ;; Can't get smaller than `window-safe-min-width'.
-		    (max (if pixelwise
-			     (* char-width min-width)
-			   min-width)
-			 (if pixelwise
-			     (window-safe-min-pixel-width window)
-			   window-safe-min-width))
-		  ;; Preserve fringes, margins, scrollbars if present.
-		  (max (if pixelwise
-			   (* char-width window-min-width)
-			 window-min-width)
-		       (window-min-size window nil window pixelwise))))
-	       (max-width
-		;; Sanitize MAX-WIDTH.
-		(if (numberp max-width)
-		    (min (+ total-width
-			    (window-max-delta
-			     window t window nil t nil pixelwise))
-			 (if pixelwise
-			     (* char-width max-width)
-			   max-width))
-		  (+ total-width (window-max-delta
-				  window t window nil t nil pixelwise))))
-	       ;; When fitting horizontally, assume that WINDOW's
-	       ;; start position remains unaltered.  WINDOW can't get
-	       ;; wider than its frame's pixel width, its height
-	       ;; remains unaltered.
-	       (width (+ (car (window-text-pixel-size
-			       window (window-start window) nil
-			       (frame-pixel-width (window-frame window))
-			       ;; Add one line-height to assure that
-			       ;; we're on the safe side.  This
-			       ;; overshoots when the first line below
-			       ;; the bottom is wider than the window.
-			       (* (window-body-height window pixelwise)
-				  (if pixelwise 1 char-height))))
+               (min-width
+                ;; Sanitize MIN-WIDTH.
+                (if (numberp min-width)
+                    ;; Can't get smaller than `window-safe-min-width'.
+                    (max (if pixelwise
+                             (* char-width min-width)
+                           min-width)
+                         (if pixelwise
+                             (window-safe-min-pixel-width window)
+                           window-safe-min-width))
+                  ;; Preserve fringes, margins, scrollbars if present.
+                  (max (if pixelwise
+                           (* char-width window-min-width)
+                         window-min-width)
+                       (window-min-size window nil window pixelwise))))
+               (max-width
+                ;; Sanitize MAX-WIDTH.
+                (if (numberp max-width)
+                    (min (+ total-width
+                            (window-max-delta
+                             window t window nil t nil pixelwise))
+                         (if pixelwise
+                             (* char-width max-width)
+                           max-width))
+                  (+ total-width (window-max-delta
+                                  window t window nil t nil pixelwise))))
+               ;; When fitting horizontally, assume that WINDOW's
+               ;; start position remains unaltered.  WINDOW can't get
+               ;; wider than its frame's pixel width, its height
+               ;; remains unaltered.
+               (width (+ (car (window-text-pixel-size
+                               window (window-start window) nil
+                               (frame-pixel-width (window-frame window))
+                               ;; Add one line-height to assure that
+                               ;; we're on the safe side.  This
+                               ;; overshoots when the first line below
+                               ;; the bottom is wider than the window.
+                               (* (window-body-height window pixelwise)
+                                  (if pixelwise 1 char-height))))
                          (- total-width
                             (window-body-width window pixelwise)))))
-	  (unless pixelwise
-	    (setq width (/ (+ width char-width -1) char-width)))
+          (unless pixelwise
+            (setq width (/ (+ width char-width -1) char-width)))
           (setq width (max min-width (min max-width width)))
-	  (unless (= width total-width)
-	    (window-preserve-size window t)
-	    (window-resize-no-error
+          (unless (= width total-width)
+            (window-preserve-size window t)
+            (window-resize-no-error
              window (- width total-width) t window pixelwise)
-	    (when preserve-size
-	      (window-preserve-size window t t)))))))))
+            (when preserve-size
+              (window-preserve-size window t t)))))))))
 
 (defun window-safely-shrinkable-p (&optional window)
   "Return t if WINDOW can be shrunk without shrinking other windows.
@@ -9301,7 +9301,7 @@ WINDOW defaults to the selected window."
   (with-selected-window (or window (selected-window))
     (let ((edges (window-edges)))
       (or (= (nth 2 edges) (nth 2 (window-edges (previous-window))))
-	  (= (nth 0 edges) (nth 0 (window-edges (next-window))))))))
+          (= (nth 0 edges) (nth 0 (window-edges (next-window))))))))
 
 (defun shrink-window-if-larger-than-buffer (&optional window)
   "Shrink height of WINDOW if its buffer doesn't need so many lines.
@@ -9322,7 +9322,7 @@ Return non-nil if the window was shrunk, nil otherwise."
   ;; visible (for whatever reason that's needed).  The remaining issues
   ;; should be taken care of by `fit-window-to-buffer'.
   (when (and (window-combined-p window)
-	     (pos-visible-in-window-p (point-min) window))
+             (pos-visible-in-window-p (point-min) window))
     (fit-window-to-buffer window (window-total-height window))))
 
 (defun window-largest-empty-rectangle--maximums-1 (quad maximums)
@@ -9334,7 +9334,7 @@ Return non-nil if the window was shrunk, nil otherwise."
     (cons quad maximums))
    (t
     (cons (car maximums)
-	  (window-largest-empty-rectangle--maximums-1 quad (cdr maximums))))))
+          (window-largest-empty-rectangle--maximums-1 quad (cdr maximums))))))
 
 (defun window-largest-empty-rectangle--maximums (quad maximums count)
   "Support function for `window-largest-empty-rectangle'."
@@ -9347,21 +9347,21 @@ Return non-nil if the window was shrunk, nil otherwise."
   "Support function for `window-largest-empty-rectangle'."
   (setq maximums (sort maximums (lambda (x y) (> (car x) (car y)))))
   (let ((new-length 0)
-	new-maximums)
+        new-maximums)
     (while (and maximums (< new-length count))
       (let* ((maximum (car maximums))
-	     (at (nth 2 maximum))
-	     (to (nth 3 maximum)))
-	(catch 'drop
-	  (dolist (new-maximum new-maximums)
-	    (let ((new-at (nth 2 new-maximum))
-		  (new-to (nth 3 new-maximum)))
-	      (when (if (< at new-at) (> to new-at) (< at new-to))
-		;; Intersection -> drop.
-		(throw 'drop nil))))
-	  (setq new-maximums (cons maximum new-maximums))
-	  (setq new-length (1+ new-length)))
-	(setq maximums (cdr maximums))))
+             (at (nth 2 maximum))
+             (to (nth 3 maximum)))
+        (catch 'drop
+          (dolist (new-maximum new-maximums)
+            (let ((new-at (nth 2 new-maximum))
+                  (new-to (nth 3 new-maximum)))
+              (when (if (< at new-at) (> to new-at) (< at new-to))
+                ;; Intersection -> drop.
+                (throw 'drop nil))))
+          (setq new-maximums (cons maximum new-maximums))
+          (setq new-length (1+ new-length)))
+        (setq maximums (cdr maximums))))
 
     (nreverse new-maximums)))
 
@@ -9400,90 +9400,90 @@ buffers displaying right to left text."
   ;; Process lines as returned by ‘window-lines-pixel-dimensions’.
   ;; STACK is a stack that contains rows that have yet to be processed.
   (let* ((window (window-normalize-window window t))
-	 (disjoint (and (consp count) (cdr count)))
-	 (count (or (and (numberp count) count)
-		    (and (consp count) (numberp (car count)) (car count))))
-	 (rows (window-lines-pixel-dimensions window nil nil t t left))
-	 (rows-at 0)
-	 (max-size 0)
-	 row stack stack-at stack-to
-	 top top-width top-at top-to top-size
-	 max-width max-at max-to maximums)
+         (disjoint (and (consp count) (cdr count)))
+         (count (or (and (numberp count) count)
+                    (and (consp count) (numberp (car count)) (car count))))
+         (rows (window-lines-pixel-dimensions window nil nil t t left))
+         (rows-at 0)
+         (max-size 0)
+         row stack stack-at stack-to
+         top top-width top-at top-to top-size
+         max-width max-at max-to maximums)
     ;; ROWS-AT is the position where the first element of ROWS starts.
     ;; STACK-AT is the position where the first element of STACK starts.
     (while rows
       (setq row (car rows))
       (if (or (not stack) (>= (car row) (caar stack)))
-	  (progn
-	    (unless stack
-	      (setq stack-at rows-at))
-	    (setq stack (cons row stack))
-	    ;; Set ROWS-AT to where the first element of ROWS ends
-	    ;; which, after popping ROW, makes it the start position of
-	    ;; the next ROW.
-	    (setq rows-at (cdr row))
-	    (setq rows (cdr rows)))
-	(setq top (car stack))
-	(setq stack (cdr stack))
-	(setq top-width (car top))
-	(setq top-at (if stack (cdar stack) stack-at))
-	(setq top-to (cdr top))
-	(setq top-size (* top-width (- top-to top-at)))
-	(unless (or (and min-width (< top-width min-width))
-		    (and min-height (< (- top-to top-at) min-height))
-		    (and positions
-			 (or (> top-at (car positions))
-			     (< top-to (cdr positions)))))
-	  (if count
-	      (if disjoint
-		  (setq maximums (cons (list top-size top-width top-at top-to)
-				       maximums))
-		(setq maximums (window-largest-empty-rectangle--maximums
-				(list top-size top-width top-at top-to)
-				maximums count)))
-	    (when (> top-size max-size)
-	      (setq max-size top-size)
-	      (setq max-width top-width)
-	      (setq max-at top-at)
-	      (setq max-to top-to))))
-	(if (and stack (> (caar stack) (car row)))
-	    ;; Have new top element of stack include old top.
-	    (setq stack (cons (cons (caar stack) (cdr top)) (cdr stack)))
-	  ;; Move rows-at backwards to top-at.
-	  (setq rows-at top-at))))
+          (progn
+            (unless stack
+              (setq stack-at rows-at))
+            (setq stack (cons row stack))
+            ;; Set ROWS-AT to where the first element of ROWS ends
+            ;; which, after popping ROW, makes it the start position of
+            ;; the next ROW.
+            (setq rows-at (cdr row))
+            (setq rows (cdr rows)))
+        (setq top (car stack))
+        (setq stack (cdr stack))
+        (setq top-width (car top))
+        (setq top-at (if stack (cdar stack) stack-at))
+        (setq top-to (cdr top))
+        (setq top-size (* top-width (- top-to top-at)))
+        (unless (or (and min-width (< top-width min-width))
+                    (and min-height (< (- top-to top-at) min-height))
+                    (and positions
+                         (or (> top-at (car positions))
+                             (< top-to (cdr positions)))))
+          (if count
+              (if disjoint
+                  (setq maximums (cons (list top-size top-width top-at top-to)
+                                       maximums))
+                (setq maximums (window-largest-empty-rectangle--maximums
+                                (list top-size top-width top-at top-to)
+                                maximums count)))
+            (when (> top-size max-size)
+              (setq max-size top-size)
+              (setq max-width top-width)
+              (setq max-at top-at)
+              (setq max-to top-to))))
+        (if (and stack (> (caar stack) (car row)))
+            ;; Have new top element of stack include old top.
+            (setq stack (cons (cons (caar stack) (cdr top)) (cdr stack)))
+          ;; Move rows-at backwards to top-at.
+          (setq rows-at top-at))))
 
     (when stack
       ;; STACK-TO is the position where the stack ends.
       (setq stack-to (cdar stack))
       (while stack
-	(setq top (car stack))
-	(setq stack (cdr stack))
-	(setq top-width (car top))
-	(setq top-at (if stack (cdar stack) stack-at))
-	(setq top-size (* top-width (- stack-to top-at)))
-	(unless (or (and min-width (< top-width min-width))
-		    (and min-height (< (- stack-to top-at) min-height))
-		    (and positions
-			 (or (> top-at (car positions))
-			     (< stack-to (cdr positions)))))
-	  (if count
-	      (if disjoint
-		  (setq maximums (cons (list top-size top-width top-at stack-to)
-				       maximums))
-		(setq maximums (window-largest-empty-rectangle--maximums
-				(list top-size top-width top-at stack-to)
-				maximums count)))
-	    (when (> top-size max-size)
-	      (setq max-size top-size)
-	      (setq max-width top-width)
-	      (setq max-at top-at)
-	      (setq max-to stack-to))))))
+        (setq top (car stack))
+        (setq stack (cdr stack))
+        (setq top-width (car top))
+        (setq top-at (if stack (cdar stack) stack-at))
+        (setq top-size (* top-width (- stack-to top-at)))
+        (unless (or (and min-width (< top-width min-width))
+                    (and min-height (< (- stack-to top-at) min-height))
+                    (and positions
+                         (or (> top-at (car positions))
+                             (< stack-to (cdr positions)))))
+          (if count
+              (if disjoint
+                  (setq maximums (cons (list top-size top-width top-at stack-to)
+                                       maximums))
+                (setq maximums (window-largest-empty-rectangle--maximums
+                                (list top-size top-width top-at stack-to)
+                                maximums count)))
+            (when (> top-size max-size)
+              (setq max-size top-size)
+              (setq max-width top-width)
+              (setq max-at top-at)
+              (setq max-to stack-to))))))
 
     (cond
      (maximums
       (if disjoint
-	  (window-largest-empty-rectangle--disjoint-maximums maximums count)
-	maximums))
+          (window-largest-empty-rectangle--disjoint-maximums maximums count)
+        maximums))
      ((> max-size 0)
       (list max-width max-at max-to)))))
 \f
@@ -9491,21 +9491,21 @@ buffers displaying right to left text."
   "Kill the current buffer and delete the selected window."
   (interactive)
   (let ((window-to-delete (selected-window))
-	(buffer-to-kill (current-buffer))
-	(delete-window-hook (lambda () (ignore-errors (delete-window)))))
+        (buffer-to-kill (current-buffer))
+        (delete-window-hook (lambda () (ignore-errors (delete-window)))))
     (unwind-protect
-	(progn
-	  (add-hook 'kill-buffer-hook delete-window-hook t t)
-	  (if (kill-buffer (current-buffer))
-	      ;; If `delete-window' failed before, we rerun it to regenerate
-	      ;; the error so it can be seen in the echo area.
-	      (when (eq (selected-window) window-to-delete)
-		(delete-window))))
+        (progn
+          (add-hook 'kill-buffer-hook delete-window-hook t t)
+          (if (kill-buffer (current-buffer))
+              ;; If `delete-window' failed before, we rerun it to regenerate
+              ;; the error so it can be seen in the echo area.
+              (when (eq (selected-window) window-to-delete)
+                (delete-window))))
       ;; If the buffer is not dead for some reason (probably because
       ;; of a `quit' signal), remove the hook again.
       (ignore-errors
-       (with-current-buffer buffer-to-kill
-	 (remove-hook 'kill-buffer-hook delete-window-hook t))))))
+        (with-current-buffer buffer-to-kill
+          (remove-hook 'kill-buffer-hook delete-window-hook t))))))
 
 \f
 ;;;
@@ -9672,11 +9672,11 @@ the specified absolute window-line.  Float number between 0.0 and 1.0
 means the percentage of the screen space from the top.  The default
 cycling order is middle -> top -> bottom."
   :type '(repeat (choice
-		  (const :tag "Top" top)
-		  (const :tag "Middle" middle)
-		  (const :tag "Bottom" bottom)
-		  (integer :tag "Line number")
-		  (float :tag "Percentage")))
+                  (const :tag "Top" top)
+                  (const :tag "Middle" middle)
+                  (const :tag "Bottom" bottom)
+                  (integer :tag "Line number")
+                  (float :tag "Percentage")))
   :version "23.2"
   :group 'windows)
 
@@ -9693,23 +9693,23 @@ A prefix argument is handled like `recenter':
    (arg (recenter arg t))                 ; Always respect ARG.
    (t
     (setq recenter-last-op
-	  (if (eq this-command last-command)
-	      (car (or (cdr (member recenter-last-op recenter-positions))
-		       recenter-positions))
-	    (car recenter-positions)))
+          (if (eq this-command last-command)
+              (car (or (cdr (member recenter-last-op recenter-positions))
+                       recenter-positions))
+            (car recenter-positions)))
     (let ((this-scroll-margin
-	   (min (max 0 scroll-margin)
-		(truncate (/ (window-body-height) 4.0)))))
+           (min (max 0 scroll-margin)
+                (truncate (/ (window-body-height) 4.0)))))
       (cond ((eq recenter-last-op 'middle)
-	     (recenter nil t))
-	    ((eq recenter-last-op 'top)
-	     (recenter this-scroll-margin t))
-	    ((eq recenter-last-op 'bottom)
-	     (recenter (- -1 this-scroll-margin) t))
-	    ((integerp recenter-last-op)
-	     (recenter recenter-last-op t))
-	    ((floatp recenter-last-op)
-	     (recenter (round (* recenter-last-op (window-height))) t)))))))
+             (recenter nil t))
+            ((eq recenter-last-op 'top)
+             (recenter this-scroll-margin t))
+            ((eq recenter-last-op 'bottom)
+             (recenter (- -1 this-scroll-margin) t))
+            ((integerp recenter-last-op)
+             (recenter recenter-last-op t))
+            ((floatp recenter-last-op)
+             (recenter (round (* recenter-last-op (window-height))) t)))))))
 
 (define-key global-map [?\C-l] 'recenter-top-bottom)
 
@@ -9723,26 +9723,26 @@ Successive calls position point at positions defined
 by `recenter-positions'."
   (interactive "P")
   (cond
-   (arg (move-to-window-line arg))	; Always respect ARG.
+   (arg (move-to-window-line arg))      ; Always respect ARG.
    (t
     (setq recenter-last-op
-	  (if (eq this-command last-command)
-	      (car (or (cdr (member recenter-last-op recenter-positions))
-		       recenter-positions))
-	    (car recenter-positions)))
+          (if (eq this-command last-command)
+              (car (or (cdr (member recenter-last-op recenter-positions))
+                       recenter-positions))
+            (car recenter-positions)))
     (let ((this-scroll-margin
-	   (min (max 0 scroll-margin)
-		(truncate (/ (window-body-height) 4.0)))))
+           (min (max 0 scroll-margin)
+                (truncate (/ (window-body-height) 4.0)))))
       (cond ((eq recenter-last-op 'middle)
-	     (call-interactively 'move-to-window-line))
-	    ((eq recenter-last-op 'top)
-	     (move-to-window-line this-scroll-margin))
-	    ((eq recenter-last-op 'bottom)
-	     (move-to-window-line (- -1 this-scroll-margin)))
-	    ((integerp recenter-last-op)
-	     (move-to-window-line recenter-last-op))
-	    ((floatp recenter-last-op)
-	     (move-to-window-line (round (* recenter-last-op (window-height))))))))))
+             (call-interactively 'move-to-window-line))
+            ((eq recenter-last-op 'top)
+             (move-to-window-line this-scroll-margin))
+            ((eq recenter-last-op 'bottom)
+             (move-to-window-line (- -1 this-scroll-margin)))
+            ((integerp recenter-last-op)
+             (move-to-window-line recenter-last-op))
+            ((floatp recenter-last-op)
+             (move-to-window-line (round (* recenter-last-op (window-height))))))))))
 
 (define-key global-map [?\M-r] 'move-to-window-line-top-bottom)
 \f
@@ -9779,18 +9779,18 @@ If ARG is the atom `-', scroll downward by nearly full screen."
    ((< (prefix-numeric-value arg) 0)
     (scroll-down-command (- (prefix-numeric-value arg))))
    ((eobp)
-    (scroll-up arg))			; signal error
+    (scroll-up arg))                    ; signal error
    (t
     (condition-case nil
-	(scroll-up arg)
+        (scroll-up arg)
       (end-of-buffer
        (if arg
-	   ;; When scrolling by ARG lines can't be done,
-	   ;; move by ARG lines instead.
-	   (forward-line arg)
-	 ;; When ARG is nil for full-screen scrolling,
-	 ;; move to the bottom of the buffer.
-	 (goto-char (point-max))))))))
+           ;; When scrolling by ARG lines can't be done,
+           ;; move by ARG lines instead.
+           (forward-line arg)
+         ;; When ARG is nil for full-screen scrolling,
+         ;; move to the bottom of the buffer.
+         (goto-char (point-max))))))))
 
 (put 'scroll-up-command 'scroll-command t)
 
@@ -9811,18 +9811,18 @@ If ARG is the atom `-', scroll upward by nearly full screen."
    ((< (prefix-numeric-value arg) 0)
     (scroll-up-command (- (prefix-numeric-value arg))))
    ((bobp)
-    (scroll-down arg))			; signal error
+    (scroll-down arg))                  ; signal error
    (t
     (condition-case nil
-	(scroll-down arg)
+        (scroll-down arg)
       (beginning-of-buffer
        (if arg
-	   ;; When scrolling by ARG lines can't be done,
-	   ;; move by ARG lines instead.
-	   (forward-line (- arg))
-	 ;; When ARG is nil for full-screen scrolling,
-	 ;; move to the top of the buffer.
-	 (goto-char (point-min))))))))
+           ;; When scrolling by ARG lines can't be done,
+           ;; move by ARG lines instead.
+           (forward-line (- arg))
+         ;; When ARG is nil for full-screen scrolling,
+         ;; move to the top of the buffer.
+         (goto-char (point-min))))))))
 
 (put 'scroll-down-command 'scroll-command t)
 
@@ -9892,13 +9892,13 @@ scrollbar interaction) and `select' (the next invocation of
   "Cancel delayed window autoselection.
 Optional argument FORCE means cancel unconditionally."
   (unless (and (not force)
-	       ;; Don't cancel for select-window or select-frame events
-	       ;; or when the user drags a scroll bar.
-	       (or (memq this-command
-			 '(handle-select-window handle-switch-frame))
-		   (and (eq this-command 'scroll-bar-toolkit-scroll)
-			(memq (nth 4 (event-end last-input-event))
-			      '(handle end-scroll)))))
+               ;; Don't cancel for select-window or select-frame events
+               ;; or when the user drags a scroll bar.
+               (or (memq this-command
+                         '(handle-select-window handle-switch-frame))
+                   (and (eq this-command 'scroll-bar-toolkit-scroll)
+                        (memq (nth 4 (event-end last-input-event))
+                              '(handle end-scroll)))))
     (setq mouse-autoselect-window-state nil)
     (setq mouse-autoselect-window-position-1 nil)
     (when (timerp mouse-autoselect-window-timer)
@@ -9918,8 +9918,8 @@ means suspend autoselection."
   ;; Install timer which runs `mouse-autoselect-window-select' after
   ;; `mouse-autoselect-window' seconds.
   (setq mouse-autoselect-window-timer
-	(run-at-time
-	 (abs mouse-autoselect-window) nil 'mouse-autoselect-window-select)))
+        (run-at-time
+         (abs mouse-autoselect-window) nil 'mouse-autoselect-window-select)))
 
 (defun mouse-autoselect-window-select ()
   "Select window with delayed window autoselection.
@@ -9934,16 +9934,16 @@ is active.  This function is run by `mouse-autoselect-window-timer'."
          (frame (and mouse-x mouse-y (car mouse-position)))
          (window (and frame (window-at mouse-x mouse-y frame))))
     (cond
-      ((or (and (fboundp 'menu-or-popup-active-p) (menu-or-popup-active-p))
-	   (and window
-		(let ((coords (coordinates-in-window-p
-			       (cdr mouse-position) window)))
-		  (and (not (consp coords))
-		       (not (memq coords '(left-margin right-margin)))))))
-       ;; A menu / popup dialog is active or the mouse is not on the
-       ;; text region of WINDOW: Suspend autoselection temporarily.
-       (mouse-autoselect-window-start mouse-position nil t))
-      ((or (eq mouse-autoselect-window-state 'suspend)
+     ((or (and (fboundp 'menu-or-popup-active-p) (menu-or-popup-active-p))
+          (and window
+               (let ((coords (coordinates-in-window-p
+                              (cdr mouse-position) window)))
+                 (and (not (consp coords))
+                      (not (memq coords '(left-margin right-margin)))))))
+      ;; A menu / popup dialog is active or the mouse is not on the
+      ;; text region of WINDOW: Suspend autoselection temporarily.
+      (mouse-autoselect-window-start mouse-position nil t))
+     ((or (eq mouse-autoselect-window-state 'suspend)
           ;; When the mouse is at its first recorded position, restart
           ;; delayed autoselection.  This works around a scenario with
           ;; two two-window frames with identical dimensions: select the
@@ -9988,11 +9988,11 @@ is active.  This function is run by `mouse-autoselect-window-timer'."
       ;; Mouse position has stabilized at
       ;; `mouse-autoselect-window-position': Cancel delayed
       ;; autoselection.
-     (mouse-autoselect-window-cancel t))
-    (window
-     ;; Mouse position has not stabilized yet, resume delayed
-     ;; autoselection.
-     (mouse-autoselect-window-start mouse-position window)))))
+      (mouse-autoselect-window-cancel t))
+     (window
+      ;; Mouse position has not stabilized yet, resume delayed
+      ;; autoselection.
+      (mouse-autoselect-window-start mouse-position window)))))
 
 (declare-function display-multi-frame-p "frame" (&optional display))
 
@@ -10003,19 +10003,19 @@ is active.  This function is run by `mouse-autoselect-window-timer'."
          (frame (and (window-live-p window) (window-frame window)))
          (old-frame (selected-frame)))
     (unless (or (not (window-live-p window))
-		;; Don't switch when autoselection shall be delayed.
-		(and (numberp mouse-autoselect-window)
-		     (not (eq mouse-autoselect-window-state 'select))
-		     (let ((position (mouse-position)))
-		       ;; Cancel any delayed autoselection.
-		       (mouse-autoselect-window-cancel t)
-		       ;; Start delayed autoselection from current mouse
-		       ;; position and window.
-		       (setq mouse-autoselect-window-position-1 position)
-		       (mouse-autoselect-window-start position window)
-		       ;; Executing a command cancels delayed autoselection.
-		       (add-hook
-			'pre-command-hook 'mouse-autoselect-window-cancel)))
+                ;; Don't switch when autoselection shall be delayed.
+                (and (numberp mouse-autoselect-window)
+                     (not (eq mouse-autoselect-window-state 'select))
+                     (let ((position (mouse-position)))
+                       ;; Cancel any delayed autoselection.
+                       (mouse-autoselect-window-cancel t)
+                       ;; Start delayed autoselection from current mouse
+                       ;; position and window.
+                       (setq mouse-autoselect-window-position-1 position)
+                       (mouse-autoselect-window-start position window)
+                       ;; Executing a command cancels delayed autoselection.
+                       (add-hook
+                        'pre-command-hook 'mouse-autoselect-window-cancel)))
                 ;; Don't switch to a `no-accept-focus' frame unless it's
                 ;; already selected.
                 (and (not (eq frame (selected-frame)))
@@ -10060,9 +10060,9 @@ Otherwise, consult the value of `truncate-partial-width-windows'
   (setq window (window-normalize-window window t))
   (unless (window-full-width-p window)
     (let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows
-				       (window-buffer window))))
+                                       (window-buffer window))))
       (if (integerp t-p-w-w)
-	  (< (window-width window) t-p-w-w)
+          (< (window-width window) t-p-w-w)
         t-p-w-w))))
 
 \f
@@ -10090,9 +10090,9 @@ overrides the global or buffer-local value of
 `window-adjust-process-window-size-function'."
   :type '(choice
           (const :tag "Minimum area of any window"
-           window-adjust-process-window-size-smallest)
+                 window-adjust-process-window-size-smallest)
           (const :tag "Maximum area of any window"
-           window-adjust-process-window-size-largest)
+                 window-adjust-process-window-size-largest)
           (const :tag "Do not adjust process window sizes" ignore)
           function)
   :group 'windows
-- 
2.27.0.windows.1


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

end of thread, other threads:[~2020-08-18 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-18 14:02 bug#42914: [PATCH] Fixed indentation and mix used of space and tabs Jen-Chieh Shen
2020-08-18 14:11 ` Eli Zaretskii
2020-08-18 14:13 ` Lars Ingebrigtsen

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.