emacs-diffs
[Top][All Lists]
Advanced

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

master 1e42c2c5fc 1/2: Remove window-max-characters-per-line


From: Lars Ingebrigtsen
Subject: master 1e42c2c5fc 1/2: Remove window-max-characters-per-line
Date: Thu, 2 Jun 2022 23:57:01 -0400 (EDT)

branch: master
commit 1e42c2c5fcf3f6162de3072d221c2f97c9fb1c67
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Remove window-max-characters-per-line
    
    * doc/lispref/windows.texi (Window Sizes):
    * doc/lispref/display.texi (Size of Displayed Text): Remove
    documentation.
    * lisp/fringe.el (fringe-mode): Point to the right function.
    
    * lisp/window.el (window-char-pixel-width)
    (window-char-pixel-height, window-max-characters-per-line): Remove
    functions -- this was already added as window-max-chars-per-line.
    
    * src/window.c (Fwindow_body_width): Adjust doc string.
---
 doc/lispref/display.texi | 14 --------------
 doc/lispref/windows.texi |  9 ---------
 etc/NEWS                 |  6 ------
 lisp/fringe.el           |  2 +-
 lisp/window.el           | 49 ------------------------------------------------
 src/window.c             |  2 +-
 6 files changed, 2 insertions(+), 80 deletions(-)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index f428fb858b..653b249a40 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -2257,20 +2257,6 @@ This is a convenience function that uses 
@code{window-text-pixel-size}
 to compute the width of @var{string} (in pixels).
 @end defun
 
-@defun window-char-pixel-width &optional window face
-Return the average character width for the font used by @var{face} in
-@var{window}.  If @var{face} is @code{nil} or omitted, the
-@code{default} face is used.  If @var{windows} is @code{nil} or
-omitted, the currently selected window is used.
-@end defun
-
-@defun window-char-pixel-height &optional window face
-Return the average character height for the font used by @var{face} in
-@var{window}.  If @var{face} is @code{nil} or omitted, the
-@code{default} face is used.  If @var{windows} is @code{nil} or
-omitted, the currently selected window is used.
-@end defun
-
 @defun line-pixel-height
 This function returns the height in pixels of the line at point in the
 selected window.  The value includes the line spacing of the line
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 03d0f28867..0d285b2ad4 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -759,15 +759,6 @@ column and total width (@pxref{Coordinates and Windows}).  
The optional
 argument @var{round} behaves as it does for @code{window-total-height}.
 @end defun
 
-@defun window-max-characters-per-line &optional window face
-The maximum width of a line that can be displayed in a window (without
-breaking the line) depends on many things, like the font used on the
-line, and whether there are fringes around the window.  This
-convenience function can be used to calculate that number.  If
-@var{window} isn't given, this defaults to the currently selected
-window.  if @var{var} isn't given, the @code{default} face is used.
-@end defun
-
 @defun window-total-size &optional window horizontal round
 This function returns either the total height in lines or the total
 width in columns of the window @var{window}.  If @var{horizontal} is
diff --git a/etc/NEWS b/etc/NEWS
index 71c19c06b4..352f575bee 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2022,12 +2022,6 @@ The new 'x-show-tooltip-timeout' variable allows the 
user to alter
 this for packages that don't use 'tooltip-show', but instead call the
 lower level function directly.
 
-+++
-** New function 'window-max-characters-per-line'.
-
-+++
-** New function 'window-char-pixel-width'.
-
 ---
 ** New function 'current-cpu-time'.
 It gives access to the CPU time used by the Emacs process, for
diff --git a/lisp/fringe.el b/lisp/fringe.el
index 2fcdc9be07..657a73772d 100644
--- a/lisp/fringe.el
+++ b/lisp/fringe.el
@@ -253,7 +253,7 @@ Note that removing a right or left fringe (by setting the 
width
 to zero) makes Emacs reserve one column of the window body to
 display a line continuation marker.  (This happens for both the
 left and right fringe, since Emacs can display both left-to-right
-and right-to-left text.)  You can use `window-max-characters-per-line'
+and right-to-left text.)  You can use `window-max-chars-per-line'
 to check the effective width.
 
 Fringe widths set by `set-window-fringes' override the default
diff --git a/lisp/window.el b/lisp/window.el
index 7f1265b9ac..5da867715f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -10570,55 +10570,6 @@ displaying that processes's buffer."
 (put 'shrink-window-horizontally 'repeat-map 'resize-window-repeat-map)
 (put 'shrink-window 'repeat-map 'resize-window-repeat-map)
 
-(defun window-char-pixel-width (&optional window face)
-  "Return average character width for the font of FACE used in WINDOW.
-WINDOW must be a live window and defaults to the selected one.
-
-If FACE is nil or omitted, the default face is used.  If FACE is
-remapped (see `face-remapping-alist'), the function returns the
-information for the remapped face."
-  (with-selected-window (window-normalize-window window t)
-    (let* ((info (font-info (face-font (or face 'default))))
-          (width (aref info 11)))
-      (if (> width 0)
-         width
-       (aref info 10)))))
-
-(defun window-char-pixel-height (&optional window face)
-  "Return character height for the font of FACE used in WINDOW.
-WINDOW must be a live window and defaults to the selected one.
-
-If FACE is nil or omitted, the default face is used.  If FACE is
-remapped (see `face-remapping-alist'), the function returns the
-information for the remapped face."
-  (with-selected-window (window-normalize-window window t)
-    (aref (font-info (face-font (or face 'default))) 3)))
-
-(defun window-max-characters-per-line (&optional window face)
-  "Return the number of characters that can be displayed on one line in WINDOW.
-WINDOW must be a live window and defaults to the selected one.
-
-The character width of FACE is used for the calculation.  If FACE
-is nil or omitted, the default face is used.  If FACE is
-remapped (see `face-remapping-alist'), the function uses the
-remapped face.
-
-This function is different from `window-body-width' in two
-ways.  First, it accounts for the portions of the line reserved
-for the continuation glyph.  Second, it accounts for the size of
-the font, which may have been adjusted, e.g., using
-`text-scale-increase')."
-  (with-selected-window (window-normalize-window window t)
-    (let* ((window-width (window-body-width window t))
-           (font-width (window-char-pixel-width window face))
-           (ncols (/ window-width font-width)))
-      (if (and (display-graphic-p)
-               overflow-newline-into-fringe
-               (/= (frame-parameter nil 'left-fringe) 0)
-               (/= (frame-parameter nil 'right-fringe) 0))
-          ncols
-        (1- ncols)))))
-
 (provide 'window)
 
 ;;; window.el ends here
diff --git a/src/window.c b/src/window.c
index d3e8afd68a..eba1390fed 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1081,7 +1081,7 @@ visible, that column is not counted.
 Note that the returned value includes the column reserved for the
 continuation glyph.
 
-Also see `window-max-characters-per-line'.  */)
+Also see `window-max-chars-per-line'.  */)
   (Lisp_Object window, Lisp_Object pixelwise)
 {
   return make_fixnum (window_body_width (decode_live_window (window),



reply via email to

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