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

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

[elpa] externals/topspace e6cc9081a2 128/181: Add `topspace-height` func


From: ELPA Syncer
Subject: [elpa] externals/topspace e6cc9081a2 128/181: Add `topspace-height` function for use by external packages (#15)
Date: Tue, 23 Aug 2022 12:58:41 -0400 (EDT)

branch: externals/topspace
commit e6cc9081a2b0e19e35a986f44a343af6bbc74ddb
Author: Trevor Pogue <trevorpogue@gmail.com>
Commit: GitHub <noreply@github.com>

    Add `topspace-height` function for use by external packages (#15)
---
 README.md   | 27 ++++++++++++++++++++-------
 topspace.el |  8 ++++++++
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index c8e4b6e407..ab883733fe 100644
--- a/README.md
+++ b/README.md
@@ -42,17 +42,30 @@ To enable `topspace-mode` globally on startup, add the 
following to your Emacs c
 ```
 # Usage
 ### Just enable and go
-No new keybindings are required, keep using all your previous scrolling & 
recentering commands, except now you can also scroll above the top lines. 
+No new keybindings are required, keep using all your previous scrolling & 
recentering commands, except now you can also scroll above the top lines.
 
-# Extra commands
+# Extra functions
 
-### `topspace-recenter-buffer`
-* Add enough top space in the selected window to center small buffers.
+```elisp
+;;;###autoload
+(defun topspace-height ()
+  "Return the top space height in the selected window in number of lines.
+The top space is the empty region in the buffer above the top text line.
+The return value is of type float, and is equivalent to
+the top space pixel height / `default-line-height'."
+...
+
+;;;###autoload
+(defun topspace-recenter-buffer ()
+  "Add enough top space in the selected window to center small buffers.
 Top space will not be added if the number of text lines in the buffer is larger
 than or close to the selected window's height.
-Customize `topspace-center-position` to adjust the centering position.
-Customize `topspace-autocenter-buffers` to run this command automatically
-after first opening buffers and after window sizes change.
+Customize `topspace-center-position' to adjust the centering position.
+Customize `topspace-autocenter-buffers' to run this command automatically
+after first opening buffers and after window sizes change."
+  (interactive)
+...
+```
 
 # Customization
 ```elisp
diff --git a/topspace.el b/topspace.el
index 3599e08041..d33ce2b9c5 100644
--- a/topspace.el
+++ b/topspace.el
@@ -554,6 +554,14 @@ ARG defaults to 1."
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; User functions
 
+;;;###autoload
+(defun topspace-height ()
+  "Return the top space height in the selected window in number of lines.
+The top space is the empty region in the buffer above the top text line.
+The return value is of type float, and is equivalent to
+the top space pixel height / `default-line-height'."
+  (topspace--height))
+
 ;;;###autoload
 (defun topspace-recenter-buffer ()
   "Add enough top space in the selected window to center small buffers.



reply via email to

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