[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars dbbd7fb1ed 218/431: Add (custom-inherit): I
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars dbbd7fb1ed 218/431: Add (custom-inherit): Improve inheritance for partial plists |
Date: |
Mon, 16 Sep 2024 12:59:30 -0400 (EDT) |
branch: externals/indent-bars
commit dbbd7fb1ed2a57f6b9b0ded8ce62acdb8dcb2b52
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
Add (custom-inherit): Improve inheritance for partial plists
Some variables only end in a plist, but have atoms before it. Treat
those, as well as the atom value 'unspecified, correctly.
---
indent-bars.el | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/indent-bars.el b/indent-bars.el
index a7f270125d..8eaf7d8a98 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -748,22 +748,47 @@ inheritance of the plist is handled. If style is the
symbol
indent-bars--styles)
(indent-bars--style1 style name)))
+(defun indent-bars--custom-inherit (old new)
+ "Inherit the values of NEW and OLD, which can be values or lists.
+NEW and OLD must have the same form, composed of atoms
+and (optionally) a final plist. The symbol \\='unspecified in
+NEW indicates that that value should be replaced by the
+corresponding value in OLD. Any trailing PLIST in NEW and OLD
+will be merged (with NEW taking precedence). The merged value is
+returned."
+ (cond
+ ((and (atom old) (atom new))
+ (if (eq new 'unspecified) old new))
+
+ ((and (consp old) (consp new))
+ (let ((n new) (o old) lo)
+ (while (and n o)
+ (if (and (plistp n) (plistp o) (keywordp (car o)))
+ (let ((m (map-merge 'plist o n)))
+ (if lo (setcdr lo m) (setq old m))
+ (setq o nil)) ; signify list complete
+ (unless (eq (car n) 'unspecified)
+ (setcar o (car n))))
+ (setq lo o n (cdr n) o (cdr o))))
+ old)
+
+ (t new)))
(defun indent-bars--style1 (style name)
- "Return the value of style variable NAME for STYLE."
+ "Return the value of style variable NAME for STYLE.
+Considers ([no-]inherit . rest) inheritance."
(let* ((tag (indent-bars-style-tag style))
(sym (indent-bars--alt name tag))
(val (symbol-value sym))
- (inhrt t)) ; inherit by default
+ (inhrt t)) ; inherit by default
(when tag
;; Check for the ([no-]inherit . actual-val) form
(when (and (consp val) (memq (car val) '(inherit no-inherit)))
(setq inhrt (and (car val) (not (eq (car val) 'no-inherit)))
val (cdr val)))
- (when-let (((and inhrt (plistp val) (keywordp (car val)))) ;only :key
plists
- (main-val (symbol-value (indent-bars--alt name nil)))
- ((plistp main-val)))
- (setq val (map-merge 'plist main-val val))))
+ (when inhrt
+ (setq val (indent-bars--custom-inherit
+ (symbol-value (indent-bars--alt name nil)) val))))
val))
;;;; Indentation and Drawing
- [elpa] externals/indent-bars 7b6454d6e8 190/431: ts.el: improve docs and customization options, (continued)
- [elpa] externals/indent-bars 7b6454d6e8 190/431: ts.el: improve docs and customization options, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars f5d9426fe6 199/431: overhaul style-system: pass-by-arg, switch-after, style2, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 9f2b7625b4 212/431: scope-update: reference correct timer, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 28cc7f4a82 216/431: Use "ts" alt style uniformly, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2889b50077 224/431: Always initialize style on scope init, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 230e3c8377 221/431: setup-and-remove: wrap in with-selected-frame, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 1b6e353634 225/431: Correctly track separate stipple face for each style, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 9740b6ff4a 227/431: Add min-lines support for scope, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 09dd1d6f75 209/431: Correct after-make-frame handling for daemon, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 226b6c2dd0 226/431: custom-inherit: correctly handle 'unspecified atoms, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars dbbd7fb1ed 218/431: Add (custom-inherit): Improve inheritance for partial plists,
ELPA Syncer <=
- [elpa] externals/indent-bars b8319cf7d4 237/431: add support for json-ts-mode and json-mode, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 4ad704782a 233/431: Properly handle SWITCH-AFTER=0, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 7acbd9124b 235/431: README: Acknowledgements, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 117121cbd6 230/431: Guard update-scope against non-mode buffers, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars cd463afdbc 223/431: Use union of old and new ranges, not symdiff, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 48646b1123 234/431: README: Acknowledgements, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2ee5157b41 244/431: Require 'subr-x for hash functions, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars e4d73d35a5 249/431: use indent-bars--tag in create-faces, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 470d99ddd1 262/431: Relocate remap local variables closer to usage, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 3279f93449 220/431: Do no 'reset faces on setup, ELPA Syncer, 2024/09/16