From 52999a28077c8eddf091cae7363aa17431a39e07 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Dec 2025 15:37:47 +0000 Subject: [PATCH] Fix tp--get-nested to handle face values with symbol prefix like (shadow :foreground ...) Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com> --- tp.el | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tp.el b/tp.el index 40aaad6..b9c66d1 100644 --- a/tp.el +++ b/tp.el @@ -407,20 +407,34 @@ Example: (tp--get-nested \\='(:a 1 :b 2 :c 3) \\='((:a :b))) => (:a 1 :b 2)" value (let* ((key (car path)) (rest (cdr path)) + ;; Check if value is a plist-like structure + ;; A plist starts with keyword, or starts with symbol followed by keywords + ;; e.g., (:foreground "red") or (shadow :foreground "red") + (is-plist-like (and (listp value) + (or (keywordp (car value)) + (and (symbolp (car value)) + (cdr value) + (keywordp (cadr value)))))) (next-value (cond ;; Key is a list of keys - extract multiple keys from value ((and (listp key) (not (null key))) - (when (and (listp value) (keywordp (car value))) - (let ((result nil)) + (when is-plist-like + (let ((result nil) + (plist-part (if (keywordp (car value)) + value + (cdr value)))) (dolist (k key) - (let ((v (plist-get value k))) + (let ((v (plist-get plist-part k))) (when v (setq result (plist-put result k v))))) result))) - ;; Value is a plist with keyword keys - ((and (listp value) (keywordp (car value))) - (plist-get value key)) + ;; Value is a plist or plist-like (symbol followed by plist) + (is-plist-like + (let ((plist-part (if (keywordp (car value)) + value + (cdr value)))) + (plist-get plist-part key))) ;; Value is an alist ((and (listp value) (consp (car value))) (cdr (assoc key value)))