aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-11-08 11:52:10 -0500
committerStefan Monnier2011-11-08 11:52:10 -0500
commit4b0d61e31050ecdaf003c4c3a9efd175f2b8afdd (patch)
tree4206e4f85590311f71ca478cb45c7d2ba363ecbe
parente7313f338961e383f1f27bfa3d6083814d0d09ab (diff)
downloademacs-4b0d61e31050ecdaf003c4c3a9efd175f2b8afdd.tar.gz
emacs-4b0d61e31050ecdaf003c4c3a9efd175f2b8afdd.zip
* lisp/window.el: Stay away from defsubst.
(window-list-no-nils): Remove. (window-state-get-1, window-state-get): Use backquote instead.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/window.el135
2 files changed, 73 insertions, 70 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0c12e7b3f6f..23d33e81934 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,12 @@
12011-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * window.el: Stay away from defsubst.
4 (window-list-no-nils): Remove.
5 (window-state-get-1, window-state-get): Use backquote instead.
6
12011-11-08 thierry <thierry.volpiatto@gmail.com> 72011-11-08 thierry <thierry.volpiatto@gmail.com>
2 8
3 * emacs-lisp/find-func.el (find-function-read): 9 * emacs-lisp/find-func.el (find-function-read):
4 Fix incorrect use of default argument in `completing-read'. 10 Fix incorrect use of default argument in `completing-read'.
5 11
62011-11-08 Martin Rudalics <rudalics@gmx.at> 122011-11-08 Martin Rudalics <rudalics@gmx.at>
diff --git a/lisp/window.el b/lisp/window.el
index d0ad4239a18..3242f1fd04f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -68,19 +68,19 @@ are not altered by this macro (unless they are altered in BODY)."
68;; they don't substitute the selected window for nil), and they return 68;; they don't substitute the selected window for nil), and they return
69;; nil when WINDOW doesn't have a parent (like a frame's root window or 69;; nil when WINDOW doesn't have a parent (like a frame's root window or
70;; a minibuffer window). 70;; a minibuffer window).
71(defsubst window-right (window) 71(defun window-right (window)
72 "Return WINDOW's right sibling. 72 "Return WINDOW's right sibling.
73Return nil if WINDOW is the root window of its frame. WINDOW can 73Return nil if WINDOW is the root window of its frame. WINDOW can
74be any window." 74be any window."
75 (and window (window-parent window) (window-next-sibling window))) 75 (and window (window-parent window) (window-next-sibling window)))
76 76
77(defsubst window-left (window) 77(defun window-left (window)
78 "Return WINDOW's left sibling. 78 "Return WINDOW's left sibling.
79Return nil if WINDOW is the root window of its frame. WINDOW can 79Return nil if WINDOW is the root window of its frame. WINDOW can
80be any window." 80be any window."
81 (and window (window-parent window) (window-prev-sibling window))) 81 (and window (window-parent window) (window-prev-sibling window)))
82 82
83(defsubst window-child (window) 83(defun window-child (window)
84 "Return WINDOW's first child window." 84 "Return WINDOW's first child window."
85 (or (window-top-child window) (window-left-child window))) 85 (or (window-top-child window) (window-left-child window)))
86 86
@@ -100,7 +100,7 @@ be any window."
100 (setq window (window-next-sibling window)))) 100 (setq window (window-next-sibling window))))
101 window) 101 window)
102 102
103(defsubst window-valid-p (object) 103(defun window-valid-p (object)
104 "Return t if OBJECT denotes a live window or internal window. 104 "Return t if OBJECT denotes a live window or internal window.
105Otherwise, return nil; this includes the case where OBJECT is a 105Otherwise, return nil; this includes the case where OBJECT is a
106deleted window." 106deleted window."
@@ -108,7 +108,7 @@ deleted window."
108 (or (window-buffer object) (window-child object)) 108 (or (window-buffer object) (window-child object))
109 t)) 109 t))
110 110
111(defsubst window-normalize-buffer (buffer-or-name) 111(defun window-normalize-buffer (buffer-or-name)
112 "Return buffer specified by BUFFER-OR-NAME. 112 "Return buffer specified by BUFFER-OR-NAME.
113BUFFER-OR-NAME must be either a buffer or a string naming a live 113BUFFER-OR-NAME must be either a buffer or a string naming a live
114buffer and defaults to the current buffer." 114buffer and defaults to the current buffer."
@@ -123,7 +123,7 @@ buffer and defaults to the current buffer."
123 (t 123 (t
124 (error "No such buffer %s" buffer-or-name)))) 124 (error "No such buffer %s" buffer-or-name))))
125 125
126(defsubst window-normalize-frame (frame) 126(defun window-normalize-frame (frame)
127 "Return frame specified by FRAME. 127 "Return frame specified by FRAME.
128FRAME must be a live frame and defaults to the selected frame." 128FRAME must be a live frame and defaults to the selected frame."
129 (if frame 129 (if frame
@@ -132,7 +132,7 @@ FRAME must be a live frame and defaults to the selected frame."
132 (error "%s is not a live frame" frame)) 132 (error "%s is not a live frame" frame))
133 (selected-frame))) 133 (selected-frame)))
134 134
135(defsubst window-normalize-window (window &optional live-only) 135(defun window-normalize-window (window &optional live-only)
136 "Return window specified by WINDOW. 136 "Return window specified by WINDOW.
137If WINDOW is nil, return `selected-window'. 137If WINDOW is nil, return `selected-window'.
138If WINDOW is a live window or internal window, return WINDOW; 138If WINDOW is a live window or internal window, return WINDOW;
@@ -195,7 +195,7 @@ narrower, explictly specify the SIZE argument of that function."
195 :version "24.1" 195 :version "24.1"
196 :group 'windows) 196 :group 'windows)
197 197
198(defsubst window-combined-p (&optional window horizontal) 198(defun window-combined-p (&optional window horizontal)
199 "Return non-nil if WINDOW has siblings in a given direction. 199 "Return non-nil if WINDOW has siblings in a given direction.
200If WINDOW is omitted or nil, it defaults to the selected window. 200If WINDOW is omitted or nil, it defaults to the selected window.
201 201
@@ -530,7 +530,7 @@ unless it has no other choice \(like when deleting a neighboring
530window).") 530window).")
531(make-variable-buffer-local 'window-size-fixed) 531(make-variable-buffer-local 'window-size-fixed)
532 532
533(defsubst window-size-ignore (window ignore) 533(defun window-size-ignore (window ignore)
534 "Return non-nil if IGNORE says to ignore size restrictions for WINDOW." 534 "Return non-nil if IGNORE says to ignore size restrictions for WINDOW."
535 (if (window-valid-p ignore) (eq window ignore) ignore)) 535 (if (window-valid-p ignore) (eq window ignore) ignore))
536 536
@@ -655,7 +655,7 @@ restrictions for that window only."
655 delta)) 655 delta))
656 (t 0))) 656 (t 0)))
657 657
658(defsubst window-sizable-p (window delta &optional horizontal ignore) 658(defun window-sizable-p (window delta &optional horizontal ignore)
659 "Return t if WINDOW can be resized by DELTA lines. 659 "Return t if WINDOW can be resized by DELTA lines.
660For the meaning of the arguments of this function see the 660For the meaning of the arguments of this function see the
661doc-string of `window-sizable'." 661doc-string of `window-sizable'."
@@ -935,7 +935,7 @@ the total width, in columns, like `window-total-width'."
935(defalias 'window-height 'window-total-height) 935(defalias 'window-height 'window-total-height)
936 936
937;; See discussion in bug#4543. 937;; See discussion in bug#4543.
938(defsubst window-full-height-p (&optional window) 938(defun window-full-height-p (&optional window)
939 "Return t if WINDOW is as high as the containing frame. 939 "Return t if WINDOW is as high as the containing frame.
940More precisely, return t if and only if the total height of 940More precisely, return t if and only if the total height of
941WINDOW equals the total height of the root window of WINDOW's 941WINDOW equals the total height of the root window of WINDOW's
@@ -945,7 +945,7 @@ one."
945 (= (window-total-size window) 945 (= (window-total-size window)
946 (window-total-size (frame-root-window window)))) 946 (window-total-size (frame-root-window window))))
947 947
948(defsubst window-full-width-p (&optional window) 948(defun window-full-width-p (&optional window)
949 "Return t if WINDOW is as wide as the containing frame. 949 "Return t if WINDOW is as wide as the containing frame.
950More precisely, return t if and only if the total width of WINDOW 950More precisely, return t if and only if the total width of WINDOW
951equals the total width of the root window of WINDOW's frame. 951equals the total width of the root window of WINDOW's frame.
@@ -1501,7 +1501,7 @@ instead."
1501 (t 1501 (t
1502 (error "Cannot resize window %s" window))))) 1502 (error "Cannot resize window %s" window)))))
1503 1503
1504(defsubst window--resize-child-windows-skip-p (window) 1504(defun window--resize-child-windows-skip-p (window)
1505 "Return non-nil if WINDOW shall be skipped by resizing routines." 1505 "Return non-nil if WINDOW shall be skipped by resizing routines."
1506 (memq (window-new-normal window) '(ignore stuck skip))) 1506 (memq (window-new-normal window) '(ignore stuck skip)))
1507 1507
@@ -2146,7 +2146,7 @@ WINDOW can be any window and defaults to the selected window."
2146 (window-resize window (- (window-min-delta window))) 2146 (window-resize window (- (window-min-delta window)))
2147 (window-resize window (- (window-min-delta window t)) t)) 2147 (window-resize window (- (window-min-delta window t)) t))
2148 2148
2149(defsubst frame-root-window-p (window) 2149(defun frame-root-window-p (window)
2150 "Return non-nil if WINDOW is the root window of its frame." 2150 "Return non-nil if WINDOW is the root window of its frame."
2151 (eq window (frame-root-window window))) 2151 (eq window (frame-root-window window)))
2152 2152
@@ -3019,7 +3019,7 @@ showing BUFFER-OR-NAME."
3019 (unrecord-window-buffer window buffer))))) 3019 (unrecord-window-buffer window buffer)))))
3020 3020
3021;;; Splitting windows. 3021;;; Splitting windows.
3022(defsubst window-split-min-size (&optional horizontal) 3022(defun window-split-min-size (&optional horizontal)
3023 "Return minimum height of any window when splitting windows. 3023 "Return minimum height of any window when splitting windows.
3024Optional argument HORIZONTAL non-nil means return minimum width." 3024Optional argument HORIZONTAL non-nil means return minimum width."
3025 (if horizontal 3025 (if horizontal
@@ -3562,10 +3562,6 @@ specific buffers."
3562 )) 3562 ))
3563 3563
3564;;; Window states, how to get them and how to put them in a window. 3564;;; Window states, how to get them and how to put them in a window.
3565(defsubst window-list-no-nils (&rest args)
3566 "Like LIST but do not add nil elements of ARGS."
3567 (delq nil (apply 'list args)))
3568
3569(defvar window-state-ignored-parameters '(quit-restore) 3565(defvar window-state-ignored-parameters '(quit-restore)
3570 "List of window parameters ignored by `window-state-get'.") 3566 "List of window parameters ignored by `window-state-get'.")
3571 3567
@@ -3579,46 +3575,47 @@ specific buffers."
3579 (buffer (window-buffer window)) 3575 (buffer (window-buffer window))
3580 (selected (eq window (selected-window))) 3576 (selected (eq window (selected-window)))
3581 (head 3577 (head
3582 (window-list-no-nils 3578 `(,type
3583 type 3579 ,@(unless (window-next-sibling window) `((last . t)))
3584 (unless (window-next-sibling window) (cons 'last t)) 3580 (total-height . ,(window-total-size window))
3585 (cons 'total-height (window-total-size window)) 3581 (total-width . ,(window-total-size window t))
3586 (cons 'total-width (window-total-size window t)) 3582 (normal-height . ,(window-normal-size window))
3587 (cons 'normal-height (window-normal-size window)) 3583 (normal-width . ,(window-normal-size window t))
3588 (cons 'normal-width (window-normal-size window t)) 3584 (splits . ,(window-splits window))
3589 (cons 'splits (window-splits window)) 3585 (nest . ,(window-nest window))
3590 (cons 'nest (window-nest window)) 3586 ,@(let (list)
3591 (let (list) 3587 (dolist (parameter (window-parameters window))
3592 (dolist (parameter (window-parameters window)) 3588 (unless (memq (car parameter)
3593 (unless (memq (car parameter) 3589 window-state-ignored-parameters)
3594 window-state-ignored-parameters) 3590 (setq list (cons parameter list))))
3595 (setq list (cons parameter list)))) 3591 (unless (window-parameter window 'clone-of)
3596 (unless (window-parameter window 'clone-of) 3592 ;; Make a clone-of parameter.
3597 ;; Make a clone-of parameter. 3593 (setq list (cons (cons 'clone-of window) list)))
3598 (setq list (cons (cons 'clone-of window) list))) 3594 (when list
3599 (when list 3595 `((parameters . ,list))))
3600 (cons 'parameters list))) 3596 ,@(when buffer
3601 (when buffer 3597 ;; All buffer related things go in here - make the buffer
3602 ;; All buffer related things go in here - make the buffer 3598 ;; current when retrieving `point' and `mark'.
3603 ;; current when retrieving `point' and `mark'. 3599 (with-current-buffer (window-buffer window)
3604 (with-current-buffer (window-buffer window) 3600 (let ((point (window-point-1 window))
3605 (let ((point (window-point-1 window)) 3601 (start (window-start window))
3606 (start (window-start window)) 3602 (mark (mark)))
3607 (mark (mark))) 3603 `((buffer
3608 (window-list-no-nils 3604 ,(buffer-name buffer)
3609 'buffer (buffer-name buffer) 3605 (selected . ,selected)
3610 (cons 'selected selected) 3606 ,@(when window-size-fixed
3611 (when window-size-fixed (cons 'size-fixed window-size-fixed)) 3607 `((size-fixed . ,window-size-fixed)))
3612 (cons 'hscroll (window-hscroll window)) 3608 (hscroll . ,(window-hscroll window))
3613 (cons 'fringes (window-fringes window)) 3609 (fringes . ,(window-fringes window))
3614 (cons 'margins (window-margins window)) 3610 (margins . ,(window-margins window))
3615 (cons 'scroll-bars (window-scroll-bars window)) 3611 (scroll-bars . ,(window-scroll-bars window))
3616 (cons 'vscroll (window-vscroll window)) 3612 (vscroll . ,(window-vscroll window))
3617 (cons 'dedicated (window-dedicated-p window)) 3613 (dedicated . ,(window-dedicated-p window))
3618 (cons 'point (if markers (copy-marker point) point)) 3614 (point . ,(if markers (copy-marker point) point))
3619 (cons 'start (if markers (copy-marker start) start)) 3615 (start . ,(if markers (copy-marker start) start))
3620 (when mark 3616 ,@(when mark
3621 (cons 'mark (if markers (copy-marker mark) mark))))))))) 3617 `((mark . ,(if markers
3618 (copy-marker mark) mark)))))))))))
3622 (tail 3619 (tail
3623 (when (memq type '(vc hc)) 3620 (when (memq type '(vc hc))
3624 (let (list) 3621 (let (list)
@@ -3654,16 +3651,15 @@ value can be also stored on disk and read back in a new session."
3654 (cons 3651 (cons
3655 ;; Frame related things would go into a function, say `frame-state', 3652 ;; Frame related things would go into a function, say `frame-state',
3656 ;; calling `window-state-get' to insert the frame's root window. 3653 ;; calling `window-state-get' to insert the frame's root window.
3657 (window-list-no-nils 3654 `((min-height . ,(window-min-size window))
3658 (cons 'min-height (window-min-size window)) 3655 (min-width . ,(window-min-size window t))
3659 (cons 'min-width (window-min-size window t)) 3656 (min-height-ignore . ,(window-min-size window nil t))
3660 (cons 'min-height-ignore (window-min-size window nil t)) 3657 (min-width-ignore . ,(window-min-size window t t))
3661 (cons 'min-width-ignore (window-min-size window t t)) 3658 (min-height-safe . ,(window-min-size window nil 'safe))
3662 (cons 'min-height-safe (window-min-size window nil 'safe)) 3659 (min-width-safe . ,(window-min-size window t 'safe))
3663 (cons 'min-width-safe (window-min-size window t 'safe)) 3660 ;; These are probably not needed.
3664 ;; These are probably not needed. 3661 ,@(when (window-size-fixed-p window) `((fixed-height . t)))
3665 (when (window-size-fixed-p window) (cons 'fixed-height t)) 3662 ,@(when (window-size-fixed-p window t) `((fixed-width . t))))
3666 (when (window-size-fixed-p window t) (cons 'fixed-width t)))
3667 (window-state-get-1 window markers))) 3663 (window-state-get-1 window markers)))
3668 3664
3669(defvar window-state-put-list nil 3665(defvar window-state-put-list nil
@@ -4172,6 +4168,7 @@ and (cdr ARGS) as second."
4172 (make-frame (append args special-display-frame-alist)))) 4168 (make-frame (append args special-display-frame-alist))))
4173 (window (frame-selected-window frame))) 4169 (window (frame-selected-window frame)))
4174 (display-buffer-record-window 'frame window buffer) 4170 (display-buffer-record-window 'frame window buffer)
4171 ;; FIXME: Use window--display-buffer-2?
4175 (set-window-buffer window buffer) 4172 (set-window-buffer window buffer)
4176 ;; Reset list of WINDOW's previous buffers to nil. 4173 ;; Reset list of WINDOW's previous buffers to nil.
4177 (set-window-prev-buffers window nil) 4174 (set-window-prev-buffers window nil)