aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-11-29 15:11:38 +0100
committerAndrea Corallo2020-11-29 15:11:38 +0100
commit6523b8401519a29ca0aefaf44c3dfa36f681f64e (patch)
treea691422921ad1287fdeade2128efed4c59c14e8d /src
parent2e0256e0a02edad129e0af1ea97b9e263c5d83fb (diff)
parent38ed05f49fcfe7c6d6908041010881a04a7ff6b1 (diff)
downloademacs-6523b8401519a29ca0aefaf44c3dfa36f681f64e.tar.gz
emacs-6523b8401519a29ca0aefaf44c3dfa36f681f64e.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in7
-rw-r--r--src/alloc.c13
-rw-r--r--src/emacs-module.c104
-rw-r--r--src/eval.c89
-rw-r--r--src/font.c17
-rw-r--r--src/frame.c16
-rw-r--r--src/lisp.h11
-rw-r--r--src/minibuf.c5
-rw-r--r--src/nsterm.m2
-rw-r--r--src/pdumper.c2
-rw-r--r--src/search.c18
-rw-r--r--src/w32fns.c14
-rw-r--r--src/xdisp.c2
13 files changed, 223 insertions, 77 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 001f0c40722..bd38b016fa6 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -341,6 +341,10 @@ DUMPING=@DUMPING@
341CHECK_STRUCTS = @CHECK_STRUCTS@ 341CHECK_STRUCTS = @CHECK_STRUCTS@
342HAVE_PDUMPER = @HAVE_PDUMPER@ 342HAVE_PDUMPER = @HAVE_PDUMPER@
343 343
344## ARM Macs require that all code have a valid signature. Since pump
345## invalidates the signature, we must re-sign to fix it.
346DO_CODESIGN=$(patsubst aarch64-apple-darwin%,yes,@configuration@)
347
344# 'make' verbosity. 348# 'make' verbosity.
345AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 349AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
346 350
@@ -659,6 +663,9 @@ temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) \
659 $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) 663 $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
660ifeq ($(HAVE_PDUMPER),yes) 664ifeq ($(HAVE_PDUMPER),yes)
661 $(AM_V_at)$(MAKE_PDUMPER_FINGERPRINT) $@.tmp 665 $(AM_V_at)$(MAKE_PDUMPER_FINGERPRINT) $@.tmp
666ifeq ($(DO_CODESIGN),yes)
667 codesign -s - -f $@.tmp
668endif
662endif 669endif
663 $(AM_V_at)mv $@.tmp $@ 670 $(AM_V_at)mv $@.tmp $@
664 $(MKDIR_P) $(etc) 671 $(MKDIR_P) $(etc)
diff --git a/src/alloc.c b/src/alloc.c
index ff6681cc760..133b0e6c9e9 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6082,10 +6082,6 @@ garbage_collect (void)
6082 mark_fringe_data (); 6082 mark_fringe_data ();
6083#endif 6083#endif
6084 6084
6085#ifdef HAVE_MODULES
6086 mark_modules ();
6087#endif
6088
6089 /* Everything is now marked, except for the data in font caches, 6085 /* Everything is now marked, except for the data in font caches,
6090 undo lists, and finalizers. The first two are compacted by 6086 undo lists, and finalizers. The first two are compacted by
6091 removing an items which aren't reachable otherwise. */ 6087 removing an items which aren't reachable otherwise. */
@@ -6179,10 +6175,17 @@ where each entry has the form (NAME SIZE USED FREE), where:
6179- FREE is the number of those objects that are not live but that Emacs 6175- FREE is the number of those objects that are not live but that Emacs
6180 keeps around for future allocations (maybe because it does not know how 6176 keeps around for future allocations (maybe because it does not know how
6181 to return them to the OS). 6177 to return them to the OS).
6178
6182However, if there was overflow in pure space, and Emacs was dumped 6179However, if there was overflow in pure space, and Emacs was dumped
6183using the 'unexec' method, `garbage-collect' returns nil, because 6180using the 'unexec' method, `garbage-collect' returns nil, because
6184real GC can't be done. 6181real GC can't be done.
6185See Info node `(elisp)Garbage Collection'. */) 6182
6183Note that calling this function does not guarantee that absolutely all
6184unreachable objects will be garbage-collected. Emacs uses a
6185mark-and-sweep garbage collector, but is conservative when it comes to
6186collecting objects in some circumstances.
6187
6188For further details, see Info node `(elisp)Garbage Collection'. */)
6186 (void) 6189 (void)
6187{ 6190{
6188 if (garbage_collection_inhibited) 6191 if (garbage_collection_inhibited)
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 23b8e8620c9..5f97815ec15 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -200,8 +200,6 @@ static AVOID module_abort (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
200static emacs_env *initialize_environment (emacs_env *, 200static emacs_env *initialize_environment (emacs_env *,
201 struct emacs_env_private *); 201 struct emacs_env_private *);
202static void finalize_environment (emacs_env *); 202static void finalize_environment (emacs_env *);
203static void finalize_environment_unwind (void *);
204static void finalize_runtime_unwind (void *);
205static void module_handle_nonlocal_exit (emacs_env *, enum nonlocal_exit, 203static void module_handle_nonlocal_exit (emacs_env *, enum nonlocal_exit,
206 Lisp_Object); 204 Lisp_Object);
207static void module_non_local_exit_signal_1 (emacs_env *, 205static void module_non_local_exit_signal_1 (emacs_env *,
@@ -1089,10 +1087,6 @@ module_signal_or_throw (struct emacs_env_private *env)
1089 } 1087 }
1090} 1088}
1091 1089
1092/* Live runtime and environment objects, for assertions. */
1093static Lisp_Object Vmodule_runtimes;
1094static Lisp_Object Vmodule_environments;
1095
1096DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0, 1090DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0,
1097 doc: /* Load module FILE. */) 1091 doc: /* Load module FILE. */)
1098 (Lisp_Object file) 1092 (Lisp_Object file)
@@ -1137,9 +1131,9 @@ DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0,
1137 rt->private_members = &rt_priv; 1131 rt->private_members = &rt_priv;
1138 rt->get_environment = module_get_environment; 1132 rt->get_environment = module_get_environment;
1139 1133
1140 Vmodule_runtimes = Fcons (make_mint_ptr (rt), Vmodule_runtimes);
1141 ptrdiff_t count = SPECPDL_INDEX (); 1134 ptrdiff_t count = SPECPDL_INDEX ();
1142 record_unwind_protect_ptr (finalize_runtime_unwind, rt); 1135 record_unwind_protect_module (SPECPDL_MODULE_RUNTIME, rt);
1136 record_unwind_protect_module (SPECPDL_MODULE_ENVIRONMENT, rt_priv.env);
1143 1137
1144 int r = module_init (rt); 1138 int r = module_init (rt);
1145 1139
@@ -1167,7 +1161,7 @@ funcall_module (Lisp_Object function, ptrdiff_t nargs, Lisp_Object *arglist)
1167 struct emacs_env_private priv; 1161 struct emacs_env_private priv;
1168 emacs_env *env = initialize_environment (&pub, &priv); 1162 emacs_env *env = initialize_environment (&pub, &priv);
1169 ptrdiff_t count = SPECPDL_INDEX (); 1163 ptrdiff_t count = SPECPDL_INDEX ();
1170 record_unwind_protect_ptr (finalize_environment_unwind, env); 1164 record_unwind_protect_module (SPECPDL_MODULE_ENVIRONMENT, env);
1171 1165
1172 USE_SAFE_ALLOCA; 1166 USE_SAFE_ALLOCA;
1173 emacs_value *args = nargs > 0 ? SAFE_ALLOCA (nargs * sizeof *args) : NULL; 1167 emacs_value *args = nargs > 0 ? SAFE_ALLOCA (nargs * sizeof *args) : NULL;
@@ -1243,12 +1237,13 @@ module_assert_runtime (struct emacs_runtime *runtime)
1243 if (! module_assertions) 1237 if (! module_assertions)
1244 return; 1238 return;
1245 ptrdiff_t count = 0; 1239 ptrdiff_t count = 0;
1246 for (Lisp_Object tail = Vmodule_runtimes; CONSP (tail); tail = XCDR (tail)) 1240 for (const union specbinding *pdl = specpdl; pdl != specpdl_ptr; ++pdl)
1247 { 1241 if (pdl->kind == SPECPDL_MODULE_RUNTIME)
1248 if (xmint_pointer (XCAR (tail)) == runtime) 1242 {
1249 return; 1243 if (pdl->unwind_ptr.arg == runtime)
1250 ++count; 1244 return;
1251 } 1245 ++count;
1246 }
1252 module_abort ("Runtime pointer not found in list of %"pD"d runtimes", 1247 module_abort ("Runtime pointer not found in list of %"pD"d runtimes",
1253 count); 1248 count);
1254} 1249}
@@ -1259,13 +1254,13 @@ module_assert_env (emacs_env *env)
1259 if (! module_assertions) 1254 if (! module_assertions)
1260 return; 1255 return;
1261 ptrdiff_t count = 0; 1256 ptrdiff_t count = 0;
1262 for (Lisp_Object tail = Vmodule_environments; CONSP (tail); 1257 for (const union specbinding *pdl = specpdl; pdl != specpdl_ptr; ++pdl)
1263 tail = XCDR (tail)) 1258 if (pdl->kind == SPECPDL_MODULE_ENVIRONMENT)
1264 { 1259 {
1265 if (xmint_pointer (XCAR (tail)) == env) 1260 if (pdl->unwind_ptr.arg == env)
1266 return; 1261 return;
1267 ++count; 1262 ++count;
1268 } 1263 }
1269 module_abort ("Environment pointer not found in list of %"pD"d environments", 1264 module_abort ("Environment pointer not found in list of %"pD"d environments",
1270 count); 1265 count);
1271} 1266}
@@ -1323,22 +1318,22 @@ value_to_lisp (emacs_value v)
1323 environments. */ 1318 environments. */
1324 ptrdiff_t num_environments = 0; 1319 ptrdiff_t num_environments = 0;
1325 ptrdiff_t num_values = 0; 1320 ptrdiff_t num_values = 0;
1326 for (Lisp_Object environments = Vmodule_environments; 1321 for (const union specbinding *pdl = specpdl; pdl != specpdl_ptr; ++pdl)
1327 CONSP (environments); environments = XCDR (environments)) 1322 if (pdl->kind == SPECPDL_MODULE_ENVIRONMENT)
1328 { 1323 {
1329 emacs_env *env = xmint_pointer (XCAR (environments)); 1324 const emacs_env *env = pdl->unwind_ptr.arg;
1330 struct emacs_env_private *priv = env->private_members; 1325 struct emacs_env_private *priv = env->private_members;
1331 /* The value might be one of the nonlocal exit values. Note 1326 /* The value might be one of the nonlocal exit values. Note
1332 that we don't check whether a nonlocal exit is currently 1327 that we don't check whether a nonlocal exit is currently
1333 pending, because the module might have cleared the flag 1328 pending, because the module might have cleared the flag
1334 in the meantime. */ 1329 in the meantime. */
1335 if (&priv->non_local_exit_symbol == v 1330 if (&priv->non_local_exit_symbol == v
1336 || &priv->non_local_exit_data == v) 1331 || &priv->non_local_exit_data == v)
1337 goto ok; 1332 goto ok;
1338 if (value_storage_contains_p (&priv->storage, v, &num_values)) 1333 if (value_storage_contains_p (&priv->storage, v, &num_values))
1339 goto ok; 1334 goto ok;
1340 ++num_environments; 1335 ++num_environments;
1341 } 1336 }
1342 /* Also check global values. */ 1337 /* Also check global values. */
1343 if (module_global_reference_p (v, &num_values)) 1338 if (module_global_reference_p (v, &num_values))
1344 goto ok; 1339 goto ok;
@@ -1421,18 +1416,14 @@ allocate_emacs_value (emacs_env *env, Lisp_Object obj)
1421/* Mark all objects allocated from local environments so that they 1416/* Mark all objects allocated from local environments so that they
1422 don't get garbage-collected. */ 1417 don't get garbage-collected. */
1423void 1418void
1424mark_modules (void) 1419mark_module_environment (void *ptr)
1425{ 1420{
1426 for (Lisp_Object tem = Vmodule_environments; CONSP (tem); tem = XCDR (tem)) 1421 emacs_env *env = ptr;
1427 { 1422 struct emacs_env_private *priv = env->private_members;
1428 emacs_env *env = xmint_pointer (XCAR (tem)); 1423 for (struct emacs_value_frame *frame = &priv->storage.initial; frame != NULL;
1429 struct emacs_env_private *priv = env->private_members; 1424 frame = frame->next)
1430 for (struct emacs_value_frame *frame = &priv->storage.initial; 1425 for (int i = 0; i < frame->offset; ++i)
1431 frame != NULL; 1426 mark_object (frame->objects[i].v);
1432 frame = frame->next)
1433 for (int i = 0; i < frame->offset; ++i)
1434 mark_object (frame->objects[i].v);
1435 }
1436} 1427}
1437 1428
1438 1429
@@ -1495,7 +1486,6 @@ initialize_environment (emacs_env *env, struct emacs_env_private *priv)
1495 env->set_function_finalizer = module_set_function_finalizer; 1486 env->set_function_finalizer = module_set_function_finalizer;
1496 env->open_channel = module_open_channel; 1487 env->open_channel = module_open_channel;
1497 env->make_interactive = module_make_interactive; 1488 env->make_interactive = module_make_interactive;
1498 Vmodule_environments = Fcons (make_mint_ptr (env), Vmodule_environments);
1499 return env; 1489 return env;
1500} 1490}
1501 1491
@@ -1505,22 +1495,18 @@ static void
1505finalize_environment (emacs_env *env) 1495finalize_environment (emacs_env *env)
1506{ 1496{
1507 finalize_storage (&env->private_members->storage); 1497 finalize_storage (&env->private_members->storage);
1508 eassert (xmint_pointer (XCAR (Vmodule_environments)) == env);
1509 Vmodule_environments = XCDR (Vmodule_environments);
1510} 1498}
1511 1499
1512static void 1500void
1513finalize_environment_unwind (void *env) 1501finalize_environment_unwind (void *env)
1514{ 1502{
1515 finalize_environment (env); 1503 finalize_environment (env);
1516} 1504}
1517 1505
1518static void 1506void
1519finalize_runtime_unwind (void *raw_ert) 1507finalize_runtime_unwind (void *raw_ert)
1520{ 1508{
1521 struct emacs_runtime *ert = raw_ert; 1509 struct emacs_runtime *ert = raw_ert;
1522 eassert (xmint_pointer (XCAR (Vmodule_runtimes)) == ert);
1523 Vmodule_runtimes = XCDR (Vmodule_runtimes);
1524 finalize_environment (ert->private_members->env); 1510 finalize_environment (ert->private_members->env);
1525} 1511}
1526 1512
@@ -1610,12 +1596,6 @@ syms_of_module (void)
1610 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, 1596 DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD,
1611 Qnil, false); 1597 Qnil, false);
1612 1598
1613 staticpro (&Vmodule_runtimes);
1614 Vmodule_runtimes = Qnil;
1615
1616 staticpro (&Vmodule_environments);
1617 Vmodule_environments = Qnil;
1618
1619 DEFSYM (Qmodule_load_failed, "module-load-failed"); 1599 DEFSYM (Qmodule_load_failed, "module-load-failed");
1620 Fput (Qmodule_load_failed, Qerror_conditions, 1600 Fput (Qmodule_load_failed, Qerror_conditions,
1621 pure_list (Qmodule_load_failed, Qerror)); 1601 pure_list (Qmodule_load_failed, Qerror));
diff --git a/src/eval.c b/src/eval.c
index 09e12bd3752..aa1775b3ada 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -690,6 +690,10 @@ default_toplevel_binding (Lisp_Object symbol)
690 case SPECPDL_UNWIND_EXCURSION: 690 case SPECPDL_UNWIND_EXCURSION:
691 case SPECPDL_UNWIND_VOID: 691 case SPECPDL_UNWIND_VOID:
692 case SPECPDL_BACKTRACE: 692 case SPECPDL_BACKTRACE:
693#ifdef HAVE_MODULES
694 case SPECPDL_MODULE_RUNTIME:
695 case SPECPDL_MODULE_ENVIRONMENT:
696#endif
693 case SPECPDL_LET_LOCAL: 697 case SPECPDL_LET_LOCAL:
694 break; 698 break;
695 699
@@ -700,6 +704,49 @@ default_toplevel_binding (Lisp_Object symbol)
700 return binding; 704 return binding;
701} 705}
702 706
707/* Look for a lexical-binding of SYMBOL somewhere up the stack.
708 This will only find bindings created with interpreted code, since once
709 compiled names of lexical variables are basically gone anyway. */
710static bool
711lexbound_p (Lisp_Object symbol)
712{
713 union specbinding *pdl = specpdl_ptr;
714 while (pdl > specpdl)
715 {
716 switch ((--pdl)->kind)
717 {
718 case SPECPDL_LET_DEFAULT:
719 case SPECPDL_LET:
720 if (EQ (specpdl_symbol (pdl), Qinternal_interpreter_environment))
721 {
722 Lisp_Object env = specpdl_old_value (pdl);
723 if (CONSP (env) && !NILP (Fassq (symbol, env)))
724 return true;
725 }
726 break;
727
728 case SPECPDL_UNWIND:
729 case SPECPDL_UNWIND_ARRAY:
730 case SPECPDL_UNWIND_PTR:
731 case SPECPDL_UNWIND_INT:
732 case SPECPDL_UNWIND_INTMAX:
733 case SPECPDL_UNWIND_EXCURSION:
734 case SPECPDL_UNWIND_VOID:
735 case SPECPDL_BACKTRACE:
736#ifdef HAVE_MODULES
737 case SPECPDL_MODULE_RUNTIME:
738 case SPECPDL_MODULE_ENVIRONMENT:
739#endif
740 case SPECPDL_LET_LOCAL:
741 break;
742
743 default:
744 emacs_abort ();
745 }
746 }
747 return false;
748}
749
703DEFUN ("default-toplevel-value", Fdefault_toplevel_value, Sdefault_toplevel_value, 1, 1, 0, 750DEFUN ("default-toplevel-value", Fdefault_toplevel_value, Sdefault_toplevel_value, 1, 1, 0,
704 doc: /* Return SYMBOL's toplevel default value. 751 doc: /* Return SYMBOL's toplevel default value.
705"Toplevel" means outside of any let binding. */) 752"Toplevel" means outside of any let binding. */)
@@ -735,6 +782,15 @@ This is like `defvar' and `defconst' but without affecting the variable's
735value. */) 782value. */)
736 (Lisp_Object symbol, Lisp_Object doc) 783 (Lisp_Object symbol, Lisp_Object doc)
737{ 784{
785 if (!XSYMBOL (symbol)->u.s.declared_special
786 && lexbound_p (symbol))
787 /* This test tries to catch the situation where we do
788 (let ((<foo-var> ...)) ...(<foo-function> ...)....)
789 and where the `foo` package only gets loaded when <foo-function>
790 is called, so the outer `let` incorrectly made the binding lexical
791 because the <foo-var> wasn't yet declared as dynamic at that point. */
792 error ("Defining as dynamic an already lexical var");
793
738 XSYMBOL (symbol)->u.s.declared_special = true; 794 XSYMBOL (symbol)->u.s.declared_special = true;
739 if (!NILP (doc)) 795 if (!NILP (doc))
740 { 796 {
@@ -3512,6 +3568,15 @@ record_unwind_protect_void (void (*function) (void))
3512} 3568}
3513 3569
3514void 3570void
3571record_unwind_protect_module (enum specbind_tag kind, void *ptr)
3572{
3573 specpdl_ptr->kind = kind;
3574 specpdl_ptr->unwind_ptr.func = NULL;
3575 specpdl_ptr->unwind_ptr.arg = ptr;
3576 grow_specpdl ();
3577}
3578
3579void
3515rebind_for_thread_switch (void) 3580rebind_for_thread_switch (void)
3516{ 3581{
3517 union specbinding *bind; 3582 union specbinding *bind;
@@ -3561,6 +3626,14 @@ do_one_unbind (union specbinding *this_binding, bool unwinding,
3561 break; 3626 break;
3562 case SPECPDL_BACKTRACE: 3627 case SPECPDL_BACKTRACE:
3563 break; 3628 break;
3629#ifdef HAVE_MODULES
3630 case SPECPDL_MODULE_RUNTIME:
3631 finalize_runtime_unwind (this_binding->unwind_ptr.arg);
3632 break;
3633 case SPECPDL_MODULE_ENVIRONMENT:
3634 finalize_environment_unwind (this_binding->unwind_ptr.arg);
3635 break;
3636#endif
3564 case SPECPDL_LET: 3637 case SPECPDL_LET:
3565 { /* If variable has a trivial value (no forwarding), and isn't 3638 { /* If variable has a trivial value (no forwarding), and isn't
3566 trapped, we can just set it. */ 3639 trapped, we can just set it. */
@@ -3891,6 +3964,10 @@ backtrace_eval_unrewind (int distance)
3891 case SPECPDL_UNWIND_INTMAX: 3964 case SPECPDL_UNWIND_INTMAX:
3892 case SPECPDL_UNWIND_VOID: 3965 case SPECPDL_UNWIND_VOID:
3893 case SPECPDL_BACKTRACE: 3966 case SPECPDL_BACKTRACE:
3967#ifdef HAVE_MODULES
3968 case SPECPDL_MODULE_RUNTIME:
3969 case SPECPDL_MODULE_ENVIRONMENT:
3970#endif
3894 break; 3971 break;
3895 case SPECPDL_LET: 3972 case SPECPDL_LET:
3896 { /* If variable has a trivial value (no forwarding), we can 3973 { /* If variable has a trivial value (no forwarding), we can
@@ -4026,6 +4103,10 @@ NFRAMES and BASE specify the activation frame to use, as in `backtrace-frame'.
4026 case SPECPDL_UNWIND_EXCURSION: 4103 case SPECPDL_UNWIND_EXCURSION:
4027 case SPECPDL_UNWIND_VOID: 4104 case SPECPDL_UNWIND_VOID:
4028 case SPECPDL_BACKTRACE: 4105 case SPECPDL_BACKTRACE:
4106#ifdef HAVE_MODULES
4107 case SPECPDL_MODULE_RUNTIME:
4108 case SPECPDL_MODULE_ENVIRONMENT:
4109#endif
4029 break; 4110 break;
4030 4111
4031 default: 4112 default:
@@ -4072,6 +4153,14 @@ mark_specpdl (union specbinding *first, union specbinding *ptr)
4072 } 4153 }
4073 break; 4154 break;
4074 4155
4156#ifdef HAVE_MODULES
4157 case SPECPDL_MODULE_RUNTIME:
4158 break;
4159 case SPECPDL_MODULE_ENVIRONMENT:
4160 mark_module_environment (pdl->unwind_ptr.arg);
4161 break;
4162#endif
4163
4075 case SPECPDL_LET_DEFAULT: 4164 case SPECPDL_LET_DEFAULT:
4076 case SPECPDL_LET_LOCAL: 4165 case SPECPDL_LET_LOCAL:
4077 mark_object (specpdl_where (pdl)); 4166 mark_object (specpdl_where (pdl));
diff --git a/src/font.c b/src/font.c
index 8dbf8cb8999..5f9db2ebb8c 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3945,6 +3945,23 @@ VALUE must be a non-negative integer or a floating point number
3945specifying the font size. It specifies the font size in pixels (if 3945specifying the font size. It specifies the font size in pixels (if
3946VALUE is an integer), or in points (if VALUE is a float). 3946VALUE is an integer), or in points (if VALUE is a float).
3947 3947
3948`:dpi'
3949
3950VALUE must be a non-negative number that specifies the resolution
3951(dot per inch) for which the font is designed.
3952
3953`:spacing'
3954
3955VALUE specifies the spacing of the font: mono, proportional, charcell,
3956or dual. It can be either a number (0 for proportional, 90 for dual,
3957100 for mono, 110 for charcell) or a 1-letter symbol: `P', `D', `M',
3958or `C' (lower-case variants are also accepted).
3959
3960`:avgwidth'
3961
3962VALUE must be a non-negative integer specifying the average width of
3963the font in 1/10 pixel units.
3964
3948`:name' 3965`:name'
3949 3966
3950VALUE must be a string of XLFD-style or fontconfig-style font name. 3967VALUE must be a string of XLFD-style or fontconfig-style font name.
diff --git a/src/frame.c b/src/frame.c
index 512aaf5f45c..17ec455d2d6 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1426,11 +1426,15 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
1426 if (FRAMEP (gfocus)) 1426 if (FRAMEP (gfocus))
1427 { 1427 {
1428 focus = FRAME_FOCUS_FRAME (XFRAME (gfocus)); 1428 focus = FRAME_FOCUS_FRAME (XFRAME (gfocus));
1429 if ((FRAMEP (focus) && XFRAME (focus) == SELECTED_FRAME ()) 1429 if (FRAMEP (focus) && XFRAME (focus) == SELECTED_FRAME ())
1430 /* Redirect frame focus also when FRAME has its minibuffer 1430 /* Redirect frame focus also when FRAME has its minibuffer
1431 window on the selected frame (see Bug#24500). */ 1431 window on the selected frame (see Bug#24500).
1432
1433 Don't do that: It causes redirection problem with a
1434 separate minibuffer frame (Bug#24803) and problems
1435 when updating the cursor on such frames.
1432 || (NILP (focus) 1436 || (NILP (focus)
1433 && EQ (FRAME_MINIBUF_WINDOW (f), sf->selected_window))) 1437 && EQ (FRAME_MINIBUF_WINDOW (f), sf->selected_window))) */
1434 Fredirect_frame_focus (gfocus, frame); 1438 Fredirect_frame_focus (gfocus, frame);
1435 } 1439 }
1436 } 1440 }
@@ -3630,7 +3634,11 @@ DEFUN ("frame-position", Fframe_position,
3630FRAME must be a live frame and defaults to the selected one. The return 3634FRAME must be a live frame and defaults to the selected one. The return
3631value is a cons (x, y) of the coordinates of the top left corner of 3635value is a cons (x, y) of the coordinates of the top left corner of
3632FRAME's outer frame, in pixels relative to an origin (0, 0) of FRAME's 3636FRAME's outer frame, in pixels relative to an origin (0, 0) of FRAME's
3633display. */) 3637display.
3638
3639Note that the values returned are not guaranteed to be accurate: The
3640values depend on the underlying window system, and some systems add a
3641constant offset to the values. */)
3634 (Lisp_Object frame) 3642 (Lisp_Object frame)
3635{ 3643{
3636 register struct frame *f = decode_live_frame (frame); 3644 register struct frame *f = decode_live_frame (frame);
diff --git a/src/lisp.h b/src/lisp.h
index b956f39d787..79de5d9eb77 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3141,9 +3141,13 @@ enum specbind_tag {
3141 SPECPDL_UNWIND_PTR, /* Likewise, on void *. */ 3141 SPECPDL_UNWIND_PTR, /* Likewise, on void *. */
3142 SPECPDL_UNWIND_INT, /* Likewise, on int. */ 3142 SPECPDL_UNWIND_INT, /* Likewise, on int. */
3143 SPECPDL_UNWIND_INTMAX, /* Likewise, on intmax_t. */ 3143 SPECPDL_UNWIND_INTMAX, /* Likewise, on intmax_t. */
3144 SPECPDL_UNWIND_EXCURSION, /* Likewise, on an execursion. */ 3144 SPECPDL_UNWIND_EXCURSION, /* Likewise, on an excursion. */
3145 SPECPDL_UNWIND_VOID, /* Likewise, with no arg. */ 3145 SPECPDL_UNWIND_VOID, /* Likewise, with no arg. */
3146 SPECPDL_BACKTRACE, /* An element of the backtrace. */ 3146 SPECPDL_BACKTRACE, /* An element of the backtrace. */
3147#ifdef HAVE_MODULES
3148 SPECPDL_MODULE_RUNTIME, /* A live module runtime. */
3149 SPECPDL_MODULE_ENVIRONMENT, /* A live module environment. */
3150#endif
3147 SPECPDL_LET, /* A plain and simple dynamic let-binding. */ 3151 SPECPDL_LET, /* A plain and simple dynamic let-binding. */
3148 /* Tags greater than SPECPDL_LET must be "subkinds" of LET. */ 3152 /* Tags greater than SPECPDL_LET must be "subkinds" of LET. */
3149 SPECPDL_LET_LOCAL, /* A buffer-local let-binding. */ 3153 SPECPDL_LET_LOCAL, /* A buffer-local let-binding. */
@@ -4166,6 +4170,7 @@ extern void record_unwind_protect_intmax (void (*) (intmax_t), intmax_t);
4166extern void record_unwind_protect_void (void (*) (void)); 4170extern void record_unwind_protect_void (void (*) (void));
4167extern void record_unwind_protect_excursion (void); 4171extern void record_unwind_protect_excursion (void);
4168extern void record_unwind_protect_nothing (void); 4172extern void record_unwind_protect_nothing (void);
4173extern void record_unwind_protect_module (enum specbind_tag, void *);
4169extern void clear_unwind_protect (ptrdiff_t); 4174extern void clear_unwind_protect (ptrdiff_t);
4170extern void set_unwind_protect (ptrdiff_t, void (*) (Lisp_Object), Lisp_Object); 4175extern void set_unwind_protect (ptrdiff_t, void (*) (Lisp_Object), Lisp_Object);
4171extern void set_unwind_protect_ptr (ptrdiff_t, void (*) (void *), void *); 4176extern void set_unwind_protect_ptr (ptrdiff_t, void (*) (void *), void *);
@@ -4236,7 +4241,9 @@ extern module_funcptr module_function_address
4236 (struct Lisp_Module_Function const *); 4241 (struct Lisp_Module_Function const *);
4237extern void *module_function_data (const struct Lisp_Module_Function *); 4242extern void *module_function_data (const struct Lisp_Module_Function *);
4238extern void module_finalize_function (const struct Lisp_Module_Function *); 4243extern void module_finalize_function (const struct Lisp_Module_Function *);
4239extern void mark_modules (void); 4244extern void mark_module_environment (void *);
4245extern void finalize_runtime_unwind (void *);
4246extern void finalize_environment_unwind (void *);
4240extern void init_module_assertions (bool); 4247extern void init_module_assertions (bool);
4241extern void syms_of_module (void); 4248extern void syms_of_module (void);
4242#endif 4249#endif
diff --git a/src/minibuf.c b/src/minibuf.c
index 464e3018f7d..fc3fd92a880 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -508,7 +508,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
508 mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window)); 508 mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window));
509 if (!EQ (mini_frame, selected_frame)) 509 if (!EQ (mini_frame, selected_frame))
510 record_unwind_protect (restore_window_configuration, 510 record_unwind_protect (restore_window_configuration,
511 Fcons (Qt, 511 Fcons (/* Arrange for the frame later to be
512 switched back to the calling
513 frame. */
514 Qnil,
512 Fcurrent_window_configuration (mini_frame))); 515 Fcurrent_window_configuration (mini_frame)));
513 516
514 /* If the minibuffer is on an iconified or invisible frame, 517 /* If the minibuffer is on an iconified or invisible frame,
diff --git a/src/nsterm.m b/src/nsterm.m
index a9280eb4af9..0729c961bdf 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7282,7 +7282,7 @@ not_in_argv (NSString *arg)
7282 old_title = t; 7282 old_title = t;
7283 } 7283 }
7284 size_title = xmalloc (strlen (old_title) + 40); 7284 size_title = xmalloc (strlen (old_title) + 40);
7285 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows); 7285 esprintf (size_title, "%s — (%d × %d)", old_title, cols, rows);
7286 [window setTitle: [NSString stringWithUTF8String: size_title]]; 7286 [window setTitle: [NSString stringWithUTF8String: size_title]];
7287 [window display]; 7287 [window display];
7288 xfree (size_title); 7288 xfree (size_title);
diff --git a/src/pdumper.c b/src/pdumper.c
index e0f8f5577ed..1a7aee6343a 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2709,7 +2709,7 @@ dump_hash_table (struct dump_context *ctx,
2709static dump_off 2709static dump_off
2710dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) 2710dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
2711{ 2711{
2712#if CHECK_STRUCTS && !defined HASH_buffer_5DC36DBD42 2712#if CHECK_STRUCTS && !defined HASH_buffer_EE36B4292E
2713# error "buffer changed. See CHECK_STRUCTS comment in config.h." 2713# error "buffer changed. See CHECK_STRUCTS comment in config.h."
2714#endif 2714#endif
2715 struct buffer munged_buffer = *in_buffer; 2715 struct buffer munged_buffer = *in_buffer;
diff --git a/src/search.c b/src/search.c
index e7f90949464..4eb634a3c03 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3031,6 +3031,23 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */)
3031 return Qnil; 3031 return Qnil;
3032} 3032}
3033 3033
3034DEFUN ("match-data--translate", Fmatch_data__translate, Smatch_data__translate,
3035 1, 1, 0,
3036 doc: /* Add N to all string positions in the match data. Internal. */)
3037 (Lisp_Object n)
3038{
3039 CHECK_FIXNUM (n);
3040 EMACS_INT delta = XFIXNUM (n);
3041 if (EQ (last_thing_searched, Qt)) /* String match data only. */
3042 for (ptrdiff_t i = 0; i < search_regs.num_regs; i++)
3043 if (search_regs.start[i] >= 0)
3044 {
3045 search_regs.start[i] = max (0, search_regs.start[i] + delta);
3046 search_regs.end[i] = max (0, search_regs.end[i] + delta);
3047 }
3048 return Qnil;
3049}
3050
3034/* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data 3051/* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data
3035 if asynchronous code (filter or sentinel) is running. */ 3052 if asynchronous code (filter or sentinel) is running. */
3036static void 3053static void
@@ -3388,6 +3405,7 @@ is to bind it with `let' around a small expression. */);
3388 defsubr (&Smatch_end); 3405 defsubr (&Smatch_end);
3389 defsubr (&Smatch_data); 3406 defsubr (&Smatch_data);
3390 defsubr (&Sset_match_data); 3407 defsubr (&Sset_match_data);
3408 defsubr (&Smatch_data__translate);
3391 defsubr (&Sregexp_quote); 3409 defsubr (&Sregexp_quote);
3392 defsubr (&Snewline_cache_check); 3410 defsubr (&Snewline_cache_check);
3393 3411
diff --git a/src/w32fns.c b/src/w32fns.c
index 7bb96891d05..a840f0e1227 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4448,7 +4448,10 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
4448 int size, i; 4448 int size, i;
4449 W32Msg wmsg; 4449 W32Msg wmsg;
4450 HIMC context = get_ime_context_fn (hwnd); 4450 HIMC context = get_ime_context_fn (hwnd);
4451 wmsg.dwModifiers = w32_get_key_modifiers (wParam, lParam); 4451 wmsg.dwModifiers =
4452 w32_ignore_modifiers_on_IME_input
4453 ? 0
4454 : w32_get_key_modifiers (wParam, lParam);
4452 /* Get buffer size. */ 4455 /* Get buffer size. */
4453 size = get_composition_string_fn (context, GCS_RESULTSTR, NULL, 0); 4456 size = get_composition_string_fn (context, GCS_RESULTSTR, NULL, 0);
4454 buffer = alloca (size); 4457 buffer = alloca (size);
@@ -10614,6 +10617,15 @@ tip frame. */);
10614 doc: /* Non-nil means don't display the abort dialog when aborting. */); 10617 doc: /* Non-nil means don't display the abort dialog when aborting. */);
10615 w32_disable_abort_dialog = 0; 10618 w32_disable_abort_dialog = 0;
10616 10619
10620 DEFVAR_BOOL ("w32-ignore-modifiers-on-IME-input",
10621 w32_ignore_modifiers_on_IME_input,
10622 doc: /* Whether to ignore modifier keys when processing input with IME.
10623Some MS-Windows input methods use modifier keys such as Ctrl or Alt to input
10624characters, in which case applying the modifiers will change the input.
10625The default value of this variable is therefore t, to ignore modifier
10626keys when IME input is received. */);
10627 w32_ignore_modifiers_on_IME_input = true;
10628
10617#if 0 /* TODO: Port to W32 */ 10629#if 0 /* TODO: Port to W32 */
10618 defsubr (&Sx_change_window_property); 10630 defsubr (&Sx_change_window_property);
10619 defsubr (&Sx_delete_window_property); 10631 defsubr (&Sx_delete_window_property);
diff --git a/src/xdisp.c b/src/xdisp.c
index e49cc433308..76ef420a364 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1796,6 +1796,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1796 from a display vector, we need to consume all of 1796 from a display vector, we need to consume all of
1797 the glyphs from that display vector. */ 1797 the glyphs from that display vector. */
1798 start_display (&it2, w, top); 1798 start_display (&it2, w, top);
1799 it2.glyph_row = NULL;
1799 move_it_to (&it2, charpos - 1, -1, -1, -1, MOVE_TO_POS); 1800 move_it_to (&it2, charpos - 1, -1, -1, -1, MOVE_TO_POS);
1800 /* If we didn't get to CHARPOS - 1, there's some 1801 /* If we didn't get to CHARPOS - 1, there's some
1801 replacing display property at that position, and 1802 replacing display property at that position, and
@@ -1919,6 +1920,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1919 of the display line where the display string 1920 of the display line where the display string
1920 begins. */ 1921 begins. */
1921 start_display (&it3, w, top); 1922 start_display (&it3, w, top);
1923 it3.glyph_row = NULL;
1922 move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y); 1924 move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y);
1923 /* If it3_moved stays false after the 'while' loop 1925 /* If it3_moved stays false after the 'while' loop
1924 below, that means we already were at a newline 1926 below, that means we already were at a newline