emacs-diffs
[Top][All Lists]
Advanced

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

master 30ba1fc 1/5: Merge from origin/emacs-27


From: Glenn Morris
Subject: master 30ba1fc 1/5: Merge from origin/emacs-27
Date: Tue, 27 Oct 2020 11:25:07 -0400 (EDT)

branch: master
commit 30ba1fcd1bb54d22e60a29f57c1e40b887b62562
Merge: d340826 8b87ea6
Author: Glenn Morris <rgm@gnu.org>
Commit: Glenn Morris <rgm@gnu.org>

    Merge from origin/emacs-27
    
    8b87ea6844 Recommend lexical-binding in Coding Conventions
    e29cace60a Avoid rare crashes while producing line numbers
---
 doc/lispref/tips.texi | 17 +++++++++++------
 src/xdisp.c           |  7 +++++++
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index aaef858..3283663 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -95,6 +95,11 @@ If one prefix is insufficient, your package can use two or 
three
 alternative common prefixes, so long as they make sense.
 
 @item
+We recommend enabling @code{lexical-binding} in new code, and
+converting existing Emacs Lisp code to enable @code{lexical-binding}
+if it doesn't already.  @xref{Using Lexical Binding}.
+
+@item
 Put a call to @code{provide} at the end of each separate Lisp file.
 @xref{Named Features}.
 
@@ -990,7 +995,7 @@ explains these conventions, starting with an example:
 
 @smallexample
 @group
-;;; foo.el --- Support for the Foo programming language
+;;; foo.el --- Support for the Foo programming language  -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 2010-2020 Your Name
 @end group
@@ -1013,14 +1018,14 @@ explains these conventions, starting with an example:
   The very first line should have this format:
 
 @example
-;;; @var{filename} --- @var{description}
+;;; @var{filename} --- @var{description}  -*- lexical-binding: t; -*-
 @end example
 
 @noindent
-The description should be contained in one line.  If the file
-needs a @samp{-*-} specification, put it after @var{description}.
-If this would make the first line too long, use a Local Variables
-section at the end of the file.
+The description should be contained in one line.  If the file needs to
+set more variables in the @samp{-*-} specification, add it after
+@code{lexical-binding}.  If this would make the first line too long, use
+a Local Variables section at the end of the file.
 
   The copyright notice usually lists your name (if you wrote the
 file).  If you have an employer who claims copyright on your work, you
diff --git a/src/xdisp.c b/src/xdisp.c
index 5a62cd6..c657978 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -22983,6 +22983,10 @@ maybe_produce_line_number (struct it *it)
   int lnum_face_id = merge_faces (it->w, Qline_number, 0, DEFAULT_FACE_ID);
   int current_lnum_face_id
     = merge_faces (it->w, Qline_number_current_line, 0, DEFAULT_FACE_ID);
+  /* From here onwards, we must prevent freeing realized faces, because
+     we are using the above 2 face IDs for the glyphs we produce.  */
+  bool save_free_realized_faces = inhibit_free_realized_faces;
+  inhibit_free_realized_faces = true;
   /* Compute point's line number if needed.  */
   if ((EQ (Vdisplay_line_numbers, Qrelative)
        || EQ (Vdisplay_line_numbers, Qvisual)
@@ -23112,10 +23116,13 @@ maybe_produce_line_number (struct it *it)
          it->lnum_width = 0;
          it->lnum_pixel_width = 0;
          bidi_unshelve_cache (itdata, false);
+         inhibit_free_realized_faces = save_free_realized_faces;
          return;
        }
     }
 
+  inhibit_free_realized_faces = save_free_realized_faces;
+
   /* Record the width in pixels we need for the line number display.  */
   it->lnum_pixel_width = tem_it.current_x;
   /* Copy the produced glyphs into IT's glyph_row.  */



reply via email to

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