[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/spacious-padding 6f9b4bdc9d 1/3: Arrange for a reasonab
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/spacious-padding 6f9b4bdc9d 1/3: Arrange for a reasonable fallback value for :box face attribute |
|
Date: |
Thu, 16 Nov 2023 06:58:29 -0500 (EST) |
branch: externals/spacious-padding
commit 6f9b4bdc9df69881d246c5001016c265ca293dc6
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Arrange for a reasonable fallback value for :box face attribute
This is necessary to avoid errors when the user does not set the
appropriate value in 'spacious-padding-widths'.,
---
spacious-padding.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/spacious-padding.el b/spacious-padding.el
index 7b3653ee03..00e55812a0 100644
--- a/spacious-padding.el
+++ b/spacious-padding.el
@@ -101,15 +101,20 @@ following:
'(tab-bar tab-bar-tab tab-bar-tab-inactive)
"Tab faces relevant to `spacious-padding-mode'.")
+(defun spacious-padding--get-box-width (key)
+ "Get width for :box of face represented by KEY in `spacious-padding-widths'.
+Return 4 if KEY does not have a value."
+ (or (plist-get spacious-padding-widths key) 4))
+
(defun spacious-padding--get-face-width (face)
"Return width of FACE from `spacious-padding-widths'."
(cond
((memq face spacious-padding--mode-line-faces)
- (plist-get spacious-padding-widths :mode-line-width))
+ (spacious-padding--get-box-width :mode-line-width))
((memq face spacious-padding--header-line-faces)
- (plist-get spacious-padding-widths :header-line-width))
+ (spacious-padding--get-box-width :header-line-width))
((memq face spacious-padding--tab-faces)
- (plist-get spacious-padding-widths :tab-width))
+ (spacious-padding--get-box-width :tab-width))
(t (error "`%s' is not relevant to `spacious-padding-mode'" face))))
(defun spacious-padding-set-face-box-padding (face fallback)