[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/topspace 483ef53957 090/181: Add topspace-empty-line-in
From: |
ELPA Syncer |
Subject: |
[elpa] externals/topspace 483ef53957 090/181: Add topspace-empty-line-indicator defcustom (#8) |
Date: |
Tue, 23 Aug 2022 12:58:37 -0400 (EDT) |
branch: externals/topspace
commit 483ef53957ef7c4d4fe2e7af6dc20511405357d4
Author: Trevor Pogue <trevorpogue@gmail.com>
Commit: GitHub <noreply@github.com>
Add topspace-empty-line-indicator defcustom (#8)
---
README.md | 11 +++++++++++
topspace.el | 26 ++++++++++++++++++++++++--
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 68bd7fc806..e0c04e3497 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,17 @@ then be active only when that function returns a non-nil
value."
(const :tag "never" nil)
(function :tag "predicate function")))
+(defcustom topspace-empty-line-indicator
+ #'topspace-default-empty-line-indicator
+ "Text that will appear in each empty topspace line above the top text line.
+By default it is \"~\" when `indicate-empty-lines' is non-nil, otherwise \"\".
+Can be set to either a constant string or a function that returns a string."
+ :type '(choice 'string (function :tag "String function")))
+
+(defun topspace-default-empty-line-indicator ()
+ "Return \"~\" with face 'fringe if `indicate-empty-lines` non-nil else \"\"."
+ (if indicate-empty-lines (propertize "~" 'face 'fringe) ""))
+
(defcustom topspace-mode-line " T"
"Mode line lighter for Topspace.
The value of this variable is a mode line template as in
diff --git a/topspace.el b/topspace.el
index 7a515281b0..70aa52e2a6 100644
--- a/topspace.el
+++ b/topspace.el
@@ -147,6 +147,17 @@ then be active only when that function returns a non-nil
value."
(const :tag "never" nil)
(function :tag "predicate function")))
+(defcustom topspace-empty-line-indicator
+ #'topspace-default-empty-line-indicator
+ "Text that will appear in each empty topspace line above the top text line.
+By default it is \"~\" when `indicate-empty-lines' is non-nil, otherwise \"\".
+Can be set to either a constant string or a function that returns a string."
+ :type '(choice 'string (function :tag "String function")))
+
+(defun topspace-default-empty-line-indicator ()
+ "Return \"~\" with face 'fringe if `indicate-empty-lines` non-nil else \"\"."
+ (if indicate-empty-lines (propertize "~" 'face 'fringe) ""))
+
(defcustom topspace-mode-line " T"
"Mode line lighter for Topspace.
The value of this variable is a mode line template as in
@@ -335,6 +346,18 @@ return unexpected value when END is in column 0. This
fixes that issue."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Overlay drawing
+(defun topspace--text (height)
+ "Return the topline text that appears in the top overlay with height HEIGHT."
+ (let ((text "")
+ (indicator-line (topspace--eval-choice-p
+ topspace-empty-line-indicator)))
+ (setq indicator-line (cl-concatenate 'string indicator-line "\n"))
+ (when (> height 0)
+ (dotimes (n height)
+ n ;; remove flycheck warning
+ (setq text (cl-concatenate 'string text indicator-line)))
+ text)))
+
(defun topspace--draw (&optional height)
"Put/draw top space as an overlay with the target line height HEIGHT."
(let ((old-height))
@@ -352,8 +375,7 @@ return unexpected value when END is in column 0. This fixes
that issue."
(overlay-put topspace 'topspace--remove-from-window-tag
(selected-window))
(overlay-put topspace 'topspace--remove-from-buffer-tag t)
- (overlay-put topspace 'before-string (when (> height 0)
- (make-string height ?\n))))
+ (overlay-put topspace 'before-string (topspace--text height)))
height))
(defun topspace--draw-increase-height (total-lines)
- [elpa] externals/topspace 88b3be676e 048/181: Update README.md, (continued)
- [elpa] externals/topspace 88b3be676e 048/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 5d30dd0957 052/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace da393d3573 053/181: Fix `recenter-top-bottom` bug, add .md files, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace dcd89f601e 054/181: Fix link in CONTRIBUTING.ms, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 472751c282 062/181: Update feature_request.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 2d412231ef 063/181: Update links in changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 12f3ce7796 075/181: Finalize topspace-active, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 98adfefc0f 071/181: Fix typo in readme, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 72b9ddd81d 089/181: Refactor private functions, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 276acc9006 079/181: Move changelog.yml, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 483ef53957 090/181: Add topspace-empty-line-indicator defcustom (#8),
ELPA Syncer <=
- [elpa] externals/topspace 4e8a2cad75 080/181: Fix automatic changelog generation action, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace a6c375a96f 092/181: Fix typo caused in merge, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 1daae45343 095/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace bdf5d43aaa 097/181: Support different line-heights (#10), ELPA Syncer, 2022/08/23
- [elpa] externals/topspace b372216aed 102/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace d585e1cfaa 105/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace a873b9f61d 106/181: Update README.md, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace f72d5cbaa1 111/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace bf13e37483 118/181: Update Changelog, ELPA Syncer, 2022/08/23
- [elpa] externals/topspace 7d384d0568 120/181: Add mouse-scrolling test, ELPA Syncer, 2022/08/23