branch: externals/show-font commit bd0ea854fb8eb7803b84d0bb872037866ac28f61 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Avoid repetition in show-font--prepare-text My plan for the future is to turn this function into a macro that can then be designed to expand into functions that support other languages. --- show-font.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/show-font.el b/show-font.el index a5c87660db..a59c5325be 100644 --- a/show-font.el +++ b/show-font.el @@ -335,24 +335,25 @@ instead of that of the file." (not (show-font-installed-file-p buffer-file-name))) nil) (t - (let ((faces '(show-font-small show-font-regular show-font-medium show-font-large)) - (list-of-lines nil) - (list-of-blocks nil) - (list-of-sentences nil) - (pangram (show-font--get-pangram)) - (name (or family (show-font--get-attribute-from-file "fullname"))) - (family (or family (show-font--get-attribute-from-file "family"))) - (propertize-sample-p (show-font--string-p show-font-character-sample))) + (let* ((faces '(show-font-small show-font-regular show-font-medium show-font-large)) + (list-of-lines nil) + (list-of-blocks nil) + (list-of-sentences nil) + (pangram (show-font--get-pangram)) + (name (or family (show-font--get-attribute-from-file "fullname"))) + (family (or family (show-font--get-attribute-from-file "family"))) + (character-sample show-font-character-sample) + (propertize-sample-p (show-font--string-p character-sample))) (dolist (face faces) (push (propertize pangram 'face (list face :family family)) list-of-lines) (push (propertize pangram 'face (list face :family family :slant 'italic)) list-of-lines) (push (propertize pangram 'face (list face :family family :weight 'bold)) list-of-lines) (push (propertize pangram 'face (list face :family family :slant 'italic :weight 'bold)) list-of-lines) (when propertize-sample-p - (push (propertize show-font-character-sample 'face (list face :family family)) list-of-blocks) - (push (propertize show-font-character-sample 'face (list face :family family :slant 'italic)) list-of-blocks) - (push (propertize show-font-character-sample 'face (list face :family family :weight 'bold)) list-of-blocks) - (push (propertize show-font-character-sample 'face (list face :family family :slant 'italic :weight 'bold)) list-of-blocks)) + (push (propertize character-sample 'face (list face :family family)) list-of-blocks) + (push (propertize character-sample 'face (list face :family family :slant 'italic)) list-of-blocks) + (push (propertize character-sample 'face (list face :family family :weight 'bold)) list-of-blocks) + (push (propertize character-sample 'face (list face :family family :slant 'italic :weight 'bold)) list-of-blocks)) (when show-font-sentences-sample (dolist (sentence show-font-sentences-sample) (when (show-font--string-p sentence)