私はこれらのような文字列を収集する関数を持っています:
文字列をさまざまなサブコンポーネントに分割し、各コンポーネントにテキストプロパティを追加し、新しい文字列を再構築するスニペットの怪物を作成しました。
Q: Is there a more sophisticated way to do this project?
(let* (
new-list
(string ":event:lawlist:HIGH:misc:")
(lst (delete "" (split-string string ":")))
(separator (propertize ":" 'face '(:foreground "cyan"))) )
(dolist (e lst)
(put-text-property 0 (length e) 'face
(cond
((string= e "event")
'(:foreground "red"))
((string= e "lawlist")
'(:foreground "blue"))
((string= e "HIGH")
'(:foreground "yellow"))
(t
'default))
e)
(push e new-list))
(concat separator (mapconcat 'identity (reverse new-list) separator) separator))