aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKenichi Handa2012-08-22 18:03:03 +0900
committerKenichi Handa2012-08-22 18:03:03 +0900
commit4ff819d728960bf5e52b72501c606f4bb3fde028 (patch)
treed8f0d96db0215f253bd0a4bbf7b9cda177e662ce /lisp
parentd75ffb4ed0b2e72a9361a07d16a5c884a9459728 (diff)
parent8223e9280fa69afeeae1a8b51735cbb8393f2e8d (diff)
downloademacs-4ff819d728960bf5e52b72501c606f4bb3fde028.tar.gz
emacs-4ff819d728960bf5e52b72501c606f4bb3fde028.zip
merge trunk
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog30
-rw-r--r--lisp/mouse.el14
-rw-r--r--lisp/net/tramp-sh.el75
-rw-r--r--lisp/window.el154
4 files changed, 170 insertions, 103 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7c67bb1b5b2..6be54850414 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,36 @@
12012-08-17 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp-sh.el (tramp-sh-handle-start-file-process): Eliminate
4 superfluous prompt. (Bug#12203)
5
62012-08-17 Chong Yidong <cyd@gnu.org>
7
8 * mouse.el (mouse-appearance-menu): If x-select-font returns a
9 font spec, set the font directly (Bug#3228).
10
112012-08-17 Martin Rudalics <rudalics@gmx.at>
12
13 * window.el (delete-window): Fix last fix.
14
12012-08-16 Martin Rudalics <rudalics@gmx.at> 152012-08-16 Martin Rudalics <rudalics@gmx.at>
2 16
3 * window.el (window-valid-p): Move to window.c. 17 * window.el (window-valid-p): Move to window.c.
18 (window-child, window-child-count, window-last-child)
19 (window-normalize-window, window-combined-p)
20 (window-combinations, window-atom-root, window-min-size)
21 (window-sizable, window-sizable-p, window-size-fixed-p)
22 (window-min-delta, window-max-delta, window--resizable)
23 (window--resizable-p, window-resizable, window-total-size)
24 (window-full-height-p, window-full-width-p, window-body-size)
25 (window-at-side-p, adjust-window-trailing-edge, maximize-window)
26 (minimize-window, window-deletable-p, delete-window)
27 (delete-other-windows, set-window-buffer-start-and-point)
28 (next-buffer, previous-buffer, split-window, balance-windows-2)
29 (set-window-text-height, window-buffer-height)
30 (fit-window-to-buffer, shrink-window-if-larger-than-buffer)
31 (truncated-partial-width-window-p): Minor code adjustments. In
32 doc-strings state whether the argument window has to denote a
33 live, valid or any window.
4 34
52012-08-16 Phil Sainty <psainty@orcon.net.nz> (tiny change) 352012-08-16 Phil Sainty <psainty@orcon.net.nz> (tiny change)
6 36
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 589bbd67b1b..4ea84288f69 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1951,12 +1951,14 @@ choose a font."
1951 (choice 1951 (choice
1952 ;; Either choice == 'x-select-font, or choice is a 1952 ;; Either choice == 'x-select-font, or choice is a
1953 ;; symbol whose name is a font. 1953 ;; symbol whose name is a font.
1954 (buffer-face-mode-invoke (font-face-attributes 1954 (let ((font (if (eq choice 'x-select-font)
1955 (if (eq choice 'x-select-font) 1955 (x-select-font)
1956 (x-select-font) 1956 (symbol-name choice))))
1957 (symbol-name choice))) 1957 (buffer-face-mode-invoke
1958 t 1958 (if (fontp font 'font-spec)
1959 (called-interactively-p 'interactive)))))))) 1959 (list :font font)
1960 (font-face-attributes font))
1961 t (called-interactively-p 'interactive)))))))))
1960 1962
1961 1963
1962;;; Bindings for mouse commands. 1964;;; Bindings for mouse commands.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e757247c2a2..6283188d46a 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2738,51 +2738,64 @@ the result will be a local, non-Tramp, filename."
2738 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) 2738 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
2739 (name1 name) 2739 (name1 name)
2740 (i 0)) 2740 (i 0))
2741 (unwind-protect 2741
2742 (save-excursion 2742 (unless buffer
2743 (save-restriction 2743 ;; BUFFER can be nil. We use a temporary buffer.
2744 (unless buffer 2744 (setq buffer (generate-new-buffer tramp-temp-buffer-name)))
2745 ;; BUFFER can be nil. We use a temporary buffer. 2745 (while (get-process name1)
2746 (setq buffer (generate-new-buffer tramp-temp-buffer-name))) 2746 ;; NAME must be unique as process name.
2747 (while (get-process name1) 2747 (setq i (1+ i)
2748 ;; NAME must be unique as process name. 2748 name1 (format "%s<%d>" name i)))
2749 (setq i (1+ i) 2749 (setq name name1)
2750 name1 (format "%s<%d>" name i))) 2750 ;; Set the new process properties.
2751 (setq name name1) 2751 (tramp-set-connection-property v "process-name" name)
2752 ;; Set the new process properties. 2752 (tramp-set-connection-property v "process-buffer" buffer)
2753 (tramp-set-connection-property v "process-name" name) 2753
2754 (tramp-set-connection-property v "process-buffer" buffer) 2754 (with-current-buffer (tramp-get-connection-buffer v)
2755 ;; Activate narrowing in order to save BUFFER contents. 2755 (unwind-protect
2756 ;; Clear also the modification time; otherwise we might 2756 (save-excursion
2757 ;; be interrupted by `verify-visited-file-modtime'. 2757 (save-restriction
2758 (with-current-buffer (tramp-get-connection-buffer v) 2758 ;; Activate narrowing in order to save BUFFER
2759 (let ((buffer-undo-list t)) 2759 ;; contents. Clear also the modification time;
2760 ;; otherwise we might be interrupted by
2761 ;; `verify-visited-file-modtime'.
2762 (let ((buffer-undo-list t)
2763 (buffer-read-only nil)
2764 (mark (point)))
2760 (clear-visited-file-modtime) 2765 (clear-visited-file-modtime)
2761 (narrow-to-region (point-max) (point-max)) 2766 (narrow-to-region (point-max) (point-max))
2767 ;; We call `tramp-maybe-open-connection', in order
2768 ;; to cleanup the prompt afterwards.
2769 (tramp-maybe-open-connection v)
2770 (widen)
2771 (delete-region mark (point))
2772 (narrow-to-region (point-max) (point-max))
2773 ;; Now do it.
2762 (if command 2774 (if command
2763 ;; Send the command. 2775 ;; Send the command.
2764 (tramp-send-command v command nil t) ; nooutput 2776 (tramp-send-command v command nil t) ; nooutput
2765 ;; Check, whether a pty is associated. 2777 ;; Check, whether a pty is associated.
2766 (tramp-maybe-open-connection v)
2767 (unless (tramp-compat-process-get 2778 (unless (tramp-compat-process-get
2768 (tramp-get-connection-process v) 'remote-tty) 2779 (tramp-get-connection-process v) 'remote-tty)
2769 (tramp-error 2780 (tramp-error
2770 v 'file-error 2781 v 'file-error
2771 "pty association is not supported for `%s'" name))))) 2782 "pty association is not supported for `%s'" name))))
2772 (let ((p (tramp-get-connection-process v))) 2783 (let ((p (tramp-get-connection-process v)))
2773 ;; Set query flag for this process. 2784 ;; Set query flag for this process. We ignore errors,
2774 (tramp-compat-set-process-query-on-exit-flag p t) 2785 ;; because the process could have finished already.
2775 ;; Return process. 2786 (ignore-errors
2776 p))) 2787 (tramp-compat-set-process-query-on-exit-flag p t))
2777 ;; Save exit. 2788 ;; Return process.
2778 (with-current-buffer (tramp-get-connection-buffer v) 2789 p)))
2790
2791 ;; Save exit.
2779 (if (string-match tramp-temp-buffer-name (buffer-name)) 2792 (if (string-match tramp-temp-buffer-name (buffer-name))
2780 (progn 2793 (progn
2781 (set-process-buffer (tramp-get-connection-process v) nil) 2794 (set-process-buffer (tramp-get-connection-process v) nil)
2782 (kill-buffer (current-buffer))) 2795 (kill-buffer (current-buffer)))
2783 (set-buffer-modified-p bmp))) 2796 (set-buffer-modified-p bmp))
2784 (tramp-set-connection-property v "process-name" nil) 2797 (tramp-set-connection-property v "process-name" nil)
2785 (tramp-set-connection-property v "process-buffer" nil))))) 2798 (tramp-set-connection-property v "process-buffer" nil))))))
2786 2799
2787(defun tramp-sh-handle-process-file 2800(defun tramp-sh-handle-process-file
2788 (program &optional infile destination display &rest args) 2801 (program &optional infile destination display &rest args)
diff --git a/lisp/window.el b/lisp/window.el
index d7129df8585..142e80e1666 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -91,11 +91,13 @@ be any window."
91 (and window (window-parent window) (window-prev-sibling window))) 91 (and window (window-parent window) (window-prev-sibling window)))
92 92
93(defun window-child (window) 93(defun window-child (window)
94 "Return WINDOW's first child window." 94 "Return WINDOW's first child window.
95WINDOW can be any window."
95 (or (window-top-child window) (window-left-child window))) 96 (or (window-top-child window) (window-left-child window)))
96 97
97(defun window-child-count (window) 98(defun window-child-count (window)
98 "Return number of WINDOW's child windows." 99 "Return number of WINDOW's child windows.
100WINDOW can be any window."
99 (let ((count 0)) 101 (let ((count 0))
100 (when (and (windowp window) (setq window (window-child window))) 102 (when (and (windowp window) (setq window (window-child window)))
101 (while window 103 (while window
@@ -104,7 +106,8 @@ be any window."
104 count)) 106 count))
105 107
106(defun window-last-child (window) 108(defun window-last-child (window)
107 "Return last child window of WINDOW." 109 "Return last child window of WINDOW.
110WINDOW can be any window."
108 (when (and (windowp window) (setq window (window-child window))) 111 (when (and (windowp window) (setq window (window-child window)))
109 (while (window-next-sibling window) 112 (while (window-next-sibling window)
110 (setq window (window-next-sibling window)))) 113 (setq window (window-next-sibling window))))
@@ -135,20 +138,22 @@ FRAME must be a live frame and defaults to the selected frame."
135 (selected-frame))) 138 (selected-frame)))
136 139
137(defun window-normalize-window (window &optional live-only) 140(defun window-normalize-window (window &optional live-only)
138 "Return window specified by WINDOW. 141 "Return the window specified by WINDOW.
139If WINDOW is nil, return `selected-window'. 142If WINDOW is nil, return the selected window. Otherwise, if
140If WINDOW is a live window or internal window, return WINDOW; 143WINDOW is a live or an internal window, return WINDOW; if
141 if LIVE-ONLY is non-nil, return WINDOW for a live window only. 144LIVE-ONLY is non-nil, return WINDOW for a live window only.
142Otherwise, signal an error." 145Otherwise, signal an error."
143 (cond ((null window) 146 (cond
144 (selected-window)) 147 ((null window)
145 (live-only 148 (selected-window))
146 (if (window-live-p window) 149 (live-only
147 window 150 (if (window-live-p window)
148 (error "%s is not a live window" window))) 151 window
149 ((if (window-valid-p window) 152 (error "%s is not a live window" window)))
150 window 153 ((window-valid-p window)
151 (error "%s is not a window" window))))) 154 window)
155 (t
156 (error "%s is not a valid window" window))))
152 157
153(defvar ignore-window-parameters nil 158(defvar ignore-window-parameters nil
154 "If non-nil, standard functions ignore window parameters. 159 "If non-nil, standard functions ignore window parameters.
@@ -199,7 +204,7 @@ narrower, explicitly specify the SIZE argument of that function."
199 204
200(defun window-combined-p (&optional window horizontal) 205(defun window-combined-p (&optional window horizontal)
201 "Return non-nil if WINDOW has siblings in a given direction. 206 "Return non-nil if WINDOW has siblings in a given direction.
202If WINDOW is omitted or nil, it defaults to the selected window. 207WINDOW must be a valid window and defaults to the selected one.
203 208
204HORIZONTAL determines a direction for the window combination. 209HORIZONTAL determines a direction for the window combination.
205If HORIZONTAL is omitted or nil, return non-nil if WINDOW is part 210If HORIZONTAL is omitted or nil, return non-nil if WINDOW is part
@@ -215,7 +220,7 @@ horizontal window combination."
215 220
216(defun window-combinations (window &optional horizontal) 221(defun window-combinations (window &optional horizontal)
217 "Return largest number of windows vertically arranged within WINDOW. 222 "Return largest number of windows vertically arranged within WINDOW.
218If WINDOW is omitted or nil, it defaults to the selected window. 223WINDOW must be a valid window and defaults to the selected one.
219If HORIZONTAL is non-nil, return the largest number of 224If HORIZONTAL is non-nil, return the largest number of
220windows horizontally arranged within WINDOW." 225windows horizontally arranged within WINDOW."
221 (setq window (window-normalize-window window)) 226 (setq window (window-normalize-window window))
@@ -313,7 +318,7 @@ too."
313;;; Atomic windows. 318;;; Atomic windows.
314(defun window-atom-root (&optional window) 319(defun window-atom-root (&optional window)
315 "Return root of atomic window WINDOW is a part of. 320 "Return root of atomic window WINDOW is a part of.
316WINDOW can be any window and defaults to the selected one. 321WINDOW must be a valid window and defaults to the selected one.
317Return nil if WINDOW is not part of an atomic window." 322Return nil if WINDOW is not part of an atomic window."
318 (setq window (window-normalize-window window)) 323 (setq window (window-normalize-window window))
319 (let (root) 324 (let (root)
@@ -517,10 +522,10 @@ window).")
517 522
518(defun window-min-size (&optional window horizontal ignore) 523(defun window-min-size (&optional window horizontal ignore)
519 "Return the minimum size of WINDOW. 524 "Return the minimum size of WINDOW.
520WINDOW can be an arbitrary window and defaults to the selected 525WINDOW must be a valid window and defaults to the selected one.
521one. Optional argument HORIZONTAL non-nil means return the 526Optional argument HORIZONTAL non-nil means return the minimum
522minimum number of columns of WINDOW; otherwise return the minimum 527number of columns of WINDOW; otherwise return the minimum number
523number of WINDOW's lines. 528of WINDOW's lines.
524 529
525Optional argument IGNORE, if non-nil, means ignore restrictions 530Optional argument IGNORE, if non-nil, means ignore restrictions
526imposed by fixed size windows, `window-min-height' or 531imposed by fixed size windows, `window-min-height' or
@@ -600,6 +605,7 @@ means ignore all of the above restrictions for all windows."
600 605
601(defun window-sizable (window delta &optional horizontal ignore) 606(defun window-sizable (window delta &optional horizontal ignore)
602 "Return DELTA if DELTA lines can be added to WINDOW. 607 "Return DELTA if DELTA lines can be added to WINDOW.
608WINDOW must be a valid window and defaults to the selected one.
603Optional argument HORIZONTAL non-nil means return DELTA if DELTA 609Optional argument HORIZONTAL non-nil means return DELTA if DELTA
604columns can be added to WINDOW. A return value of zero means 610columns can be added to WINDOW. A return value of zero means
605that no lines (or columns) can be added to WINDOW. 611that no lines (or columns) can be added to WINDOW.
@@ -641,6 +647,7 @@ ignore all of the above restrictions for all windows."
641 647
642(defun window-sizable-p (window delta &optional horizontal ignore) 648(defun window-sizable-p (window delta &optional horizontal ignore)
643 "Return t if WINDOW can be resized by DELTA lines. 649 "Return t if WINDOW can be resized by DELTA lines.
650WINDOW must be a valid window and defaults to the selected one.
644For the meaning of the arguments of this function see the 651For the meaning of the arguments of this function see the
645doc-string of `window-sizable'." 652doc-string of `window-sizable'."
646 (setq window (window-normalize-window window)) 653 (setq window (window-normalize-window window))
@@ -683,9 +690,9 @@ doc-string of `window-sizable'."
683 690
684(defun window-size-fixed-p (&optional window horizontal) 691(defun window-size-fixed-p (&optional window horizontal)
685 "Return non-nil if WINDOW's height is fixed. 692 "Return non-nil if WINDOW's height is fixed.
686WINDOW can be an arbitrary window and defaults to the selected 693WINDOW must be a valid window and defaults to the selected one.
687window. Optional argument HORIZONTAL non-nil means return 694Optional argument HORIZONTAL non-nil means return non-nil if
688non-nil if WINDOW's width is fixed. 695WINDOW's width is fixed.
689 696
690If this function returns nil, this does not necessarily mean that 697If this function returns nil, this does not necessarily mean that
691WINDOW can be resized in the desired direction. The function 698WINDOW can be resized in the desired direction. The function
@@ -733,8 +740,8 @@ WINDOW can be resized in the desired direction. The function
733 740
734(defun window-min-delta (&optional window horizontal ignore trail noup nodown) 741(defun window-min-delta (&optional window horizontal ignore trail noup nodown)
735 "Return number of lines by which WINDOW can be shrunk. 742 "Return number of lines by which WINDOW can be shrunk.
736WINDOW can be an arbitrary window and defaults to the selected 743WINDOW must be a valid window and defaults to the selected one.
737window. Return zero if WINDOW cannot be shrunk. 744Return zero if WINDOW cannot be shrunk.
738 745
739Optional argument HORIZONTAL non-nil means return number of 746Optional argument HORIZONTAL non-nil means return number of
740columns by which WINDOW can be shrunk. 747columns by which WINDOW can be shrunk.
@@ -815,8 +822,8 @@ at least one other window can be enlarged appropriately."
815 822
816(defun window-max-delta (&optional window horizontal ignore trail noup nodown) 823(defun window-max-delta (&optional window horizontal ignore trail noup nodown)
817 "Return maximum number of lines by which WINDOW can be enlarged. 824 "Return maximum number of lines by which WINDOW can be enlarged.
818WINDOW can be an arbitrary window and defaults to the selected 825WINDOW must be a valid window and defaults to the selected one.
819window. The return value is zero if WINDOW cannot be enlarged. 826The return value is zero if WINDOW cannot be enlarged.
820 827
821Optional argument HORIZONTAL non-nil means return maximum number 828Optional argument HORIZONTAL non-nil means return maximum number
822of columns by which WINDOW can be enlarged. 829of columns by which WINDOW can be enlarged.
@@ -853,6 +860,7 @@ only whether other windows can be shrunk appropriately."
853;; Make NOUP also inhibit the min-size check. 860;; Make NOUP also inhibit the min-size check.
854(defun window--resizable (window delta &optional horizontal ignore trail noup nodown) 861(defun window--resizable (window delta &optional horizontal ignore trail noup nodown)
855 "Return DELTA if WINDOW can be resized vertically by DELTA lines. 862 "Return DELTA if WINDOW can be resized vertically by DELTA lines.
863WINDOW must be a valid window and defaults to the selected one.
856Optional argument HORIZONTAL non-nil means return DELTA if WINDOW 864Optional argument HORIZONTAL non-nil means return DELTA if WINDOW
857can be resized horizontally by DELTA columns. A return value of 865can be resized horizontally by DELTA columns. A return value of
858zero means that WINDOW is not resizable. 866zero means that WINDOW is not resizable.
@@ -899,6 +907,7 @@ violate size restrictions of WINDOW or its child windows."
899 907
900(defun window--resizable-p (window delta &optional horizontal ignore trail noup nodown) 908(defun window--resizable-p (window delta &optional horizontal ignore trail noup nodown)
901 "Return t if WINDOW can be resized vertically by DELTA lines. 909 "Return t if WINDOW can be resized vertically by DELTA lines.
910WINDOW must be a valid window and defaults to the selected one.
902For the meaning of the arguments of this function see the 911For the meaning of the arguments of this function see the
903doc-string of `window--resizable'." 912doc-string of `window--resizable'."
904 (setq window (window-normalize-window window)) 913 (setq window (window-normalize-window window))
@@ -910,6 +919,7 @@ doc-string of `window--resizable'."
910 919
911(defun window-resizable (window delta &optional horizontal ignore) 920(defun window-resizable (window delta &optional horizontal ignore)
912 "Return DELTA if WINDOW can be resized vertically by DELTA lines. 921 "Return DELTA if WINDOW can be resized vertically by DELTA lines.
922WINDOW must be a valid window and defaults to the selected one.
913Optional argument HORIZONTAL non-nil means return DELTA if WINDOW 923Optional argument HORIZONTAL non-nil means return DELTA if WINDOW
914can be resized horizontally by DELTA columns. A return value of 924can be resized horizontally by DELTA columns. A return value of
915zero means that WINDOW is not resizable. 925zero means that WINDOW is not resizable.
@@ -936,7 +946,7 @@ means ignore all of the above restrictions for all windows."
936 946
937(defun window-total-size (&optional window horizontal) 947(defun window-total-size (&optional window horizontal)
938 "Return the total height or width of WINDOW. 948 "Return the total height or width of WINDOW.
939If WINDOW is omitted or nil, it defaults to the selected window. 949WINDOW must be a valid window and defaults to the selected one.
940 950
941If HORIZONTAL is omitted or nil, return the total height of 951If HORIZONTAL is omitted or nil, return the total height of
942WINDOW, in lines, like `window-total-height'. Otherwise return 952WINDOW, in lines, like `window-total-height'. Otherwise return
@@ -953,8 +963,8 @@ the total width, in columns, like `window-total-width'."
953 "Return t if WINDOW is as high as its containing frame. 963 "Return t if WINDOW is as high as its containing frame.
954More precisely, return t if and only if the total height of 964More precisely, return t if and only if the total height of
955WINDOW equals the total height of the root window of WINDOW's 965WINDOW equals the total height of the root window of WINDOW's
956frame. WINDOW can be any window and defaults to the selected 966frame. WINDOW must be a valid window and defaults to the
957one." 967selected one."
958 (setq window (window-normalize-window window)) 968 (setq window (window-normalize-window window))
959 (= (window-total-size window) 969 (= (window-total-size window)
960 (window-total-size (frame-root-window window)))) 970 (window-total-size (frame-root-window window))))
@@ -963,15 +973,14 @@ one."
963 "Return t if WINDOW is as wide as its containing frame. 973 "Return t if WINDOW is as wide as its containing frame.
964More precisely, return t if and only if the total width of WINDOW 974More precisely, return t if and only if the total width of WINDOW
965equals the total width of the root window of WINDOW's frame. 975equals the total width of the root window of WINDOW's frame.
966WINDOW can be any window and defaults to the selected one." 976WINDOW must be a valid window and defaults to the selected one."
967 (setq window (window-normalize-window window)) 977 (setq window (window-normalize-window window))
968 (= (window-total-size window t) 978 (= (window-total-size window t)
969 (window-total-size (frame-root-window window) t))) 979 (window-total-size (frame-root-window window) t)))
970 980
971(defun window-body-size (&optional window horizontal) 981(defun window-body-size (&optional window horizontal)
972 "Return the height or width of WINDOW's text area. 982 "Return the height or width of WINDOW's text area.
973If WINDOW is omitted or nil, it defaults to the selected window. 983WINDOW must be a live window and defaults to the selected one.
974Signal an error if the window is not live.
975 984
976If HORIZONTAL is omitted or nil, return the height of the text 985If HORIZONTAL is omitted or nil, return the height of the text
977area, like `window-body-height'. Otherwise, return the width of 986area, like `window-body-height'. Otherwise, return the width of
@@ -1081,9 +1090,9 @@ regardless of whether that buffer is current or not."
1081 1090
1082(defun window-at-side-p (&optional window side) 1091(defun window-at-side-p (&optional window side)
1083 "Return t if WINDOW is at SIDE of its containing frame. 1092 "Return t if WINDOW is at SIDE of its containing frame.
1084WINDOW can be any window and defaults to the selected one. SIDE 1093WINDOW must be a valid window and defaults to the selected one.
1085can be any of the symbols `left', `top', `right' or `bottom'. 1094SIDE can be any of the symbols `left', `top', `right' or
1086The default value nil is handled like `bottom'." 1095`bottom'. The default value nil is handled like `bottom'."
1087 (setq window (window-normalize-window window)) 1096 (setq window (window-normalize-window window))
1088 (let ((edge 1097 (let ((edge
1089 (cond 1098 (cond
@@ -2019,7 +2028,8 @@ any windows."
2019(defun adjust-window-trailing-edge (window delta &optional horizontal) 2028(defun adjust-window-trailing-edge (window delta &optional horizontal)
2020 "Move WINDOW's bottom edge by DELTA lines. 2029 "Move WINDOW's bottom edge by DELTA lines.
2021Optional argument HORIZONTAL non-nil means move WINDOW's right 2030Optional argument HORIZONTAL non-nil means move WINDOW's right
2022edge by DELTA columns. WINDOW defaults to the selected window. 2031edge by DELTA columns. WINDOW must be a valid window and
2032defaults to the selected one.
2023 2033
2024If DELTA is greater than zero, move the edge downwards or to the 2034If DELTA is greater than zero, move the edge downwards or to the
2025right. If DELTA is less than zero, move the edge upwards or to 2035right. If DELTA is less than zero, move the edge upwards or to
@@ -2203,7 +2213,7 @@ Return nil."
2203(defun maximize-window (&optional window) 2213(defun maximize-window (&optional window)
2204 "Maximize WINDOW. 2214 "Maximize WINDOW.
2205Make WINDOW as large as possible without deleting any windows. 2215Make WINDOW as large as possible without deleting any windows.
2206WINDOW can be any window and defaults to the selected window." 2216WINDOW must be a valid window and defaults to the selected one."
2207 (interactive) 2217 (interactive)
2208 (setq window (window-normalize-window window)) 2218 (setq window (window-normalize-window window))
2209 (window-resize window (window-max-delta window)) 2219 (window-resize window (window-max-delta window))
@@ -2212,7 +2222,7 @@ WINDOW can be any window and defaults to the selected window."
2212(defun minimize-window (&optional window) 2222(defun minimize-window (&optional window)
2213 "Minimize WINDOW. 2223 "Minimize WINDOW.
2214Make WINDOW as small as possible without deleting any windows. 2224Make WINDOW as small as possible without deleting any windows.
2215WINDOW can be any window and defaults to the selected window." 2225WINDOW must be a valid window and defaults to the selected one."
2216 (interactive) 2226 (interactive)
2217 (setq window (window-normalize-window window)) 2227 (setq window (window-normalize-window window))
2218 (window-resize window (- (window-min-delta window))) 2228 (window-resize window (- (window-min-delta window)))
@@ -2368,8 +2378,8 @@ and no others."
2368;;; Deleting windows. 2378;;; Deleting windows.
2369(defun window-deletable-p (&optional window) 2379(defun window-deletable-p (&optional window)
2370 "Return t if WINDOW can be safely deleted from its frame. 2380 "Return t if WINDOW can be safely deleted from its frame.
2371Return `frame' if deleting WINDOW should also delete its 2381WINDOW must be a valid window and defaults to the selected one.
2372frame." 2382Return `frame' if deleting WINDOW should also delete its frame."
2373 (setq window (window-normalize-window window)) 2383 (setq window (window-normalize-window window))
2374 2384
2375 (unless ignore-window-parameters 2385 (unless ignore-window-parameters
@@ -2407,8 +2417,8 @@ frame."
2407 2417
2408(defun delete-window (&optional window) 2418(defun delete-window (&optional window)
2409 "Delete WINDOW. 2419 "Delete WINDOW.
2410WINDOW can be an arbitrary window and defaults to the selected 2420WINDOW must be a valid window and defaults to the selected one.
2411one. Return nil. 2421Return nil.
2412 2422
2413If the variable `ignore-window-parameters' is non-nil or the 2423If the variable `ignore-window-parameters' is non-nil or the
2414`delete-window' parameter of WINDOW equals t, do not process any 2424`delete-window' parameter of WINDOW equals t, do not process any
@@ -2419,8 +2429,9 @@ function.
2419 2429
2420Otherwise, if WINDOW is part of an atomic window, call 2430Otherwise, if WINDOW is part of an atomic window, call
2421`delete-window' with the root of the atomic window as its 2431`delete-window' with the root of the atomic window as its
2422argument. If WINDOW is the only window on its frame or the last 2432argument. Signal an error if WINDOW is either the only window on
2423non-side window, signal an error." 2433its frame, the last non-side window, or part of an atomic window
2434that is its frame's root window."
2424 (interactive) 2435 (interactive)
2425 (setq window (window-normalize-window window)) 2436 (setq window (window-normalize-window window))
2426 (let* ((frame (window-frame window)) 2437 (let* ((frame (window-frame window))
@@ -2487,7 +2498,7 @@ non-side window, signal an error."
2487 2498
2488(defun delete-other-windows (&optional window) 2499(defun delete-other-windows (&optional window)
2489 "Make WINDOW fill its frame. 2500 "Make WINDOW fill its frame.
2490WINDOW may be any window and defaults to the selected one. 2501WINDOW must be a valid window and defaults to the selected one.
2491Return nil. 2502Return nil.
2492 2503
2493If the variable `ignore-window-parameters' is non-nil or the 2504If the variable `ignore-window-parameters' is non-nil or the
@@ -2630,11 +2641,13 @@ WINDOW."
2630 2641
2631(defun set-window-buffer-start-and-point (window buffer &optional start point) 2642(defun set-window-buffer-start-and-point (window buffer &optional start point)
2632 "Set WINDOW's buffer to BUFFER. 2643 "Set WINDOW's buffer to BUFFER.
2644WINDOW must be a live window and defaults to the selected one.
2633Optional argument START non-nil means set WINDOW's start position 2645Optional argument START non-nil means set WINDOW's start position
2634to START. Optional argument POINT non-nil means set WINDOW's 2646to START. Optional argument POINT non-nil means set WINDOW's
2635point to POINT. If WINDOW is selected this also sets BUFFER's 2647point to POINT. If WINDOW is selected this also sets BUFFER's
2636`point' to POINT. If WINDOW is selected and the buffer it showed 2648`point' to POINT. If WINDOW is selected and the buffer it showed
2637before was current this also makes BUFFER the current buffer." 2649before was current this also makes BUFFER the current buffer."
2650 (setq window (window-normalize-window window t))
2638 (let ((selected (eq window (selected-window))) 2651 (let ((selected (eq window (selected-window)))
2639 (current (eq (window-buffer window) (current-buffer)))) 2652 (current (eq (window-buffer window) (current-buffer))))
2640 (set-window-buffer window buffer) 2653 (set-window-buffer window buffer)
@@ -2948,16 +2961,24 @@ displayed there."
2948(defun next-buffer () 2961(defun next-buffer ()
2949 "In selected window switch to next buffer." 2962 "In selected window switch to next buffer."
2950 (interactive) 2963 (interactive)
2951 (if (window-minibuffer-p) 2964 (cond
2952 (error "Cannot switch buffers in minibuffer window")) 2965 ((window-minibuffer-p)
2953 (switch-to-next-buffer)) 2966 (error "Cannot switch buffers in minibuffer window"))
2967 ((eq (window-dedicated-p) t)
2968 (error "Window is strongly dedicated to its buffer"))
2969 (t
2970 (switch-to-next-buffer))))
2954 2971
2955(defun previous-buffer () 2972(defun previous-buffer ()
2956 "In selected window switch to previous buffer." 2973 "In selected window switch to previous buffer."
2957 (interactive) 2974 (interactive)
2958 (if (window-minibuffer-p) 2975 (cond
2959 (error "Cannot switch buffers in minibuffer window")) 2976 ((window-minibuffer-p)
2960 (switch-to-prev-buffer)) 2977 (error "Cannot switch buffers in minibuffer window"))
2978 ((eq (window-dedicated-p) t)
2979 (error "Window is strongly dedicated to its buffer"))
2980 (t
2981 (switch-to-prev-buffer))))
2961 2982
2962(defun delete-windows-on (&optional buffer-or-name frame) 2983(defun delete-windows-on (&optional buffer-or-name frame)
2963 "Delete all windows showing BUFFER-OR-NAME. 2984 "Delete all windows showing BUFFER-OR-NAME.
@@ -3130,7 +3151,7 @@ Optional argument HORIZONTAL non-nil means return minimum width."
3130 3151
3131(defun split-window (&optional window size side) 3152(defun split-window (&optional window size side)
3132 "Make a new window adjacent to WINDOW. 3153 "Make a new window adjacent to WINDOW.
3133WINDOW can be any window and defaults to the selected one. 3154WINDOW must be a valid window and defaults to the selected one.
3134Return the new window which is always a live window. 3155Return the new window which is always a live window.
3135 3156
3136Optional argument SIZE a positive number means make WINDOW SIZE 3157Optional argument SIZE a positive number means make WINDOW SIZE
@@ -3451,7 +3472,7 @@ right, if any."
3451(defun balance-windows-2 (window horizontal) 3472(defun balance-windows-2 (window horizontal)
3452 "Subroutine of `balance-windows-1'. 3473 "Subroutine of `balance-windows-1'.
3453WINDOW must be a vertical combination (horizontal if HORIZONTAL 3474WINDOW must be a vertical combination (horizontal if HORIZONTAL
3454is non-nil." 3475is non-nil)."
3455 (let* ((first (window-child window)) 3476 (let* ((first (window-child window))
3456 (sub first) 3477 (sub first)
3457 (number-of-children 0) 3478 (number-of-children 0)
@@ -5179,9 +5200,9 @@ documentation for additional customization information."
5179 5200
5180(defun set-window-text-height (window height) 5201(defun set-window-text-height (window height)
5181 "Set the height in lines of the text display area of WINDOW to HEIGHT. 5202 "Set the height in lines of the text display area of WINDOW to HEIGHT.
5182WINDOW must be a live window. HEIGHT doesn't include the mode 5203WINDOW must be a live window and defaults to the selected one.
5183line or header line, if any, or any partial-height lines in the 5204HEIGHT doesn't include the mode line or header line, if any, or
5184text display area. 5205any partial-height lines in the text display area.
5185 5206
5186Note that the current implementation of this function cannot 5207Note that the current implementation of this function cannot
5187always set the height exactly, but attempts to be conservative, 5208always set the height exactly, but attempts to be conservative,
@@ -5248,7 +5269,9 @@ in some window."
5248 (1+ (vertical-motion (buffer-size) window)))))) 5269 (1+ (vertical-motion (buffer-size) window))))))
5249 5270
5250(defun window-buffer-height (window) 5271(defun window-buffer-height (window)
5251 "Return the height (in screen lines) of the buffer that WINDOW is displaying." 5272 "Return the height (in screen lines) of the buffer that WINDOW is displaying.
5273WINDOW must be a live window and defaults to the selected one."
5274 (setq window (window-normalize-window window t))
5252 (with-current-buffer (window-buffer window) 5275 (with-current-buffer (window-buffer window)
5253 (max 1 5276 (max 1
5254 (count-screen-lines (point-min) (point-max) 5277 (count-screen-lines (point-min) (point-max)
@@ -5260,7 +5283,7 @@ in some window."
5260;;; Resizing buffers to fit their contents exactly. 5283;;; Resizing buffers to fit their contents exactly.
5261(defun fit-window-to-buffer (&optional window max-height min-height override) 5284(defun fit-window-to-buffer (&optional window max-height min-height override)
5262 "Adjust height of WINDOW to display its buffer's contents exactly. 5285 "Adjust height of WINDOW to display its buffer's contents exactly.
5263WINDOW can be any live window and defaults to the selected one. 5286WINDOW must be a live window and defaults to the selected one.
5264 5287
5265Optional argument MAX-HEIGHT specifies the maximum height of 5288Optional argument MAX-HEIGHT specifies the maximum height of
5266WINDOW and defaults to the height of WINDOW's frame. Optional 5289WINDOW and defaults to the height of WINDOW's frame. Optional
@@ -5379,7 +5402,7 @@ WINDOW defaults to the selected window."
5379 "Shrink height of WINDOW if its buffer doesn't need so many lines. 5402 "Shrink height of WINDOW if its buffer doesn't need so many lines.
5380More precisely, shrink WINDOW vertically to be as small as 5403More precisely, shrink WINDOW vertically to be as small as
5381possible, while still showing the full contents of its buffer. 5404possible, while still showing the full contents of its buffer.
5382WINDOW defaults to the selected window. 5405WINDOW must be a live window and defaults to the selected one.
5383 5406
5384Do not shrink WINDOW to less than `window-min-height' lines. Do 5407Do not shrink WINDOW to less than `window-min-height' lines. Do
5385nothing if the buffer contains more lines than the present window 5408nothing if the buffer contains more lines than the present window
@@ -5801,13 +5824,12 @@ is active. This function is run by `mouse-autoselect-window-timer'."
5801 5824
5802(defun truncated-partial-width-window-p (&optional window) 5825(defun truncated-partial-width-window-p (&optional window)
5803 "Return non-nil if lines in WINDOW are specifically truncated due to its width. 5826 "Return non-nil if lines in WINDOW are specifically truncated due to its width.
5804WINDOW defaults to the selected window. 5827WINDOW must be a live window and defaults to the selected one.
5805Return nil if WINDOW is not a partial-width window 5828Return nil if WINDOW is not a partial-width window
5806 (regardless of the value of `truncate-lines'). 5829 (regardless of the value of `truncate-lines').
5807Otherwise, consult the value of `truncate-partial-width-windows' 5830Otherwise, consult the value of `truncate-partial-width-windows'
5808 for the buffer shown in WINDOW." 5831 for the buffer shown in WINDOW."
5809 (unless window 5832 (setq window (window-normalize-window window t))
5810 (setq window (selected-window)))
5811 (unless (window-full-width-p window) 5833 (unless (window-full-width-p window)
5812 (let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows 5834 (let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows
5813 (window-buffer window)))) 5835 (window-buffer window))))