animated emoji!

but at what cost...
This commit is contained in:
Miranda Marquez 2024-09-15 12:28:26 -08:00
parent 5eaabd1734
commit 77fac38771

View File

@ -8,10 +8,13 @@
(mastodon-tl--show-avatars t) (mastodon-tl--show-avatars t)
(mastodon-toot--enable-custom-instance-emoji t) (mastodon-toot--enable-custom-instance-emoji t)
(mastodon-use-emojify t) (mastodon-use-emojify t)
(image-use-external-converter t)
:demand) :demand)
;; 日本語 ;; 日本語
(require 'shr)
;; need to figure out custom emoji resolution ;; need to figure out custom emoji resolution
;; let's start by making :rena: render as the rena.webp image... ;; let's start by making :rena: render as the rena.webp image...
@ -58,12 +61,17 @@ returns nil if such an emoji does not exist."
(let* ((beg (match-beginning 0)) (let* ((beg (match-beginning 0))
(end (match-end 0)) (end (match-end 0))
(emoj (match-string 1)) (emoj (match-string 1))
(img (create-image (sharkey--emoji-cache emoj) nil nil (img (create-image (sharkey--emoji-cache emoj)
(if (image-type-available-p 'imagemagick)
'imagemagick
'webp)
nil
:height (window-font-height) :height (window-font-height)
:ascent 'center)) :ascent 'center))
(ov (make-overlay beg end))) (ov (make-overlay beg end)))
(image-animate img nil t)
(overlay-put ov 'display img) (overlay-put ov 'display img)
(overlay-put ov 'face 'default) ;; (overlay-put ov 'face 'default)
(overlay-put ov 'help-echo emoj) (overlay-put ov 'help-echo emoj)
(overlay-put ov 'org-image-overlay t) (overlay-put ov 'org-image-overlay t)
(overlay-put ov 'modification-hooks (overlay-put ov 'modification-hooks
@ -95,6 +103,7 @@ returns nil if such an emoji does not exist."
;; (overlay-put text-ov 'help-echo text) ;; (overlay-put text-ov 'help-echo text)
;; (put-text-property text-beg text-end 'display '(height 0.8)) ;; (put-text-property text-beg text-end 'display '(height 0.8))
(overlay-put placehoverlay 'display '(height 0.8)) (overlay-put placehoverlay 'display '(height 0.8))
(overlay-put placehoverlay 'mfm-tag "small")
(overlay-put placehoverlay 'modification-hooks (overlay-put placehoverlay 'modification-hooks
(list (list
'mir/remove-all-overlays 'mir/remove-all-overlays
@ -124,13 +133,10 @@ returns nil if such an emoji does not exist."
(overlay-end overlay))) (overlay-end overlay)))
(defface mfm-delimiter-invis-face (defface mfm-delimiter-invis-face
'((t (:string ""))) '((t (:string "")))
"Face for misskey markdown elements such as <small> type stuff.") "Face for misskey markdown elements such as <small\> type stuff.")
;; the fact is, <small>this :neofox: is smol</small ;; the fact is, <small>this :neofox: is <small>extra</small> smol</small> <-- she should render double small
;; <small>this :neocat: is also smol</small> apparently ;; <small>this :neocat: is also smol</small apparently
;; <small>
;; this comment is entirely small
; </small>
(font-lock-add-keywords (font-lock-add-keywords
nil ; this must needs be nil nil ; this must needs be nil
@ -151,6 +157,8 @@ returns nil if such an emoji does not exist."
(add-hook 'mastodon-mode #'fedimoji-mode) (add-hook 'mastodon-mode #'fedimoji-mode)
(add-hook 'mastodon-toot-mode-hook #'fedimoji-mode) (add-hook 'mastodon-toot-mode-hook #'fedimoji-mode)
;; ":neofox:" <-- this fucking fox is breaking my syntax highlighting ;; ":neofox:" <-- this fucking fox is breaking my syntax highlighting
;; can we do animated? :nixos-3d:
;; apparently so... :silvervale_waves:
;; (defun mfm-render (input) ;; (defun mfm-render (input)
;; "Convert INPUT plain text to propertized rich text using the implemented set of misskey flavored markdown." ;; "Convert INPUT plain text to propertized rich text using the implemented set of misskey flavored markdown."