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 account.
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 window. To get an idea of what I mean, consider the following screenshots: (window-width): https://dl.dropboxusercontent.com/u/24935319/Screenshot%20from%202014-04-04%2014%3A40%3A17.png vs. (window-total-width): https://dl.dropboxusercontent.com/u/24935319/Screenshot%20from%202014-04-04%2014%3A40%3A23.png 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. TIA Joost [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))) (delete-other-windows)) - (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 (split-window-right - (floor (* (window-width) + (floor (* (window-total-width) reftex-toc-split-windows-fraction))) (split-window-below (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)) (window-height))))) (when (> count 0)
-- Joost Kremers Life has its moments
_______________________________________________ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex