]> code.delx.au - gnu-emacs/commitdiff
Document 'window-max-chars-per-line'
authorEli Zaretskii <eliz@gnu.org>
Thu, 3 Dec 2015 16:26:39 +0000 (18:26 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 3 Dec 2015 16:26:39 +0000 (18:26 +0200)
* doc/lispref/windows.texi (Window Sizes): Document
'window-max-chars-per-line'.

doc/lispref/windows.texi
etc/NEWS

index ead2f7a52f6cb9f134df4a36ab1bdb162734751b..5c7947eeca62f507bb4635e59a30cd850b0c17c6 100644 (file)
@@ -635,6 +635,22 @@ Functions for retrieving the height and/or width of window dividers
 (@pxref{Scroll Bars}), and display margins (@pxref{Display Margins}) are
 described in the corresponding sections.
 
+If your Lisp program needs to make layout decisions, you will find the
+following function useful:
+
+@defun window-max-chars-per-line &optional window face
+This function returns the number of characters displayed in the
+specified @var{face} in the specified @var{window} (which must be a
+live window).  If @var{face} was remapped (@pxref{Face Remapping}),
+the information is returned for the remapped face.  If omitted or
+@code{nil}, @var{face} defaults to the default face, and @var{window}
+defaults to the selected window.  Unlike @code{window-body-width},
+this function accounts for the actual size of the @var{face}'s font,
+instead of working in units of frame's canonical character width.  It
+also accounts for space used by the continuation glyph, if
+@var{window} lacks one or both of its fringes.
+@end defun
+
 @cindex fixed-size window
 @vindex window-min-height
 @vindex window-min-width
index 0bde705af8ca28ee5b1306531fef50fbe6120056..ad7d81703e0aba2a595c29087ddbce48c9d05c37 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -181,13 +181,6 @@ for use in Emacs bug reports.
 hiding character but the default `.' can be used by let-binding the
 variable `read-hide-char'.
 
-** A new function `window-max-chars-per-line' returns the maximal
-number of characters that can be displayed on one line.  If a face
-and/or window are provided, these values are used for the
-calculation.  This function is different from `window-body-width' in
-that it accounts for (i) continuation glyphs, (ii) the size of the
-font, and (iii) the specified window.
-
 ** New possible value for `system-type': nacl.
 
 ** Emacs can now load shared/dynamic libraries (modules).
@@ -1230,18 +1223,26 @@ In particular, it now returns the average width of the font's
 characters, which can be used for geometry-related calculations.
 
 +++
-**** A new function `default-font-width' returns the average width of a
+*** A new function `default-font-width' returns the average width of a
 character in the current buffer's default font.  If the default face
 is remapped (see `face-remapping-alist'), the value for the remapped
 face is returned.  This function complements the existing function
 `default-font-height'.
 
 +++
-***** New functions `window-font-height' and `window-font-width' return
+*** New functions `window-font-height' and `window-font-width' return
 the height and average width of characters in a specified face and
 window.  If FACE is remapped (see `face-remapping-alist'), the
 function returns the information for the remapped face.
 
++++
+*** A new function `window-max-chars-per-line' returns the maximal
+number of characters that can be displayed on one line.  If a face
+and/or window are provided, these values are used for the
+calculation.  This function is different from `window-body-width' in
+that it accounts for (i) continuation glyphs, (ii) the size of the
+font, and (iii) the specified window.
+
 ---
 ** New utilities in subr-x.el:
 *** New macros `if-let' and `when-let' allow defining bindings and to