[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat db53afa3a7 18/84: Add buffer-text-pixel-size fro
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat db53afa3a7 18/84: Add buffer-text-pixel-size from Emacs 29 |
Date: |
Tue, 3 Jan 2023 08:57:32 -0500 (EST) |
branch: externals/compat
commit db53afa3a7fc17f826de047551ecee39b3ee493c
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add buffer-text-pixel-size from Emacs 29
---
compat-29.el | 24 ++++++++++++++++++++++++
compat.texi | 20 ++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/compat-29.el b/compat-29.el
index 5ec5680311..8b14b23a43 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -58,6 +58,30 @@ the properties at POSITION."
(eq (car properties) prop))
(cadr properties))))
+;;* UNTESTED
+(compat-defun buffer-text-pixel-size
+ (&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."
+ :realname compat--buffer-text-pixel-size
+ (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)
diff --git a/compat.texi b/compat.texi
index cdf089125c..80077f1bcb 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2359,6 +2359,26 @@ 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
+
- [elpa] externals/compat updated (1573aa2e6d -> be4595fec8), ELPA Syncer, 2023/01/03
- [elpa] externals/compat dd334e5616 04/84: Add function-alias-p, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 5a1f3bdc59 03/84: Merge branch 'master' into emacs-29.1, ELPA Syncer, 2023/01/03
- [elpa] externals/compat ae2bf0aee5 08/84: Merge branch 'master' into emacs-29.1, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 5031a586a3 09/84: Add take and ntake defined in Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 71ddb93f75 10/84: Merge branch 'master' into emacs-29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 3104c89c2d 13/84: Test compat-string-trim instead of string-trim, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 29dd29609a 15/84: Prepare compat.el for testing functions from compat-29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 9b8799091c 16/84: Add @subsection headers for Emacs 29.1 node, ELPA Syncer, 2023/01/03
- [elpa] externals/compat db53afa3a7 18/84: Add buffer-text-pixel-size from Emacs 29,
ELPA Syncer <=
- [elpa] externals/compat a4036f9b1b 01/84: Prepare Emacs 29.1 compatibility, ELPA Syncer, 2023/01/03
- [elpa] externals/compat f21b114ec7 02/84: Add string-limit, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 9083cfc4f6 05/84: Add get-display-property, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 87da1d984d 11/84: Begin documenting Emacs 29 support, ELPA Syncer, 2023/01/03
- [elpa] externals/compat c81333a6b0 30/84: Merge branch 'master' into emacs-29.1, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 2ee63f46b2 07/84: Make compat-font-lock dependency on compat-macs explicit, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 22b2634ada 06/84: Compile compat-macs before anything else, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 2e206a8304 21/84: Add prefixed plist-get from Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat e13ca90cd7 12/84: Rewrite legacy compat-test definitions, ELPA Syncer, 2023/01/03
- [elpa] externals/compat e370f9b7e7 25/84: Add match-buffers from Emacs 29, ELPA Syncer, 2023/01/03