Compare commits

...

2 Commits

View File

@ -7,7 +7,7 @@
(mastodon-instance-url "https://talk.marq42.xyz") (mastodon-instance-url "https://talk.marq42.xyz")
(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) (mastodon-use-emojify t)
:demand) :demand)
;; 日本語 ;; 日本語
@ -16,7 +16,7 @@
;; let's start by making :rena: render as the rena.webp image... ;; let's start by making :rena: render as the rena.webp image...
:neocat_pat_floof: :neocat_pat_floof::3:
(defvar sharkey/emoji-cache-dir "~/.emoji" (defvar sharkey/emoji-cache-dir "~/.emoji"
"Directory under which to store fedi emoji cache.") "Directory under which to store fedi emoji cache.")
(defun sharkey--emoji-cache (name &optional instance) (defun sharkey--emoji-cache (name &optional instance)
@ -69,8 +69,9 @@ returns nil if such an emoji does not exist."
(overlay-put ov 'modification-hooks (overlay-put ov 'modification-hooks
(list 'org-display-inline-remove-overlay)))))) (list 'org-display-inline-remove-overlay))))))
(defvar sharkey/small-rx (defvar sharkey/small-rx
;; this might display a bit weird... sorgy
(rx (group-n 1 "<small>") (rx (group-n 1 "<small>")
(group-n 2 (+ any)) (group-n 2 (+? (or "\n" any)))
(group-n 3 "</small>"))) (group-n 3 "</small>")))
(defun next-small-overlay (&optional limit) (defun next-small-overlay (&optional limit)
"logic from `next-emoji-overlay' but for mfm <small></small> tag." "logic from `next-emoji-overlay' but for mfm <small></small> tag."
@ -87,30 +88,56 @@ returns nil if such an emoji does not exist."
(text (buffer-substring text-beg text-end)) (text (buffer-substring text-beg text-end))
(text-ov (make-overlay text-beg text-end)) (text-ov (make-overlay text-beg text-end))
) )
;; (overlay-put openr-ov 'display "") (overlay-put openr-ov 'display "")
;; (overlay-put close-ov 'display "") (overlay-put close-ov 'display "")
(put-text-property openr-beg openr-end 'invisible t) ;; (put-text-property openr-beg openr-end 'invisible t)
(put-text-property close-beg close-end 'invisible t) ;; (put-text-property close-beg close-end 'invisible t)
(overlay-put text-ov 'help-echo text) ;; (overlay-put text-ov 'help-echo text)
(overlay-put text-ov '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 'modification-hooks (overlay-put placehoverlay 'modification-hooks
(list
'mir/remove-all-overlays
'org-display-inline-remove-overlay))
(overlay-put openr-ov 'modification-hooks
(list 'org-display-inline-remove-overlay))
(overlay-put close-ov 'modification-hooks
(list 'org-display-inline-remove-overlay)) (list 'org-display-inline-remove-overlay))
;; (overlay-put openr-ov 'org-image-overlay t) ;; (overlay-put openr-ov 'org-image-overlay t)
;; (overlay-put close-ov 'org-image-overlay t) ;; (overlay-put close-ov 'org-image-overlay t)
;; (overlay-put text-ov 'org-image-overlay t) ;; (overlay-put text-ov 'org-image-overlay t)
))) )))
(defun mir/remove-all-overlays (&optional overlay nyl beg end)
"Delete all overlays resting on current line."
;; (message "%s" throwaway)
;; ^^^--> list of overlay, nil, bounds
(let* ((start-bound (or beg (pos-bol)))
(end-bound (or end (pos-eol))))
(--map
(mapcar #'delete-overlay (overlays-at it))
(number-sequence start-bound end-bound)))
nil)
(defun mir/overlay-bounds (overlay)
"Return a cons of `(start . end)' for OVERLAY."
(cons
(overlay-start 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.")
;; <small>this :neofox is smol</small> ;; the fact is, <small>this :neofox: is smol</small
;; <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
`((next-emoji-overlay (0 'font-lock-keyword-face t)) `((next-emoji-overlay (0 'font-lock-keyword-face t))
;; (next-small-overlay (0 'font-lock-keyword-face t)) (next-small-overlay (0 'font-lock-keyword-face t))
(,sharkey/small-rx 1 'mfm-delimiter-invis-face t) ;; (,sharkey/small-rx 1 'mfm-delimiter-invis-face t)
(,sharkey/small-rx 3 'mfm-delimiter-invis-face t) ;; (,sharkey/small-rx 3 'mfm-delimiter-invis-face t)
) t) ) t)
(define-minor-mode fedimoji-mode (define-minor-mode fedimoji-mode