[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r106334: Rewrite window-resizable.
From: |
martin rudalics |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r106334: Rewrite window-resizable. |
Date: |
Wed, 09 Nov 2011 10:36:05 +0100 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 106334
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Wed 2011-11-09 10:36:05 +0100
message:
Rewrite window-resizable.
* window.el (window-size-fixed-p): Rewrite doc-string.
(window-resizable-p): Rename to window--resizable-p. Update
callers.
(window--resizable): New function. Make all callers of
window-resizable call window--resizable instead.
(window-resizable): Rewrite in terms of window--resizable.
* windows.texi (Resizing Windows): Rewrite documentation of
window-resizable.
modified:
doc/lispref/ChangeLog
doc/lispref/windows.texi
lisp/ChangeLog
lisp/window.el
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog 2011-11-09 07:56:50 +0000
+++ b/doc/lispref/ChangeLog 2011-11-09 09:36:05 +0000
@@ -1,3 +1,8 @@
+2011-11-09 Martin Rudalics <address@hidden>
+
+ * windows.texi (Resizing Windows): Rewrite documentation of
+ window-resizable.
+
2011-11-09 Chong Yidong <address@hidden>
* windows.texi (Splitting Windows): Simplify example.
=== modified file 'doc/lispref/windows.texi'
--- a/doc/lispref/windows.texi 2011-11-09 07:56:50 +0000
+++ b/doc/lispref/windows.texi 2011-11-09 09:36:05 +0000
@@ -553,7 +553,7 @@
arguments. Resizing an internal window causes its child windows to be
resized to fit the same space.
address@hidden window-resizable window delta &optional horizontal ignore side
noup nodown
address@hidden window-resizable window delta &optional horizontal ignore
This function returns @var{delta} if the size of @var{window} can be
changed vertically by @var{delta} lines. If the optional argument
@var{horizontal} is address@hidden, it instead returns @var{delta} if
@@ -562,10 +562,11 @@
If @var{window} is @code{nil}, it defaults to the selected window.
-A positive value of @var{delta} enlarges the window by that number of
-lines or columns; a negative value of @var{delta} shrinks it. If
address@hidden is non-zero, a return value of 0 means that the window
-cannot be resized.
+A positive value of @var{delta} means to check whether the window can be
+enlarged by that number of lines or columns; a negative value of
address@hidden means to check whether the window can be shrunk by that many
+lines or columns. If @var{delta} is non-zero, a return value of 0 means
+that the window cannot be resized.
Normally, the variables @code{window-min-height} and
@code{window-min-width} specify the smallest allowable window size.
@@ -577,12 +578,6 @@
of a header (if any), a mode line, plus a text area one line tall; and
a minimum-width window as one consisting of fringes, margins, and
scroll bar (if any), plus a text area two columns wide.
-
-If the optional argument @var{noup} is address@hidden, this function
-considers a resize operation that does not alter the window parent of
address@hidden, only its siblings. If the optional argument
address@hidden is address@hidden, it does not attempt to check whether
address@hidden itself and its child windows can be resized.
@end defun
@defun window-resize window delta &optional horizontal ignore
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-11-08 19:19:36 +0000
+++ b/lisp/ChangeLog 2011-11-09 09:36:05 +0000
@@ -1,3 +1,12 @@
+2011-11-09 Martin Rudalics <address@hidden>
+
+ * window.el (window-size-fixed-p): Rewrite doc-string.
+ (window-resizable-p): Rename to window--resizable-p. Update
+ callers.
+ (window--resizable): New function. Make all callers of
+ window-resizable call window--resizable instead.
+ (window-resizable): Rewrite in terms of window--resizable.
+
2011-11-08 Glenn Morris <address@hidden>
* progmodes/delphi.el (delphi-mode-syntax-table):
=== modified file 'lisp/window.el'
--- a/lisp/window.el 2011-11-08 19:06:29 +0000
+++ b/lisp/window.el 2011-11-09 09:36:05 +0000
@@ -704,8 +704,8 @@
non-nil if WINDOW's width is fixed.
If this function returns nil, this does not necessarily mean that
-WINDOW can be resized in the desired direction. The functions
-`window-resizable' and `window-resizable-p' will tell that."
+WINDOW can be resized in the desired direction. The function
+`window-resizable' can tell that."
(window-size-fixed-1
(window-normalize-window window) horizontal))
@@ -865,14 +865,14 @@
(window-max-delta-1 window 0 horizontal ignore trail noup)))
;; Make NOUP also inhibit the min-size check.
-(defun window-resizable (window delta &optional horizontal ignore trail noup
nodown)
+(defun window--resizable (window delta &optional horizontal ignore trail noup
nodown)
"Return DELTA if WINDOW can be resized vertically by DELTA lines.
Optional argument HORIZONTAL non-nil means return DELTA if WINDOW
can be resized horizontally by DELTA columns. A return value of
zero means that WINDOW is not resizable.
DELTA positive means WINDOW shall be enlarged by DELTA lines or
-columns. If WINDOW cannot be enlarged by DELTA lines or columns
+columns. If WINDOW cannot be enlarged by DELTA lines or columns,
return the maximum value in the range 0..DELTA by which WINDOW
can be enlarged.
@@ -894,11 +894,12 @@
shrunk.
Optional argument NOUP non-nil means don't go up in the window
-tree but try to distribute the space among the other windows
-within WINDOW's combination.
+tree but check only whether space can be obtained from (or given
+to) WINDOW's siblings.
-Optional argument NODOWN non-nil means don't check whether WINDOW
-and its child windows can be resized."
+Optional argument NODOWN non-nil means don't go down in the
+window tree. This means do not check whether resizing would
+violate size restrictions of WINDOW or its child windows."
(setq window (window-normalize-window window))
(cond
((< delta 0)
@@ -909,17 +910,42 @@
delta))
(t 0)))
-(defun window-resizable-p (window delta &optional horizontal ignore trail noup
nodown)
+(defun window--resizable-p (window delta &optional horizontal ignore trail
noup nodown)
"Return t if WINDOW can be resized vertically by DELTA lines.
For the meaning of the arguments of this function see the
-doc-string of `window-resizable'."
+doc-string of `window--resizable'."
(setq window (window-normalize-window window))
(if (> delta 0)
- (>= (window-resizable window delta horizontal ignore trail noup nodown)
+ (>= (window--resizable window delta horizontal ignore trail noup nodown)
delta)
- (<= (window-resizable window delta horizontal ignore trail noup nodown)
+ (<= (window--resizable window delta horizontal ignore trail noup nodown)
delta)))
+(defun window-resizable (window delta &optional horizontal ignore)
+ "Return DELTA if WINDOW can be resized vertically by DELTA lines.
+Optional argument HORIZONTAL non-nil means return DELTA if WINDOW
+can be resized horizontally by DELTA columns. A return value of
+zero means that WINDOW is not resizable.
+
+DELTA positive means WINDOW shall be enlarged by DELTA lines or
+columns. If WINDOW cannot be enlarged by DELTA lines or columns
+return the maximum value in the range 0..DELTA by which WINDOW
+can be enlarged.
+
+DELTA negative means WINDOW shall be shrunk by -DELTA lines or
+columns. If WINDOW cannot be shrunk by -DELTA lines or columns,
+return the minimum value in the range DELTA..0 that can be used
+for shrinking WINDOW.
+
+Optional argument IGNORE non-nil means ignore any restrictions
+imposed by fixed size windows, `window-min-height' or
+`window-min-width' settings. IGNORE a window means ignore
+restrictions for that window only. IGNORE equal `safe' means
+live windows may get as small as `window-safe-min-height' lines
+and `window-safe-min-width' columns."
+ (setq window (window-normalize-window window))
+ (window--resizable window delta horizontal ignore))
+
(defun window-total-size (&optional window horizontal)
"Return the total height or width of window WINDOW.
If WINDOW is omitted or nil, it defaults to the selected window.
@@ -1475,7 +1501,7 @@
(error "Cannot resize the root window of a frame"))
((window-minibuffer-p window)
(window--resize-mini-window window delta))
- ((window-resizable-p window delta horizontal ignore)
+ ((window--resizable-p window delta horizontal ignore)
(window--resize-reset frame horizontal)
(window--resize-this-window window delta horizontal ignore t)
(if (and (not (window-splits window))
@@ -1829,7 +1855,7 @@
;; Set this-delta to what we can get from WINDOW's siblings.
(if (= (- delta) (window-total-size window horizontal))
;; A deletion, presumably. We must handle this case
- ;; specially since `window-resizable' can't be used.
+ ;; 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.
@@ -1838,7 +1864,7 @@
(setq this-delta 0))
;; Any other form of resizing.
(setq this-delta
- (window-resizable window delta horizontal ignore trail t)))
+ (window--resizable window delta horizontal ignore trail t)))
;; Set other-delta to what we still have to get from
;; ancestor windows of parent.
@@ -1904,7 +1930,7 @@
preferably only resize windows adjacent to EDGE.
This function recursively resizes WINDOW's child windows to fit the
-new size. Make sure that WINDOW is `window-resizable' before
+new size. Make sure that WINDOW is `window--resizable' before
calling this function. Note that this function does not resize
siblings of WINDOW or WINDOW's parent window. You have to
eventually call `window-resize-apply' in order to make resizing
@@ -2044,7 +2070,7 @@
;; Start resizing.
(window--resize-reset frame horizontal)
;; Try to enlarge LEFT first.
- (setq this-delta (window-resizable left delta horizontal))
+ (setq this-delta (window--resizable left delta horizontal))
(unless (zerop this-delta)
(window--resize-this-window
left this-delta horizontal nil t 'before
@@ -2067,7 +2093,7 @@
;; Start resizing.
(window--resize-reset frame horizontal)
;; Try to enlarge RIGHT.
- (setq this-delta (window-resizable right (- delta) horizontal))
+ (setq this-delta (window--resizable right (- delta) horizontal))
(unless (zerop this-delta)
(window--resize-this-window
right this-delta horizontal nil t 'after
@@ -2098,7 +2124,7 @@
((zerop delta))
((window-size-fixed-p nil horizontal)
(error "Selected window has fixed size"))
- ((window-resizable-p nil delta horizontal)
+ ((window--resizable-p nil delta horizontal)
(window-resize nil delta horizontal))
(t
(window-resize
@@ -2119,7 +2145,7 @@
((zerop delta))
((window-size-fixed-p nil horizontal)
(error "Selected window has fixed size"))
- ((window-resizable-p nil (- delta) horizontal)
+ ((window--resizable-p nil (- delta) horizontal)
(window-resize nil (- delta) horizontal))
(t
(window-resize
@@ -2392,7 +2418,7 @@
(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)
+ ((window--resizable-p window (- size) horizontal nil nil nil t)
;; Can do without resizing fixed-size windows.
(window--resize-siblings window (- size) horizontal))
(t
@@ -3763,13 +3789,13 @@
(let ((delta (- (cdr (assq 'total-height item))
(window-total-height window)))
window-size-fixed)
- (when (window-resizable-p window delta)
+ (when (window--resizable-p window delta)
(window-resize window delta)))
;; Else check whether the window is not high enough.
(let* ((min-size (window-min-size window nil ignore))
(delta (- min-size (window-total-size window))))
(when (and (> delta 0)
- (window-resizable-p window delta nil ignore))
+ (window--resizable-p window delta nil ignore))
(window-resize window delta nil ignore))))
;; Adjust horizontally.
(if (memq window-size-fixed '(t width))
@@ -3777,13 +3803,13 @@
(let ((delta (- (cdr (assq 'total-width item))
(window-total-width window)))
window-size-fixed)
- (when (window-resizable-p window delta)
+ (when (window--resizable-p window delta)
(window-resize window delta)))
;; Else check whether the window is not wide enough.
(let* ((min-size (window-min-size window t ignore))
(delta (- min-size (window-total-size window t))))
(when (and (> delta 0)
- (window-resizable-p window delta t ignore))
+ (window--resizable-p window delta t ignore))
(window-resize window delta t ignore))))
;; Set dedicated status.
(set-window-dedicated-p window (cdr (assq 'dedicated state)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r106334: Rewrite window-resizable.,
martin rudalics <=