From 12c699f2b62e3e88298daa9e07272f409f6c8df3 Mon Sep 17 00:00:00 2001 From: Laura Date: Fri, 24 Sep 2021 18:48:08 -0300 Subject: [PATCH 1/3] feat: added support for gifs --- dashboard-widgets.el | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 551dbc1f..65bd0c5e 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -484,6 +484,10 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer." (put-text-property 0 (length ascii-banner) 'face 'dashboard-text-banner ascii-banner) (insert ascii-banner))) +(defun dashboard--type-is-gif-p (image-path) + "Returns if image is a gif. string -> bool" + (eq 'gif (image-type image-path))) + (defun dashboard-insert-image-banner (banner) "Display an image BANNER." (when (file-exists-p banner) @@ -494,12 +498,15 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer." (when (> dashboard-image-banner-max-height 0) (list :max-height dashboard-image-banner-max-height)))) (spec - (if (image-type-available-p 'imagemagick) - (apply 'create-image banner 'imagemagick nil size-props) - (apply 'create-image banner nil nil - (when (and (fboundp 'image-transforms-p) - (memq 'scale (funcall 'image-transforms-p))) - size-props)))) + (cond ((dashboard--type-is-gif-p banner) + (create-image banner)) + ((image-type-available-p 'imagemagick) + (apply 'create-image banner 'imagemagick nil size-props)) + (t + (apply 'create-image banner nil nil + (when (and (fboundp 'image-transforms-p) + (memq 'scale (funcall 'image-transforms-p))) + size-props))))) ;; TODO: For some reason, `elisp-lint' is reporting error void ;; function `image-size'. (size (when (fboundp 'image-size) (image-size spec))) @@ -509,6 +516,7 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer." (insert "\n") (insert (make-string left-margin ?\ )) (insert-image spec) + (when (dashboard--type-is-gif-p banner) (image-animate spec 0 t)) (insert "\n\n") (when title (dashboard-center-line title) From e401e349cc1e87e15a4c6723718ee74a1c2f7586 Mon Sep 17 00:00:00 2001 From: Laura Date: Fri, 24 Sep 2021 19:56:57 -0300 Subject: [PATCH 2/3] chore: update banner example with gif --- README.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 4b3534f9..e27e9c20 100644 --- a/README.org +++ b/README.org @@ -72,7 +72,7 @@ To update the banner or banner title ;; 'official which displays the official emacs logo ;; 'logo which displays an alternative emacs logo ;; 1, 2 or 3 which displays one of the text banners -;; "path/to/your/image.png" or "path/to/your/text.txt" which displays whatever image/text you would prefer +;; "path/to/your/image.gif", "path/to/your/image.png" or "path/to/your/text.txt" which displays whatever gif/image/text you would prefer ;; Content is not centered by default. To center, set (setq dashboard-center-content t) @@ -282,3 +282,4 @@ make install ** Prerequisites * [[https://github.com/cask/cask][Cask]] + From 2e4c82efb5fba88392168bc05ec31ba74a3549ec Mon Sep 17 00:00:00 2001 From: Laura Date: Sat, 25 Sep 2021 19:29:50 -0300 Subject: [PATCH 3/3] chore: fixed function documentation --- dashboard-widgets.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 65bd0c5e..400c5ee6 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -485,7 +485,9 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer." (insert ascii-banner))) (defun dashboard--type-is-gif-p (image-path) - "Returns if image is a gif. string -> bool" + "Return if image is a gif. +String -> bool. +Argument IMAGE-PATH path to the image." (eq 'gif (image-type image-path))) (defun dashboard-insert-image-banner (banner)