diff options
author | Yuchen Pei <id@ypei.org> | 2025-01-18 08:56:21 +1100 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2025-01-18 08:56:21 +1100 |
commit | def1c859b40d09e44c2b0e2bc95d0cf450ff60b4 (patch) | |
tree | 07f0de26ababee151112d64833d47ab776553403 /emacs/.emacs.d/lisp/my/infobox.el | |
parent | ddb5b07e1e43c7b44877bae9d786dbb80ca95311 (diff) |
[emacs] eval expr in gud source and infobox value transform
Diffstat (limited to 'emacs/.emacs.d/lisp/my/infobox.el')
-rw-r--r-- | emacs/.emacs.d/lisp/my/infobox.el | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/emacs/.emacs.d/lisp/my/infobox.el b/emacs/.emacs.d/lisp/my/infobox.el index 518c7db..2c33ae9 100644 --- a/emacs/.emacs.d/lisp/my/infobox.el +++ b/emacs/.emacs.d/lisp/my/infobox.el @@ -27,6 +27,13 @@ ;;; Code: +(defun infobox-transform-field-value (v) + (cond ((stringp v) v) + ((eq v t) "YES") + ((eq v :json-false) "NO") + ((seqp v) (mapconcat #'identity v ", ")) + (t (format "%s" v)))) + (defun infobox-default-specs (info) (seq-map (lambda (pair) @@ -47,7 +54,7 @@ something like (lambda (pair) (when-let ((val (alist-get (car pair) info))) (if (or (stringp (cdr pair)) (symbolp (cdr pair))) - (cons (cdr pair) val) + (cons (cdr pair) (infobox-transform-field-value val)) (cons (cadr pair) (funcall (cddr pair) val))))) specs)) |