[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] reftex-toc.el: use (window-total-width)

From: Joost Kremers
Subject: [AUCTeX] reftex-toc.el: use (window-total-width)
Date: Fri, 04 Apr 2014 14:56:58 +0300
User-agent: mu4e; emacs 24.3.1

Hi all,

When Reftex is configured to put the TOC window to the left of the right
of the LaTeX window, it uses the function (window-width) to calculate
the size of the TOC window. I would like to suggest that it use
(window-total-width) instead, since that function takes the margins into

The margins are usually set to 0, but they are used by some packages to
limit the width of the writing area in wide windows.[1] (window-width)
returns the width of the window without margins, which results in a very
narrow TOC window, even though there is enough room for a decently-sized

To get an idea of what I mean, consider the following screenshots:


vs. (window-total-width):

I'm attaching a diff that changes all instances of (window-width) in
reftex-toc.el to (window-total-width). (I couldn't find any reason to
keep (window-width) in some of these instances, but someone more
familiar with the code might decide otherwise, of course.)

I don't think that a similar change of (window-height) to
(window-total-height) would make much sense, because the latter includes
the mode line and the header line, if any, which won't make much of a
difference. Window margins, OTOH, can make a big difference.



[1] automargin.el does, for example, and I also use it in my
writeroom-mode package.

--- reftex-toc.el       2014-04-04 14:26:44.541557644 +0300
+++ reftex-toc-mod.el   2014-04-04 14:30:40.648417350 +0300
@@ -240,13 +240,13 @@
                 (< (window-height) (* 2 window-min-height)))
-      (setq reftex-last-window-width (window-width)
+      (setq reftex-last-window-width (window-total-width)
             reftex-last-window-height (window-height))  ; remember
       (unless unsplittable
         (if reftex-toc-split-windows-horizontally
-             (floor (* (window-width)
+             (floor (* (window-total-width)
            (floor (* (window-height)
@@ -372,8 +372,8 @@
 (defun reftex-re-enlarge ()
   "Enlarge window to a remembered size."
   (let ((count (if reftex-toc-split-windows-horizontally
-                  (- (or reftex-last-window-width (window-width))
-                     (window-width))
+                  (- (or reftex-last-window-width (window-total-width))
+                     (window-total-width))
                 (- (or reftex-last-window-height (window-height))
     (when (> count 0)

Joost Kremers
Life has its moments

reply via email to

[Prev in Thread] Current Thread [Next in Thread]