GNU bug report logs - #9084
24.0.50; displaying man pages splits the window and formats the text for the full width of the whole frame rather than for the width of the window the text is displayed in, which is only 1/2 the width of the frame

Previous Next

Package: emacs;

Reported by: lee <lee <at> yun.yagibdah.de>

Date: Thu, 14 Jul 2011 21:08:02 UTC

Severity: normal

Merged with 2588, 17831

Found in version 24.0.50

Fixed in version 24.4.50

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'martin rudalics'" <rudalics <at> gmx.at>, "'Juri Linkov'" <juri <at> jurta.org>
Cc: 9084 <at> debbugs.gnu.org
Subject: bug#9084: 24.0.50; displaying man pages splits the window and formats the text forthe	full width of the whole frame rather than for the width ofthe	window the text is displayed in, which is only 1/2 thewidth of	the frame
Date: Thu, 21 Jul 2011 06:05:31 -0700
> I don't know a function to fit the width of a window to the 
> maximum line length of the buffer it shows, but writing such
> a function should be easy provided we have a function that
> tells us the maximum column within a buffer.

FWIW, this is what I do for frame-fitting, in fit-frame.el.  One thing to keep
in mind, IMO, is to let users skip over "header" lines (in a wide sense that
includes, e.g., the intro directory lines in Dired) when calculating the widest
line.  See function `fit-frame-max-window-size'.
http://www.emacswiki.org/emacs/fit-frame.el

This is the user option I provide for skipping header lines when calculating
width:

(defcustom fit-frame-skip-header-lines-alist
  '((Info-mode . 1) (dired-mode . 2) (compilation-mode . 2))
  "*Alist of major-modes and header lines to ignore.
When `fit-frame' calculates the width of the current buffer, it can
first skip some lines at the buffer beginning, ignoring their
widths.  For example, Info, Dired, and compilation buffers sometimes
have a long header line at the top.  You can use this alist to tell
`fit-frame' to ignore the width of these header lines.

Each item in the alist is of form (MODE . LINES).
 MODE is a major-mode name.
 LINES is the number of lines to skip at the beginning of the buffer."
  :type '(repeat (cons :format "%v" (symbol :tag "Major Mode")
                       (integer :tag "Header Lines to Ignore")))
  :group 'fit-frame)

Obviously, if we always used real `header-line' lines or some other way to
distinguish the lines to skip, then things would be easier and more reliable.
Note too that skipping the header lines in Dired is more important when details
are hidden (dired-details.el), which typically makes the buffer contents much
narrower than the "header" lines.

Finally, the code I use just works off of the `frame-char-width' - it does not
take into account variable pitch or multiple size fonts in the same buffer or
things such as Chinese chars in the buffer.





This bug report was last modified 10 years and 324 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.