emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 44e402e: Allow to disable compaction of font cach


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-25 44e402e: Allow to disable compaction of font caches
Date: Sat, 8 Oct 2016 19:33:02 +0000 (UTC)

branch: emacs-25
commit 44e402ead35eb9b4d0bf8a94a4d3ca933629aba9
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Allow to disable compaction of font caches
    
    * src/font.c (syms_of_font) <inhibit-compacting-font-caches>: New
    boolean variable.
    * src/alloc.c (compact_font_caches): Use it to bypass the call to
    compact_font_cache_entry.  (Bug#24634)  (Bug#24565)
    
    * etc/NEWS: Mention the new variable.
---
 etc/NEWS    |    6 ++++++
 src/alloc.c |    6 +++++-
 src/font.c  |   13 +++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 8c27289..3e686f9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -38,6 +38,12 @@ fontsets if the default font supports these characters.  Set 
this
 variable to nil to disable the new behavior and get back the old
 behavior.
 
+---
+** New variable 'inhibit-compacting-font-caches'.
+Set this variable to a non-nil value to speed up display of characters
+using large fonts, at the price of a larger memory footprint of the
+Emacs session.
+
 
 * Installation Changes in Emacs 25.1
 
diff --git a/src/alloc.c b/src/alloc.c
index f33d93f..c7f58a8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5584,7 +5584,11 @@ compact_font_caches (void)
   for (t = terminal_list; t; t = t->next_terminal)
     {
       Lisp_Object cache = TERMINAL_FONT_CACHE (t);
-      if (CONSP (cache))
+      /* Inhibit compacting the caches if the user so wishes.  Some of
+        the users don't mind a larger memory footprint, but do mind
+        slower redisplay.  */
+      if (!inhibit_compacting_font_caches
+         && CONSP (cache))
        {
          Lisp_Object entry;
 
diff --git a/src/font.c b/src/font.c
index 2519599..b85956f 100644
--- a/src/font.c
+++ b/src/font.c
@@ -5430,6 +5430,19 @@ Set it to nil to enable logging.  If the environment 
variable
 EMACS_FONT_LOG is set at startup, it defaults to nil.  */);
   Vfont_log = Qnil;
 
+  DEFVAR_BOOL ("inhibit-compacting-font-caches", 
inhibit_compacting_font_caches,
+              doc: /*
+If non-nil, don't compact font caches during GC.
+Some large fonts cause lots of consing and trigger GC.  If they
+are removed from the font caches, they will need to be opened
+again during redisplay, which slows down redisplay.  If you
+see font-related delays in displaying some special characters,
+and cannot switch to a smaller font for those characters, set
+this variable non-nil.
+Disabling compaction of font caches might enlarge the Emacs memory
+footprint in sessions that use lots of different fonts.  */);
+  inhibit_compacting_font_caches = 0;
+
 #ifdef HAVE_WINDOW_SYSTEM
 #ifdef HAVE_FREETYPE
   syms_of_ftfont ();



reply via email to

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