emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b2783ba: Avoid loading mule-util at startup


From: Eli Zaretskii
Subject: [Emacs-diffs] master b2783ba: Avoid loading mule-util at startup
Date: Sat, 13 Jul 2019 04:33:23 -0400 (EDT)

branch: master
commit b2783ba6f4c663556709f524a2ff34f18072e9f3
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid loading mule-util at startup
    
    * lisp/international/mule-util.el (char-displayable-p): Move
    from here...
    * lisp/international/mule.el (char-displayable-p): ...to
    here.  This avoids always loading mule-util at startup due
    to a call to 'char-displayable-p' in
    'startup--setup-quote-display'.
---
 lisp/international/mule-util.el | 56 -----------------------------------------
 lisp/international/mule.el      | 55 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 56 deletions(-)

diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index de5e7d8..19d6d16 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -282,62 +282,6 @@ language environment LANG-ENV."
 
 (declare-function internal-char-font "font.c" (position &optional ch))
 
-;;;###autoload
-(defun char-displayable-p (char)
-  "Return non-nil if we should be able to display CHAR.
-On a multi-font display, the test is only whether there is an
-appropriate font from the selected frame's fontset to display
-CHAR's charset in general.  Since fonts may be specified on a
-per-character basis, this may not be accurate."
-  (cond ((< char 128)
-        ;; ASCII characters are always displayable.
-        t)
-       ((not enable-multibyte-characters)
-        ;; Maybe there's a font for it, but we can't put it in the buffer.
-        nil)
-       (t
-        (let ((font-glyph (internal-char-font nil char)))
-          (if font-glyph
-              (if (consp font-glyph)
-                  ;; On a window system, a character is displayable
-                  ;; if a font for that character is in the default
-                  ;; face of the currently selected frame.
-                  (car font-glyph)
-                ;; On a text terminal supporting glyph codes, CHAR is
-                ;; displayable if its glyph code is nonnegative.
-                (<= 0 font-glyph))
-            ;; On a text terminal without glyph codes, CHAR is displayable
-            ;; if the coding system for the terminal can encode it.
-            (let ((coding (terminal-coding-system)))
-              (when coding
-                (let ((cs-list (coding-system-get coding :charset-list)))
-                  (cond
-                   ((listp cs-list)
-                    (catch 'tag
-                      (mapc #'(lambda (charset)
-                                (if (encode-char char charset)
-                                    (throw 'tag charset)))
-                            cs-list)
-                      nil))
-                   ((eq cs-list 'iso-2022)
-                    (catch 'tag2
-                      (mapc #'(lambda (charset)
-                                (if (and (plist-get (charset-plist charset)
-                                                    :iso-final-char)
-                                         (encode-char char charset))
-                                    (throw 'tag2 charset)))
-                            charset-list)
-                      nil))
-                   ((eq cs-list 'emacs-mule)
-                    (catch 'tag3
-                      (mapc #'(lambda (charset)
-                                (if (and (plist-get (charset-plist charset)
-                                                    :emacs-mule-id)
-                                         (encode-char char charset))
-                                    (throw 'tag3 charset)))
-                            charset-list)
-                      nil)))))))))))
-
 (defun filepos-to-bufferpos--dos (byte f)
   (let ((eol-offset 0)
         ;; Make sure we terminate, even if BYTE falls right in the middle
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 21f3118..ec6f647 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -481,6 +481,61 @@ Return -1 if charset isn't an ISO 2022 one."
     (or charset
        (error "Invalid Emacs-mule charset ID: %d" charset-id))
     (make-char charset code1 code2)))
+
+(defun char-displayable-p (char)
+  "Return non-nil if we should be able to display CHAR.
+On a multi-font display, the test is only whether there is an
+appropriate font from the selected frame's fontset to display
+CHAR's charset in general.  Since fonts may be specified on a
+per-character basis, this may not be accurate."
+  (cond ((< char 128)
+        ;; ASCII characters are always displayable.
+        t)
+       ((not enable-multibyte-characters)
+        ;; Maybe there's a font for it, but we can't put it in the buffer.
+        nil)
+       (t
+        (let ((font-glyph (internal-char-font nil char)))
+          (if font-glyph
+              (if (consp font-glyph)
+                  ;; On a window system, a character is displayable
+                  ;; if a font for that character is in the default
+                  ;; face of the currently selected frame.
+                  (car font-glyph)
+                ;; On a text terminal supporting glyph codes, CHAR is
+                ;; displayable if its glyph code is nonnegative.
+                (<= 0 font-glyph))
+            ;; On a text terminal without glyph codes, CHAR is displayable
+            ;; if the coding system for the terminal can encode it.
+            (let ((coding (terminal-coding-system)))
+              (when coding
+                (let ((cs-list (coding-system-get coding :charset-list)))
+                  (cond
+                   ((listp cs-list)
+                    (catch 'tag
+                      (mapc #'(lambda (charset)
+                                (if (encode-char char charset)
+                                    (throw 'tag charset)))
+                            cs-list)
+                      nil))
+                   ((eq cs-list 'iso-2022)
+                    (catch 'tag2
+                      (mapc #'(lambda (charset)
+                                (if (and (plist-get (charset-plist charset)
+                                                    :iso-final-char)
+                                         (encode-char char charset))
+                                    (throw 'tag2 charset)))
+                            charset-list)
+                      nil))
+                   ((eq cs-list 'emacs-mule)
+                    (catch 'tag3
+                      (mapc #'(lambda (charset)
+                                (if (and (plist-get (charset-plist charset)
+                                                    :emacs-mule-id)
+                                         (encode-char char charset))
+                                    (throw 'tag3 charset)))
+                            charset-list)
+                      nil)))))))))))
 
 ;; Save the ASCII case table in case we need it later.  Some locales
 ;; (such as Turkish) modify the case behavior of ASCII characters,



reply via email to

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