emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5012124: Make `C-x 8 e e' work better in the terminal


From: Lars Ingebrigtsen
Subject: master 5012124: Make `C-x 8 e e' work better in the terminal
Date: Sun, 7 Nov 2021 10:59:31 -0500 (EST)

branch: master
commit 50121247079cd1ce06f093391b744c8f3fee49d6
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make `C-x 8 e e' work better in the terminal
    
    * lisp/international/emoji.el (emoji--adjust-displayable-1): Make
    something rudimentary work on non-graphical Emacsen for `C-x 8 e e'.
---
 lisp/international/emoji.el | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index 2cba707..d2570e9 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -266,15 +266,26 @@ character) under point is."
         ;; the search feature.
         (when-let ((name (emoji--name glyph)))
           (setf (gethash (downcase name) emoji--all-bases) glyph))
-        ;; Remove glyphs we don't have in graphical displays.
-        (if (let ((char (elt glyph 0)))
-              (if emoji--font
-                  (font-has-char-p emoji--font char)
-                (when-let ((font (car (internal-char-font nil char))))
-                  (setq emoji--font font))))
-            (setq alist (cdr alist))
-          ;; Remove the element.
-          (setcdr alist (cddr alist)))))))
+        (if (display-graphic-p)
+            ;; Remove glyphs we don't have in graphical displays.
+            (if (let ((char (elt glyph 0)))
+                  (if emoji--font
+                      (font-has-char-p emoji--font char)
+                    (when-let ((font (car (internal-char-font nil char))))
+                      (setq emoji--font font))))
+                (setq alist (cdr alist))
+              ;; Remove the element.
+              (setcdr alist (cddr alist)))
+          ;; We don't have font info on non-graphical displays.
+          (if (let ((char (elt glyph 0)))
+                ;; FIXME.  Some grapheme clusters display more or less
+                ;; correctly in the terminal, but we don't really know
+                ;; which ones.  None of these display totally
+                ;; correctly, though, so should they be filtered out?
+                (char-displayable-p char))
+              (setq alist (cdr alist))
+            ;; Remove the element.
+            (setcdr alist (cddr alist))))))))
 
 (defun emoji--parse-emoji-test ()
   (setq emoji--labels nil)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]