[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.
- [elpa] externals/topspace c21ceb5e3a 109/181: Set back Unreleased as recent version in changelog, (continued)
- [elpa] externals/topspace c21ceb5e3a 109/181: Set back Unreleased as recent version in changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace e3cd398678 112/181: Fix bug caused by #11 when scrolling with topspace disabled, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace cb9dbf5c0f 114/181: Start adding tests, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace af98947c27 115/181: Prevent "Beginning of buffer" error message (#12), ELPA Syncer, 2022/08/23
- [elpa] externals/topspace ba275f7c94 119/181: Fix off-by-one-line scroll bug at top of buffer introduced in #10, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 334cf13ab5 121/181: Internal optimization, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace f5d01b58f8 127/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 4724b926a4 134/181: Add continuous integration and coverage, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace a4c5873fb4 125/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace d376bca4c8 130/181: Internal refactoring, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace e6cc9081a2 128/181: Add `topspace-height` function for use by external packages (#15),
ELPA Syncer <=
- [elpa] externals/topspace 7a0d565b68 126/181: Set back changelog head to `Unreleased`, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace f79b07c982 129/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 64bbce19a0 136/181: Add coverage badge to readme, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 0541624721 138/181: Update test.yml, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 0e4b28f3d5 142/181: Refresh cached coveralls badge image in readme, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 25020db16f 143/181: Update test.yml, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 7212517c9b 145/181: Increase test coverage, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 3531e9f84c 147/181: Update cached coveralls badge in readme, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 3669113748 151/181: Update contributing files, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 897553afd9 155/181: Add `topspace-set-height`, enhance `topspace-center-position` (#19), ELPA Syncer, 2022/08/23