diff --git a/sharkey.el b/sharkey.el index fc82f95..228c3b0 100644 --- a/sharkey.el +++ b/sharkey.el @@ -69,8 +69,9 @@ returns nil if such an emoji does not exist." (overlay-put ov 'modification-hooks (list 'org-display-inline-remove-overlay)))))) (defvar sharkey/small-rx + ;; this might display a bit weird... sorgy (rx (group-n 1 "") - (group-n 2 (+ any)) + (group-n 2 (+? (or "\n" any))) (group-n 3 ""))) (defun next-small-overlay (&optional limit) "logic from `next-emoji-overlay' but for mfm tag." @@ -87,30 +88,56 @@ returns nil if such an emoji does not exist." (text (buffer-substring text-beg text-end)) (text-ov (make-overlay text-beg text-end)) ) - ;; (overlay-put openr-ov 'display "") - ;; (overlay-put close-ov 'display "") - (put-text-property openr-beg openr-end 'invisible t) - (put-text-property close-beg close-end 'invisible t) - (overlay-put text-ov 'help-echo text) - (overlay-put text-ov 'display '(height 0.8)) + (overlay-put openr-ov 'display "") + (overlay-put close-ov 'display "") + ;; (put-text-property openr-beg openr-end 'invisible t) + ;; (put-text-property close-beg close-end 'invisible t) + ;; (overlay-put text-ov 'help-echo text) + ;; (put-text-property text-beg text-end 'display '(height 0.8)) + (overlay-put placehoverlay 'display '(height 0.8)) (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)) ;; (overlay-put openr-ov 'org-image-overlay t) ;; (overlay-put close-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 '((t (:string ""))) "Face for misskey markdown elements such as type stuff.") -;; this :neofox is smol +;; the fact is, this :neofox: is smolthis :neocat: is also smol apparently +;; +;; this comment is entirely small +; (font-lock-add-keywords nil ; this must needs be nil `((next-emoji-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 3 'mfm-delimiter-invis-face t) + (next-small-overlay (0 'font-lock-keyword-face t)) + ;; (,sharkey/small-rx 1 'mfm-delimiter-invis-face t) + ;; (,sharkey/small-rx 3 'mfm-delimiter-invis-face t) ) t) (define-minor-mode fedimoji-mode