:version "29.1")
(defcustom outline-minor-mode-buttons
- '(("▶️". "🔽")
- ("▶" . "▼"))
+ '(("▶️" "🔽" outline--valid-emoji-p)
+ ("▶" "▼" outline--valid-char-p))
"List of close/open pairs to use if using buttons."
:type 'sexp
:version "29.1")
(outline-flag-subtree t))
(defun outline--make-button (type)
- (cl-loop for (close . open) in outline-minor-mode-buttons
- when (and (char-displayable-p (aref close 0))
- (char-displayable-p (aref open 0)))
+ (cl-loop for (close open test) in outline-minor-mode-buttons
+ when (and (funcall test close) (funcall test open))
return (concat (if (eq type 'close)
close
open)
" " (buffer-substring (point) (1+ (point))))))
+(defun outline--valid-emoji-p (string)
+ (when-let ((font (car (internal-char-font nil ?😀))))
+ (font-has-char-p font (aref string 0))))
+
+(defun outline--valid-char-p (string)
+ (char-displayable-p (aref string 0)))
+
(defun outline--make-button-overlay (type)
(let ((o (seq-find (lambda (o)
(overlay-get o 'outline-button))