diff --git a/lisp/outline.el b/lisp/outline.el index 9058293e277..8dffca756fc 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -281,8 +281,8 @@ buttons should look." :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") @@ -951,14 +951,20 @@ If non-nil, EVENT should be a mouse event." (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))