emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/compat 7c17c96c1e 1/4: compat-29: Drop broken string-pi


From: ELPA Syncer
Subject: [elpa] externals/compat 7c17c96c1e 1/4: compat-29: Drop broken string-pixel-width and window-pixel-width (Fix #8)
Date: Sat, 7 Jan 2023 07:57:26 -0500 (EST)

branch: externals/compat
commit 7c17c96c1e0e98033481394e05b20fc3399a373c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    compat-29: Drop broken string-pixel-width and window-pixel-width (Fix #8)
    
    These functions seem to hangup from time to time on 28.2
    (seagle0128/doom-modeline#601). By dropping the functions the hangup in
    doom-modeline is resolved, since doom-modeline contains a runtime check for
    string-pixel-width.
    
    The compatibility function implementations do not contain any loops, this 
means
    there is an underlying bug in `window-text-pixel-size' in 28.2 exposed by 
the
    compatibility function. Either the compatibility function must be written 
in a
    different form or we cannot provide them at all.
---
 compat-29.el | 33 ---------------------------------
 compat.texi  | 28 ----------------------------
 2 files changed, 61 deletions(-)

diff --git a/compat-29.el b/compat-29.el
index 300a20dc96..e47e87be93 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -55,28 +55,6 @@ the properties at POSITION."
          (eq (car properties) prop))
     (cadr properties))))
 
-(compat-defun buffer-text-pixel-size ;; <UNTESTED>
-    (&optional buffer-or-name window x-limit y-limit)
-  "Return size of whole text of BUFFER-OR-NAME in WINDOW.
-BUFFER-OR-NAME must specify a live buffer or the name of a live buffer
-and defaults to the current buffer.  WINDOW must be a live window and
-defaults to the selected one.  The return value is a cons of the maximum
-pixel-width of any text line and the pixel-height of all the text lines
-of the buffer specified by BUFFER-OR-NAME.
-
-The optional arguments X-LIMIT and Y-LIMIT have the same meaning as with
-`window-text-pixel-size'.
-
-Do not use this function if the buffer specified by BUFFER-OR-NAME is
-already displayed in WINDOW.  `window-text-pixel-size' is cheaper in
-that case because it does not have to temporarily show that buffer in
-WINDOW."
-  (setq buffer-or-name (or buffer-or-name (current-buffer)))
-  (setq window (or window (selected-window)))
-  (save-window-excursion
-    (set-window-buffer window buffer-or-name)
-    (window-text-pixel-size window nil nil x-limit y-limit)))
-
 ;;;; Defined in fns.c
 
 (compat-defun ntake (n list) ;; <OK>
@@ -307,17 +285,6 @@ than this function."
      (end (substring string (- (length string) length)))
      (t (substring string 0 length)))))
 
-(compat-defun string-pixel-width (string) ;; <UNTESTED>
-  "Return the width of STRING in pixels."
-  (if (zerop (length string))
-      0
-    ;; Keeping a work buffer around is more efficient than creating a
-    ;; new temporary buffer.
-    (with-current-buffer (get-buffer-create " *string-pixel-width*")
-      (delete-region (point-min) (point-max))
-      (insert string)
-      (car (buffer-text-pixel-size nil nil t)))))
-
 (compat-defmacro with-buffer-unmodified-if-unchanged (&rest body) ;; <UNTESTED>
   "Like `progn', but change buffer-modified status only if buffer text changes.
 If the buffer was unmodified before execution of BODY, and
diff --git a/compat.texi b/compat.texi
index 7c005bb27b..3d19933df5 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2146,26 +2146,6 @@ display purposes; use @code{truncate-string-to-width} or
 (@pxref{Size of Displayed Text,Size of Displayed Text,,elisp,}).
 @end defun
 
-@c copied from lispref/display.texi
-@defun buffer-text-pixel-size &optional buffer-or-name window x-limit y-limit
-This is much like @code{window-text-pixel-size}, but can be used when
-the buffer isn't shown in a window.  (@code{window-text-pixel-size} is
-faster when it is, so this function shouldn't be used in that case.)
-
-@var{buffer-or-name} must specify a live buffer or the name of a live
-buffer and defaults to the current buffer.  @var{window} must be a
-live window and defaults to the selected one; the function will
-compute the text dimensions as if @var{buffer} is displayed in
-@var{window}.  The return value is a cons of the maximum pixel-width
-of any text line and the pixel-height of all the text lines of the
-buffer specified by @var{buffer-or-name}.
-
-The optional arguments @var{x-limit} and @var{y-limit} have the same
-meaning as with @code{window-text-pixel-size}.
-
-@xref{Size of Displayed Text,,,elisp}.
-@end defun
-
 @c copied from lispref/strings.texi
 @defun string-equal-ignore-case string1 string2
 @code{string-equal-ignore-case} compares strings ignoring case
@@ -2240,14 +2220,6 @@ optional @code{buffer-list} argument.  Optional third 
argument
 @xref{Buffer List,,,elisp}.
 @end defun
 
-@c copied from lispref/display.texi
-@defun string-pixel-width string
-This is a convenience function that uses @code{window-text-pixel-size}
-to compute the width of @var{string} (in pixels).
-
-@xref{Size of Displayed Text,,,elisp}.
-@end defun
-
 @c copied from lispref/display.texi
 @defun string-glyph-split string
 When character compositions are in effect, sequence of characters can



reply via email to

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