aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKan-Ru Chen2014-09-18 14:06:17 +0200
committerMartin Rudalics2014-09-18 14:06:17 +0200
commitdf2ead390d7d54cb6c368e3099fb910a182ac7af (patch)
treec60a4615681342a56a4ee0725fa49751824cccf1
parent534f1f7cb6b25f05472d59b6b4757cb345f29b8d (diff)
downloademacs-df2ead390d7d54cb6c368e3099fb910a182ac7af.tar.gz
emacs-df2ead390d7d54cb6c368e3099fb910a182ac7af.zip
Fix `fit-window-to-buffer' (Bug#18498).
* window.el (fit-window-to-buffer): When counting buffer width, count the whole visible buffer. Correctly convert the body-height to pixel size for window-text-pixel-size (Bug#18498).
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/window.el10
2 files changed, 11 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b696eb61ab9..0a72fa4aa2b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12014-09-18 Kan-Ru Chen <kanru@kanru.info>
2
3 * window.el (fit-window-to-buffer): When counting buffer width,
4 count the whole visible buffer. Correctly convert the body-height
5 to pixel size for window-text-pixel-size (Bug#18498).
6
12014-09-14 Glenn Morris <rgm@gnu.org> 72014-09-14 Glenn Morris <rgm@gnu.org>
2 8
3 * image.el (image-multi-frame-p): Fix thinko - do not force 9 * image.el (image-multi-frame-p): Fix thinko - do not force
diff --git a/lisp/window.el b/lisp/window.el
index 4dc30ff968c..7692c797afe 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7289,10 +7289,10 @@ accessible position."
7289 max-width)) 7289 max-width))
7290 (+ total-width (window-max-delta 7290 (+ total-width (window-max-delta
7291 nil t nil nil nil nil pixelwise)))) 7291 nil t nil nil nil nil pixelwise))))
7292 ;; When fitting vertically, assume that WINDOW's start 7292 ;; When fitting horizontally, assume that WINDOW's
7293 ;; position remains unaltered. WINDOW can't get wider 7293 ;; start position remains unaltered. WINDOW can't get
7294 ;; than its frame's pixel width, its height remains 7294 ;; wider than its frame's pixel width, its height
7295 ;; unaltered. 7295 ;; remains unaltered.
7296 (width (+ (car (window-text-pixel-size 7296 (width (+ (car (window-text-pixel-size
7297 nil (window-start) (point-max) 7297 nil (window-start) (point-max)
7298 (frame-pixel-width) 7298 (frame-pixel-width)
@@ -7301,7 +7301,7 @@ accessible position."
7301 ;; overshoots when the first line below 7301 ;; overshoots when the first line below
7302 ;; the bottom is wider than the window. 7302 ;; the bottom is wider than the window.
7303 (* body-height 7303 (* body-height
7304 (if pixelwise char-height 1)))) 7304 (if pixelwise 1 char-height))))
7305 (window-right-divider-width)))) 7305 (window-right-divider-width))))
7306 (unless pixelwise 7306 (unless pixelwise
7307 (setq width (/ (+ width char-width -1) char-width))) 7307 (setq width (/ (+ width char-width -1) char-width)))