[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hydra 91f961d5d5 11/35: lv.el (lv-use-padding): New def
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hydra 91f961d5d5 11/35: lv.el (lv-use-padding): New defcustom |
Date: |
Tue, 25 Oct 2022 22:59:05 -0400 (EDT) |
branch: externals/hydra
commit 91f961d5d5e49765247e6e376c57bb695c9d4e17
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
lv.el (lv-use-padding): New defcustom
Fixes #351
---
lv.el | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lv.el b/lv.el
index 306adf7edd..af78610316 100644
--- a/lv.el
+++ b/lv.el
@@ -43,6 +43,11 @@
:group 'lv
:type 'boolean)
+(defcustom lv-use-padding nil
+ "Wheter to use horizontal padding in the LV window."
+ :group 'lv
+ :type 'boolean)
+
(defface lv-separator
'((((class color) (background light)) :background "grey80")
(((class color) (background dark)) :background "grey30"))
@@ -89,6 +94,14 @@ Only the background color is significant."
(defvar lv-force-update nil
"When non-nil, `lv-message' will refresh even for the same string.")
+(defun lv--pad-to-center (str width)
+ "Pad STR with spaces on the left to be centered to WIDTH."
+ (let* ((strs (split-string str "\n"))
+ (padding (make-string
+ (/ (- width (length (car strs))) 2)
+ ?\ )))
+ (mapconcat (lambda (s) (concat padding s)) strs "\n")))
+
(defun lv-message (format-string &rest args)
"Set LV window contents to (`format' FORMAT-STRING ARGS)."
(let* ((str (apply #'format format-string args))
@@ -96,6 +109,8 @@ Only the background color is significant."
deactivate-mark
golden-ratio-mode)
(with-selected-window (lv-window)
+ (when lv-use-padding
+ (setq str (lv--pad-to-center str (window-width))))
(unless (and (string= (buffer-string) str)
(null lv-force-update))
(delete-region (point-min) (point-max))
- [elpa] externals/hydra updated (7081ee6d44 -> e3e3d2c17f), ELPA Syncer, 2022/10/25
- [elpa] externals/hydra a2bb124a3f 03/35: hydra.el (hydra-posframe-hide): Delay hiding hint when it makes sense, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra e94b39171a 01/35: hydra.el (hydra-posframe-show): Introduce a border, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 49bef08465 12/35: Fix typos, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra b14aaf71cb 07/35: hydra.el (hydra-lv): Remove obsolete defcustom, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra d3328cab67 18/35: doc: Add full text of licences, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 91f961d5d5 11/35: lv.el (lv-use-padding): New defcustom,
ELPA Syncer <=
- [elpa] externals/hydra e3beffdd80 17/35: lv.el (lv-window): Don't modify the buffer-list order, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra a91dd72529 06/35: lv.el (lv-window): Set header-line-format to nil, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra d38c63d3d8 14/35: hydra.el (hydra--work-around-dedicated): Unset on 26.3, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 9db28034d7 16/35: lv.el (lv-window-hook): Add, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 9936d1c6a8 09/35: lv.el (lv-window): Set tab-line-format to nil, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 5e29ad0092 19/35: lv.el (lv-window): Ensure fundamental-mode, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 370a5c613e 23/35: hydra.el (hydra-key-regex): Include "[]" in the char group, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 2dfc493ebc 25/35: Fixed message hint display from being escaped by percent, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 1ab885785e 29/35: hydra.el (hydra--make-defun): Allow to speficy :idle property for a head, ELPA Syncer, 2022/10/25
- [elpa] externals/hydra 2d553787ac 30/35: hydra.el (hydra--make-defun): Refactor, ELPA Syncer, 2022/10/25