aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano2021-02-20 18:00:36 +0900
committerYuuki Harano2021-02-20 18:00:36 +0900
commitbe2e47362b0f933dbc8e300e3d168296b7e2aac4 (patch)
tree3b14e2e66d33566b81cb1d6e8bb04551d95dd2b9 /src
parent949d3e50ec4ea7723bf14b93b66ad0b72f96f163 (diff)
parentc85c8e7d42ae2a5fc95fa7b14257389d8383b34d (diff)
downloademacs-be2e47362b0f933dbc8e300e3d168296b7e2aac4.tar.gz
emacs-be2e47362b0f933dbc8e300e3d168296b7e2aac4.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c14
-rw-r--r--src/buffer.h3
-rw-r--r--src/callint.c9
-rw-r--r--src/callproc.c6
-rw-r--r--src/data.c87
-rw-r--r--src/dispnew.c2
-rw-r--r--src/emacs-module.c8
-rw-r--r--src/eval.c41
-rw-r--r--src/filelock.c2
-rw-r--r--src/fns.c33
-rw-r--r--src/font.c2
-rw-r--r--src/frame.c20
-rw-r--r--src/frame.h10
-rw-r--r--src/image.c13
-rw-r--r--src/indent.c2
-rw-r--r--src/json.c77
-rw-r--r--src/lisp.h4
-rw-r--r--src/lread.c3
-rw-r--r--src/minibuf.c115
-rw-r--r--src/nsfns.m25
-rw-r--r--src/nsterm.h1
-rw-r--r--src/nsterm.m63
-rw-r--r--src/pdumper.c3
-rw-r--r--src/process.c2
-rw-r--r--src/w32.c51
-rw-r--r--src/w32fns.c32
-rw-r--r--src/window.h4
-rw-r--r--src/xdisp.c16
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c43
30 files changed, 526 insertions, 167 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 80c799e719b..5bd9b37702f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -292,6 +292,11 @@ bset_major_mode (struct buffer *b, Lisp_Object val)
292 b->major_mode_ = val; 292 b->major_mode_ = val;
293} 293}
294static void 294static void
295bset_local_minor_modes (struct buffer *b, Lisp_Object val)
296{
297 b->local_minor_modes_ = val;
298}
299static void
295bset_mark (struct buffer *b, Lisp_Object val) 300bset_mark (struct buffer *b, Lisp_Object val)
296{ 301{
297 b->mark_ = val; 302 b->mark_ = val;
@@ -893,6 +898,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
893 bset_file_truename (b, Qnil); 898 bset_file_truename (b, Qnil);
894 bset_display_count (b, make_fixnum (0)); 899 bset_display_count (b, make_fixnum (0));
895 bset_backed_up (b, Qnil); 900 bset_backed_up (b, Qnil);
901 bset_local_minor_modes (b, Qnil);
896 bset_auto_save_file_name (b, Qnil); 902 bset_auto_save_file_name (b, Qnil);
897 set_buffer_internal_1 (b); 903 set_buffer_internal_1 (b);
898 Fset (intern ("buffer-save-without-query"), Qnil); 904 Fset (intern ("buffer-save-without-query"), Qnil);
@@ -967,6 +973,7 @@ reset_buffer (register struct buffer *b)
967 b->clip_changed = 0; 973 b->clip_changed = 0;
968 b->prevent_redisplay_optimizations_p = 1; 974 b->prevent_redisplay_optimizations_p = 1;
969 bset_backed_up (b, Qnil); 975 bset_backed_up (b, Qnil);
976 bset_local_minor_modes (b, Qnil);
970 BUF_AUTOSAVE_MODIFF (b) = 0; 977 BUF_AUTOSAVE_MODIFF (b) = 0;
971 b->auto_save_failure_time = 0; 978 b->auto_save_failure_time = 0;
972 bset_auto_save_file_name (b, Qnil); 979 bset_auto_save_file_name (b, Qnil);
@@ -5151,6 +5158,7 @@ init_buffer_once (void)
5151 bset_auto_save_file_name (&buffer_local_flags, make_fixnum (-1)); 5158 bset_auto_save_file_name (&buffer_local_flags, make_fixnum (-1));
5152 bset_read_only (&buffer_local_flags, make_fixnum (-1)); 5159 bset_read_only (&buffer_local_flags, make_fixnum (-1));
5153 bset_major_mode (&buffer_local_flags, make_fixnum (-1)); 5160 bset_major_mode (&buffer_local_flags, make_fixnum (-1));
5161 bset_local_minor_modes (&buffer_local_flags, make_fixnum (-1));
5154 bset_mode_name (&buffer_local_flags, make_fixnum (-1)); 5162 bset_mode_name (&buffer_local_flags, make_fixnum (-1));
5155 bset_undo_list (&buffer_local_flags, make_fixnum (-1)); 5163 bset_undo_list (&buffer_local_flags, make_fixnum (-1));
5156 bset_mark_active (&buffer_local_flags, make_fixnum (-1)); 5164 bset_mark_active (&buffer_local_flags, make_fixnum (-1));
@@ -5617,6 +5625,12 @@ The default value (normally `fundamental-mode') affects new buffers.
5617A value of nil means to use the current buffer's major mode, provided 5625A value of nil means to use the current buffer's major mode, provided
5618it is not marked as "special". */); 5626it is not marked as "special". */);
5619 5627
5628 DEFVAR_PER_BUFFER ("local-minor-modes",
5629 &BVAR (current_buffer, local_minor_modes),
5630 Qnil,
5631 doc: /* Minor modes currently active in the current buffer.
5632This is a list of symbols, or nil if there are no minor modes active. */);
5633
5620 DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name), 5634 DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name),
5621 Qnil, 5635 Qnil,
5622 doc: /* Pretty name of current buffer's major mode. 5636 doc: /* Pretty name of current buffer's major mode.
diff --git a/src/buffer.h b/src/buffer.h
index 790291f1185..24e9c3fcbc8 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -338,6 +338,9 @@ struct buffer
338 /* Symbol naming major mode (e.g., lisp-mode). */ 338 /* Symbol naming major mode (e.g., lisp-mode). */
339 Lisp_Object major_mode_; 339 Lisp_Object major_mode_;
340 340
341 /* Symbol listing all currently enabled minor modes. */
342 Lisp_Object local_minor_modes_;
343
341 /* Pretty name of major mode (e.g., "Lisp"). */ 344 /* Pretty name of major mode (e.g., "Lisp"). */
342 Lisp_Object mode_name_; 345 Lisp_Object mode_name_;
343 346
diff --git a/src/callint.c b/src/callint.c
index d3f49bc35d1..18624637843 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -104,7 +104,14 @@ If the string begins with `^' and `shift-select-mode' is non-nil,
104 Emacs first calls the function `handle-shift-selection'. 104 Emacs first calls the function `handle-shift-selection'.
105You may use `@', `*', and `^' together. They are processed in the 105You may use `@', `*', and `^' together. They are processed in the
106 order that they appear, before reading any arguments. 106 order that they appear, before reading any arguments.
107usage: (interactive &optional ARG-DESCRIPTOR) */ 107
108If MODES is present, it should be a list of mode names (symbols) that
109this command is applicable for. The main effect of this is that
110`M-x TAB' (by default) won't list this command if the current buffer's
111mode doesn't match the list. That is, if either the major mode isn't
112derived from them, or (when it's a minor mode) the mode isn't in effect.
113
114usage: (interactive &optional ARG-DESCRIPTOR &rest MODES) */
108 attributes: const) 115 attributes: const)
109 (Lisp_Object args) 116 (Lisp_Object args)
110{ 117{
diff --git a/src/callproc.c b/src/callproc.c
index cb72b070b7b..cd0f67fe29b 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -411,7 +411,11 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
411 /* If the buffer is (still) a list, it might be a (:file "file") spec. */ 411 /* If the buffer is (still) a list, it might be a (:file "file") spec. */
412 if (CONSP (buffer) && EQ (XCAR (buffer), QCfile)) 412 if (CONSP (buffer) && EQ (XCAR (buffer), QCfile))
413 { 413 {
414 output_file = Fexpand_file_name (XCAR (XCDR (buffer)), 414 Lisp_Object ofile = XCDR (buffer);
415 if (CONSP (ofile))
416 ofile = XCAR (ofile);
417 CHECK_STRING (ofile);
418 output_file = Fexpand_file_name (ofile,
415 BVAR (current_buffer, directory)); 419 BVAR (current_buffer, directory));
416 CHECK_STRING (output_file); 420 CHECK_STRING (output_file);
417 buffer = Qnil; 421 buffer = Qnil;
diff --git a/src/data.c b/src/data.c
index 38cde0ff8b2..ace859d2d0c 100644
--- a/src/data.c
+++ b/src/data.c
@@ -904,7 +904,17 @@ Value, if non-nil, is a list (interactive SPEC). */)
904 else if (COMPILEDP (fun)) 904 else if (COMPILEDP (fun))
905 { 905 {
906 if (PVSIZE (fun) > COMPILED_INTERACTIVE) 906 if (PVSIZE (fun) > COMPILED_INTERACTIVE)
907 return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); 907 {
908 Lisp_Object form = AREF (fun, COMPILED_INTERACTIVE);
909 if (VECTORP (form))
910 /* The vector form is the new form, where the first
911 element is the interactive spec, and the second is the
912 command modes. */
913 return list2 (Qinteractive, AREF (form, 0));
914 else
915 /* Old form -- just the interactive spec. */
916 return list2 (Qinteractive, form);
917 }
908 } 918 }
909#ifdef HAVE_MODULES 919#ifdef HAVE_MODULES
910 else if (MODULE_FUNCTIONP (fun)) 920 else if (MODULE_FUNCTIONP (fun))
@@ -920,10 +930,75 @@ Value, if non-nil, is a list (interactive SPEC). */)
920 else if (CONSP (fun)) 930 else if (CONSP (fun))
921 { 931 {
922 Lisp_Object funcar = XCAR (fun); 932 Lisp_Object funcar = XCAR (fun);
923 if (EQ (funcar, Qclosure)) 933 if (EQ (funcar, Qclosure)
924 return Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun)))); 934 || EQ (funcar, Qlambda))
925 else if (EQ (funcar, Qlambda)) 935 {
926 return Fassq (Qinteractive, Fcdr (XCDR (fun))); 936 Lisp_Object form = Fcdr (XCDR (fun));
937 if (EQ (funcar, Qclosure))
938 form = Fcdr (form);
939 Lisp_Object spec = Fassq (Qinteractive, form);
940 if (NILP (Fcdr (Fcdr (spec))))
941 return spec;
942 else
943 return list2 (Qinteractive, Fcar (Fcdr (spec)));
944 }
945 }
946 return Qnil;
947}
948
949DEFUN ("command-modes", Fcommand_modes, Scommand_modes, 1, 1, 0,
950 doc: /* Return the modes COMMAND is defined for.
951If COMMAND is not a command, the return value is nil.
952The value, if non-nil, is a list of mode name symbols. */)
953 (Lisp_Object command)
954{
955 Lisp_Object fun = indirect_function (command); /* Check cycles. */
956
957 if (NILP (fun))
958 return Qnil;
959
960 fun = command;
961 while (SYMBOLP (fun))
962 fun = Fsymbol_function (fun);
963
964 if (COMPILEDP (fun))
965 {
966 Lisp_Object form = AREF (fun, COMPILED_INTERACTIVE);
967 if (VECTORP (form))
968 /* New form -- the second element is the command modes. */
969 return AREF (form, 1);
970 else
971 /* Old .elc file -- no command modes. */
972 return Qnil;
973 }
974#ifdef HAVE_MODULES
975 else if (MODULE_FUNCTIONP (fun))
976 {
977 Lisp_Object form
978 = module_function_command_modes (XMODULE_FUNCTION (fun));
979 if (! NILP (form))
980 return form;
981 }
982#endif
983 else if (AUTOLOADP (fun))
984 {
985 Lisp_Object modes = Fnth (make_int (3), fun);
986 if (CONSP (modes))
987 return modes;
988 else
989 return Qnil;
990 }
991 else if (CONSP (fun))
992 {
993 Lisp_Object funcar = XCAR (fun);
994 if (EQ (funcar, Qclosure)
995 || EQ (funcar, Qlambda))
996 {
997 Lisp_Object form = Fcdr (XCDR (fun));
998 if (EQ (funcar, Qclosure))
999 form = Fcdr (form);
1000 return Fcdr (Fcdr (Fassq (Qinteractive, form)));
1001 }
927 } 1002 }
928 return Qnil; 1003 return Qnil;
929} 1004}
@@ -3908,6 +3983,7 @@ syms_of_data (void)
3908 3983
3909 defsubr (&Sindirect_variable); 3984 defsubr (&Sindirect_variable);
3910 defsubr (&Sinteractive_form); 3985 defsubr (&Sinteractive_form);
3986 defsubr (&Scommand_modes);
3911 defsubr (&Seq); 3987 defsubr (&Seq);
3912 defsubr (&Snull); 3988 defsubr (&Snull);
3913 defsubr (&Stype_of); 3989 defsubr (&Stype_of);
@@ -4030,6 +4106,7 @@ This variable cannot be set; trying to do so will signal an error. */);
4030 DEFSYM (Qunlet, "unlet"); 4106 DEFSYM (Qunlet, "unlet");
4031 DEFSYM (Qset, "set"); 4107 DEFSYM (Qset, "set");
4032 DEFSYM (Qset_default, "set-default"); 4108 DEFSYM (Qset_default, "set-default");
4109 DEFSYM (Qcommand_modes, "command-modes");
4033 defsubr (&Sadd_variable_watcher); 4110 defsubr (&Sadd_variable_watcher);
4034 defsubr (&Sremove_variable_watcher); 4111 defsubr (&Sremove_variable_watcher);
4035 defsubr (&Sget_variable_watchers); 4112 defsubr (&Sget_variable_watchers);
diff --git a/src/dispnew.c b/src/dispnew.c
index 55667fa124d..0b64ea6f769 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3328,7 +3328,7 @@ update_frame_with_menu (struct frame *f, int row, int col)
3328} 3328}
3329 3329
3330/* Update the mouse position for a frame F. This handles both 3330/* Update the mouse position for a frame F. This handles both
3331 updating the display for mouse-face propreties and updating the 3331 updating the display for mouse-face properties and updating the
3332 help echo text. 3332 help echo text.
3333 3333
3334 Returns the number of events generated. */ 3334 Returns the number of events generated. */
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 894dffcf21e..f8fb54c0728 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -549,7 +549,7 @@ struct Lisp_Module_Function
549 union vectorlike_header header; 549 union vectorlike_header header;
550 550
551 /* Fields traced by GC; these must come first. */ 551 /* Fields traced by GC; these must come first. */
552 Lisp_Object documentation, interactive_form; 552 Lisp_Object documentation, interactive_form, command_modes;
553 553
554 /* Fields ignored by GC. */ 554 /* Fields ignored by GC. */
555 ptrdiff_t min_arity, max_arity; 555 ptrdiff_t min_arity, max_arity;
@@ -646,6 +646,12 @@ module_function_interactive_form (const struct Lisp_Module_Function *fun)
646 return fun->interactive_form; 646 return fun->interactive_form;
647} 647}
648 648
649Lisp_Object
650module_function_command_modes (const struct Lisp_Module_Function *fun)
651{
652 return fun->command_modes;
653}
654
649static emacs_value 655static emacs_value
650module_funcall (emacs_env *env, emacs_value func, ptrdiff_t nargs, 656module_funcall (emacs_env *env, emacs_value func, ptrdiff_t nargs,
651 emacs_value *args) 657 emacs_value *args)
diff --git a/src/eval.c b/src/eval.c
index 3aff3b56d52..542d7f686e6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1165,21 +1165,23 @@ usage: (catch TAG BODY...) */)
1165 FUNC should return a Lisp_Object. 1165 FUNC should return a Lisp_Object.
1166 This is how catches are done from within C code. */ 1166 This is how catches are done from within C code. */
1167 1167
1168/* MINIBUFFER_QUIT_LEVEL is to handle quitting from nested minibuffers by
1169 throwing t to tag `exit'.
1170 0 means there is no (throw 'exit t) in progress, or it wasn't from
1171 a minibuffer which isn't the most nested;
1172 N > 0 means the `throw' was done from the minibuffer at level N which
1173 wasn't the most nested. */
1174EMACS_INT minibuffer_quit_level = 0;
1175
1168Lisp_Object 1176Lisp_Object
1169internal_catch (Lisp_Object tag, 1177internal_catch (Lisp_Object tag,
1170 Lisp_Object (*func) (Lisp_Object), Lisp_Object arg) 1178 Lisp_Object (*func) (Lisp_Object), Lisp_Object arg)
1171{ 1179{
1172 /* MINIBUFFER_QUIT_LEVEL is to handle quitting from nested minibuffers by
1173 throwing t to tag `exit'.
1174 Value -1 means there is no (throw 'exit t) in progress;
1175 0 means the `throw' wasn't done from an active minibuffer;
1176 N > 0 means the `throw' was done from the minibuffer at level N. */
1177 static EMACS_INT minibuffer_quit_level = -1;
1178 /* This structure is made part of the chain `catchlist'. */ 1180 /* This structure is made part of the chain `catchlist'. */
1179 struct handler *c = push_handler (tag, CATCHER); 1181 struct handler *c = push_handler (tag, CATCHER);
1180 1182
1181 if (EQ (tag, Qexit)) 1183 if (EQ (tag, Qexit))
1182 minibuffer_quit_level = -1; 1184 minibuffer_quit_level = 0;
1183 1185
1184 /* Call FUNC. */ 1186 /* Call FUNC. */
1185 if (! sys_setjmp (c->jmp)) 1187 if (! sys_setjmp (c->jmp))
@@ -1194,22 +1196,16 @@ internal_catch (Lisp_Object tag,
1194 Lisp_Object val = handlerlist->val; 1196 Lisp_Object val = handlerlist->val;
1195 clobbered_eassert (handlerlist == c); 1197 clobbered_eassert (handlerlist == c);
1196 handlerlist = handlerlist->next; 1198 handlerlist = handlerlist->next;
1197 if (EQ (tag, Qexit) && EQ (val, Qt)) 1199 if (EQ (tag, Qexit) && EQ (val, Qt) && minibuffer_quit_level > 0)
1198 /* If we've thrown t to tag `exit' from within a minibuffer, we 1200 /* If we've thrown t to tag `exit' from within a minibuffer, we
1199 exit all minibuffers more deeply nested than the current 1201 exit all minibuffers more deeply nested than the current
1200 one. */ 1202 one. */
1201 { 1203 {
1202 EMACS_INT mini_depth = this_minibuffer_depth (Qnil); 1204 if (minibuf_level > minibuffer_quit_level
1203 if (mini_depth && mini_depth != minibuffer_quit_level) 1205 && !NILP (Fminibuffer_innermost_command_loop_p (Qnil)))
1204 { 1206 Fthrow (Qexit, Qt);
1205 if (minibuffer_quit_level == -1)
1206 minibuffer_quit_level = mini_depth;
1207 if (minibuffer_quit_level
1208 && (minibuf_level > minibuffer_quit_level))
1209 Fthrow (Qexit, Qt);
1210 }
1211 else 1207 else
1212 minibuffer_quit_level = -1; 1208 minibuffer_quit_level = 0;
1213 } 1209 }
1214 return val; 1210 return val;
1215 } 1211 }
@@ -2084,14 +2080,21 @@ then strings and vectors are not accepted. */)
2084DEFUN ("autoload", Fautoload, Sautoload, 2, 5, 0, 2080DEFUN ("autoload", Fautoload, Sautoload, 2, 5, 0,
2085 doc: /* Define FUNCTION to autoload from FILE. 2081 doc: /* Define FUNCTION to autoload from FILE.
2086FUNCTION is a symbol; FILE is a file name string to pass to `load'. 2082FUNCTION is a symbol; FILE is a file name string to pass to `load'.
2083
2087Third arg DOCSTRING is documentation for the function. 2084Third arg DOCSTRING is documentation for the function.
2088Fourth arg INTERACTIVE if non-nil says function can be called interactively. 2085
2086Fourth arg INTERACTIVE if non-nil says function can be called
2087interactively. If INTERACTIVE is a list, it is interpreted as a list
2088of modes the function is applicable for.
2089
2089Fifth arg TYPE indicates the type of the object: 2090Fifth arg TYPE indicates the type of the object:
2090 nil or omitted says FUNCTION is a function, 2091 nil or omitted says FUNCTION is a function,
2091 `keymap' says FUNCTION is really a keymap, and 2092 `keymap' says FUNCTION is really a keymap, and
2092 `macro' or t says FUNCTION is really a macro. 2093 `macro' or t says FUNCTION is really a macro.
2094
2093Third through fifth args give info about the real definition. 2095Third through fifth args give info about the real definition.
2094They default to nil. 2096They default to nil.
2097
2095If FUNCTION is already defined other than as an autoload, 2098If FUNCTION is already defined other than as an autoload,
2096this does nothing and returns nil. */) 2099this does nothing and returns nil. */)
2097 (Lisp_Object function, Lisp_Object file, Lisp_Object docstring, Lisp_Object interactive, Lisp_Object type) 2100 (Lisp_Object function, Lisp_Object file, Lisp_Object docstring, Lisp_Object interactive, Lisp_Object type)
diff --git a/src/filelock.c b/src/filelock.c
index 35baa0c6668..373fc00a42c 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -532,7 +532,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
532 /* If nonexistent lock file, all is well; otherwise, got strange error. */ 532 /* If nonexistent lock file, all is well; otherwise, got strange error. */
533 lfinfolen = read_lock_data (lfname, owner->user); 533 lfinfolen = read_lock_data (lfname, owner->user);
534 if (lfinfolen < 0) 534 if (lfinfolen < 0)
535 return errno == ENOENT ? 0 : errno; 535 return errno == ENOENT || errno == ENOTDIR ? 0 : errno;
536 if (MAX_LFINFO < lfinfolen) 536 if (MAX_LFINFO < lfinfolen)
537 return ENAMETOOLONG; 537 return ENAMETOOLONG;
538 owner->user[lfinfolen] = 0; 538 owner->user[lfinfolen] = 0;
diff --git a/src/fns.c b/src/fns.c
index bd4afa0c4e9..c16f9c63998 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5758,6 +5758,38 @@ in OBJECT. */)
5758 traverse_intervals (intervals, 0, collect_interval, collector); 5758 traverse_intervals (intervals, 0, collect_interval, collector);
5759 return CDR (collector); 5759 return CDR (collector);
5760} 5760}
5761
5762DEFUN ("line-number-at-pos", Fline_number_at_pos,
5763 Sline_number_at_pos, 0, 2, 0,
5764 doc: /* Return the line number at POSITION.
5765If POSITION is nil, use the current buffer location.
5766
5767If the buffer is narrowed, the position returned is the position in the
5768visible part of the buffer. If ABSOLUTE is non-nil, count the lines
5769from the absolute start of the buffer. */)
5770 (register Lisp_Object position, Lisp_Object absolute)
5771{
5772 ptrdiff_t pos, start = BEGV_BYTE;
5773
5774 if (MARKERP (position))
5775 pos = marker_position (position);
5776 else if (NILP (position))
5777 pos = PT;
5778 else
5779 {
5780 CHECK_FIXNUM (position);
5781 pos = XFIXNUM (position);
5782 }
5783
5784 if (!NILP (absolute))
5785 start = BEG_BYTE;
5786
5787 /* Check that POSITION is n the visible range of the buffer. */
5788 if (pos < BEGV || pos > ZV)
5789 args_out_of_range (make_int (start), make_int (ZV));
5790
5791 return make_int (count_lines (start, CHAR_TO_BYTE (pos)) + 1);
5792}
5761 5793
5762 5794
5763void 5795void
@@ -5800,6 +5832,7 @@ syms_of_fns (void)
5800 defsubr (&Sdefine_hash_table_test); 5832 defsubr (&Sdefine_hash_table_test);
5801 defsubr (&Sstring_search); 5833 defsubr (&Sstring_search);
5802 defsubr (&Sobject_intervals); 5834 defsubr (&Sobject_intervals);
5835 defsubr (&Sline_number_at_pos);
5803 5836
5804 /* Crypto and hashing stuff. */ 5837 /* Crypto and hashing stuff. */
5805 DEFSYM (Qiv_auto, "iv-auto"); 5838 DEFSYM (Qiv_auto, "iv-auto");
diff --git a/src/font.c b/src/font.c
index ce3f4c67a99..cdf35b03702 100644
--- a/src/font.c
+++ b/src/font.c
@@ -4122,7 +4122,7 @@ representing the OpenType features supported by the font by this form:
4122SCRIPT, LANGSYS, and FEATURE are all symbols representing OpenType 4122SCRIPT, LANGSYS, and FEATURE are all symbols representing OpenType
4123Layout tags. 4123Layout tags.
4124 4124
4125In addition to the keys listed abobe, the following keys are reserved 4125In addition to the keys listed above, the following keys are reserved
4126for the specific meanings as below: 4126for the specific meanings as below:
4127 4127
4128The value of :combining-capability is non-nil if the font-backend of 4128The value of :combining-capability is non-nil if the font-backend of
diff --git a/src/frame.c b/src/frame.c
index a3e44c75eeb..c1ab34470b2 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -900,6 +900,7 @@ make_frame (bool mini_p)
900 f->no_accept_focus = false; 900 f->no_accept_focus = false;
901 f->z_group = z_group_none; 901 f->z_group = z_group_none;
902 f->tooltip = false; 902 f->tooltip = false;
903 f->child_frame_border_width = -1;
903 f->last_tab_bar_item = -1; 904 f->last_tab_bar_item = -1;
904#ifndef HAVE_EXT_TOOL_BAR 905#ifndef HAVE_EXT_TOOL_BAR
905 f->last_tool_bar_item = -1; 906 f->last_tool_bar_item = -1;
@@ -3547,10 +3548,17 @@ DEFUN ("frame-fringe-width", Ffringe_width, Sfringe_width, 0, 1, 0,
3547} 3548}
3548 3549
3549DEFUN ("frame-child-frame-border-width", Fframe_child_frame_border_width, Sframe_child_frame_border_width, 0, 1, 0, 3550DEFUN ("frame-child-frame-border-width", Fframe_child_frame_border_width, Sframe_child_frame_border_width, 0, 1, 0,
3550 doc: /* Return width of FRAME's child-frame border in pixels. */) 3551 doc: /* Return width of FRAME's child-frame border in pixels.
3552 If FRAME's 'child-frame-border-width' parameter is nil, return FRAME's
3553 internal border width instead. */)
3551 (Lisp_Object frame) 3554 (Lisp_Object frame)
3552{ 3555{
3553 return make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame))); 3556 int width = FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame));
3557
3558 if (width < 0)
3559 return make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (decode_any_frame (frame)));
3560 else
3561 return make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame)));
3554} 3562}
3555 3563
3556DEFUN ("frame-internal-border-width", Fframe_internal_border_width, Sframe_internal_border_width, 0, 1, 0, 3564DEFUN ("frame-internal-border-width", Fframe_internal_border_width, Sframe_internal_border_width, 0, 1, 0,
@@ -3885,7 +3893,7 @@ frame_float (struct frame *f, Lisp_Object val, enum frame_float_type what,
3885 Lisp_Object frame; 3893 Lisp_Object frame;
3886 3894
3887 XSETFRAME (frame, f); 3895 XSETFRAME (frame, f);
3888 monitor_attributes = Fcar (call1 (Qdisplay_monitor_attributes_list, frame)); 3896 monitor_attributes = call1 (Qframe_monitor_attributes, frame);
3889 if (NILP (monitor_attributes)) 3897 if (NILP (monitor_attributes))
3890 { 3898 {
3891 /* No monitor attributes available. */ 3899 /* No monitor attributes available. */
@@ -4314,7 +4322,9 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr)
4314 store_in_alist (alistptr, Qborder_width, 4322 store_in_alist (alistptr, Qborder_width,
4315 make_fixnum (f->border_width)); 4323 make_fixnum (f->border_width));
4316 store_in_alist (alistptr, Qchild_frame_border_width, 4324 store_in_alist (alistptr, Qchild_frame_border_width,
4317 make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (f))); 4325 FRAME_CHILD_FRAME_BORDER_WIDTH (f) >= 0
4326 ? make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (f))
4327 : Qnil);
4318 store_in_alist (alistptr, Qinternal_border_width, 4328 store_in_alist (alistptr, Qinternal_border_width,
4319 make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f))); 4329 make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f)));
4320 store_in_alist (alistptr, Qright_divider_width, 4330 store_in_alist (alistptr, Qright_divider_width,
@@ -5894,7 +5904,7 @@ syms_of_frame (void)
5894 DEFSYM (Qframep, "framep"); 5904 DEFSYM (Qframep, "framep");
5895 DEFSYM (Qframe_live_p, "frame-live-p"); 5905 DEFSYM (Qframe_live_p, "frame-live-p");
5896 DEFSYM (Qframe_windows_min_size, "frame-windows-min-size"); 5906 DEFSYM (Qframe_windows_min_size, "frame-windows-min-size");
5897 DEFSYM (Qdisplay_monitor_attributes_list, "display-monitor-attributes-list"); 5907 DEFSYM (Qframe_monitor_attributes, "frame-monitor-attributes");
5898 DEFSYM (Qwindow__pixel_to_total, "window--pixel-to-total"); 5908 DEFSYM (Qwindow__pixel_to_total, "window--pixel-to-total");
5899 DEFSYM (Qexplicit_name, "explicit-name"); 5909 DEFSYM (Qexplicit_name, "explicit-name");
5900 DEFSYM (Qheight, "height"); 5910 DEFSYM (Qheight, "height");
diff --git a/src/frame.h b/src/frame.h
index 47ee6a832fb..bb05448cffb 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1458,11 +1458,11 @@ INLINE int
1458FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) 1458FRAME_INTERNAL_BORDER_WIDTH (struct frame *f)
1459{ 1459{
1460#ifdef HAVE_WINDOW_SYSTEM 1460#ifdef HAVE_WINDOW_SYSTEM
1461 return FRAME_PARENT_FRAME(f) 1461 return (FRAME_PARENT_FRAME(f)
1462 ? (f->child_frame_border_width 1462 ? (FRAME_CHILD_FRAME_BORDER_WIDTH(f) >= 0
1463 ? FRAME_CHILD_FRAME_BORDER_WIDTH(f) 1463 ? FRAME_CHILD_FRAME_BORDER_WIDTH(f)
1464 : frame_dimension (f->internal_border_width)) 1464 : frame_dimension (f->internal_border_width))
1465 : frame_dimension (f->internal_border_width); 1465 : frame_dimension (f->internal_border_width));
1466#else 1466#else
1467 return frame_dimension (f->internal_border_width); 1467 return frame_dimension (f->internal_border_width);
1468#endif 1468#endif
diff --git a/src/image.c b/src/image.c
index 09370fa833d..62bca41f899 100644
--- a/src/image.c
+++ b/src/image.c
@@ -150,6 +150,12 @@ typedef struct pgtk_bitmap_record Bitmap_Record;
150# define COLOR_TABLE_SUPPORT 1 150# define COLOR_TABLE_SUPPORT 1
151#endif 151#endif
152 152
153#if defined HAVE_NS
154# define FRAME_SCALE_FACTOR(f) ns_frame_scale_factor (f)
155#else
156# define FRAME_SCALE_FACTOR(f) 1;
157#endif
158
153static void image_disable_image (struct frame *, struct image *); 159static void image_disable_image (struct frame *, struct image *);
154static void image_edge_detection (struct frame *, struct image *, Lisp_Object, 160static void image_edge_detection (struct frame *, struct image *, Lisp_Object,
155 Lisp_Object); 161 Lisp_Object);
@@ -2330,8 +2336,8 @@ image_set_transform (struct frame *f, struct image *img)
2330 /* SVGs are pre-scaled to the correct size. */ 2336 /* SVGs are pre-scaled to the correct size. */
2331 if (EQ (image_spec_value (img->spec, QCtype, NULL), Qsvg)) 2337 if (EQ (image_spec_value (img->spec, QCtype, NULL), Qsvg))
2332 { 2338 {
2333 width = img->width; 2339 width = img->width / FRAME_SCALE_FACTOR (f);
2334 height = img->height; 2340 height = img->height / FRAME_SCALE_FACTOR (f);
2335 } 2341 }
2336 else 2342 else
2337#endif 2343#endif
@@ -10148,6 +10154,9 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
10148 compute_image_size (viewbox_width, viewbox_height, img->spec, 10154 compute_image_size (viewbox_width, viewbox_height, img->spec,
10149 &width, &height); 10155 &width, &height);
10150 10156
10157 width *= FRAME_SCALE_FACTOR (f);
10158 height *= FRAME_SCALE_FACTOR (f);
10159
10151 if (! check_image_size (f, width, height)) 10160 if (! check_image_size (f, width, height))
10152 { 10161 {
10153 image_size_error (); 10162 image_size_error ();
diff --git a/src/indent.c b/src/indent.c
index 0a6b460f753..6246b544fbd 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1315,7 +1315,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos,
1315 j ^---- next after the point 1315 j ^---- next after the point
1316 ^--- next char. after the point. 1316 ^--- next char. after the point.
1317 ---------- 1317 ----------
1318 In case of sigle-column character 1318 In case of single-column character
1319 1319
1320 ---------- 1320 ----------
1321 abcdefgh\\ 1321 abcdefgh\\
diff --git a/src/json.c b/src/json.c
index 2901a20811a..3f1d27ad7fb 100644
--- a/src/json.c
+++ b/src/json.c
@@ -327,13 +327,14 @@ struct json_configuration {
327 Lisp_Object false_object; 327 Lisp_Object false_object;
328}; 328};
329 329
330static json_t *lisp_to_json (Lisp_Object, struct json_configuration *conf); 330static json_t *lisp_to_json (Lisp_Object,
331 const struct json_configuration *conf);
331 332
332/* Convert a Lisp object to a toplevel JSON object (array or object). */ 333/* Convert a Lisp object to a nonscalar JSON object (array or object). */
333 334
334static json_t * 335static json_t *
335lisp_to_json_toplevel_1 (Lisp_Object lisp, 336lisp_to_json_nonscalar_1 (Lisp_Object lisp,
336 struct json_configuration *conf) 337 const struct json_configuration *conf)
337{ 338{
338 json_t *json; 339 json_t *json;
339 ptrdiff_t count; 340 ptrdiff_t count;
@@ -448,16 +449,17 @@ lisp_to_json_toplevel_1 (Lisp_Object lisp,
448 return json; 449 return json;
449} 450}
450 451
451/* Convert LISP to a toplevel JSON object (array or object). Signal 452/* Convert LISP to a nonscalar JSON object (array or object). Signal
452 an error of type `wrong-type-argument' if LISP is not a vector, 453 an error of type `wrong-type-argument' if LISP is not a vector,
453 hashtable, alist, or plist. */ 454 hashtable, alist, or plist. */
454 455
455static json_t * 456static json_t *
456lisp_to_json_toplevel (Lisp_Object lisp, struct json_configuration *conf) 457lisp_to_json_nonscalar (Lisp_Object lisp,
458 const struct json_configuration *conf)
457{ 459{
458 if (++lisp_eval_depth > max_lisp_eval_depth) 460 if (++lisp_eval_depth > max_lisp_eval_depth)
459 xsignal0 (Qjson_object_too_deep); 461 xsignal0 (Qjson_object_too_deep);
460 json_t *json = lisp_to_json_toplevel_1 (lisp, conf); 462 json_t *json = lisp_to_json_nonscalar_1 (lisp, conf);
461 --lisp_eval_depth; 463 --lisp_eval_depth;
462 return json; 464 return json;
463} 465}
@@ -467,7 +469,7 @@ lisp_to_json_toplevel (Lisp_Object lisp, struct json_configuration *conf)
467 JSON object. */ 469 JSON object. */
468 470
469static json_t * 471static json_t *
470lisp_to_json (Lisp_Object lisp, struct json_configuration *conf) 472lisp_to_json (Lisp_Object lisp, const struct json_configuration *conf)
471{ 473{
472 if (EQ (lisp, conf->null_object)) 474 if (EQ (lisp, conf->null_object))
473 return json_check (json_null ()); 475 return json_check (json_null ());
@@ -499,7 +501,7 @@ lisp_to_json (Lisp_Object lisp, struct json_configuration *conf)
499 } 501 }
500 502
501 /* LISP now must be a vector, hashtable, alist, or plist. */ 503 /* LISP now must be a vector, hashtable, alist, or plist. */
502 return lisp_to_json_toplevel (lisp, conf); 504 return lisp_to_json_nonscalar (lisp, conf);
503} 505}
504 506
505static void 507static void
@@ -557,15 +559,15 @@ DEFUN ("json-serialize", Fjson_serialize, Sjson_serialize, 1, MANY,
557 NULL, 559 NULL,
558 doc: /* Return the JSON representation of OBJECT as a string. 560 doc: /* Return the JSON representation of OBJECT as a string.
559 561
560OBJECT must be a vector, hashtable, alist, or plist and its elements 562OBJECT must be t, a number, string, vector, hashtable, alist, plist,
561can recursively contain the Lisp equivalents to the JSON null and 563or the Lisp equivalents to the JSON null and false values, and its
562false values, t, numbers, strings, or other vectors hashtables, alists 564elements must recursively consist of the same kinds of values. t will
563or plists. t will be converted to the JSON true value. Vectors will 565be converted to the JSON true value. Vectors will be converted to
564be converted to JSON arrays, whereas hashtables, alists and plists are 566JSON arrays, whereas hashtables, alists and plists are converted to
565converted to JSON objects. Hashtable keys must be strings without 567JSON objects. Hashtable keys must be strings without embedded null
566embedded null characters and must be unique within each object. Alist 568characters and must be unique within each object. Alist and plist
567and plist keys must be symbols; if a key is duplicate, the first 569keys must be symbols; if a key is duplicate, the first instance is
568instance is used. 570used.
569 571
570The Lisp equivalents to the JSON null and false values are 572The Lisp equivalents to the JSON null and false values are
571configurable in the arguments ARGS, a list of keyword/argument pairs: 573configurable in the arguments ARGS, a list of keyword/argument pairs:
@@ -603,12 +605,10 @@ usage: (json-serialize OBJECT &rest ARGS) */)
603 {json_object_hashtable, json_array_array, QCnull, QCfalse}; 605 {json_object_hashtable, json_array_array, QCnull, QCfalse};
604 json_parse_args (nargs - 1, args + 1, &conf, false); 606 json_parse_args (nargs - 1, args + 1, &conf, false);
605 607
606 json_t *json = lisp_to_json_toplevel (args[0], &conf); 608 json_t *json = lisp_to_json (args[0], &conf);
607 record_unwind_protect_ptr (json_release_object, json); 609 record_unwind_protect_ptr (json_release_object, json);
608 610
609 /* If desired, we might want to add the following flags: 611 char *string = json_dumps (json, JSON_COMPACT | JSON_ENCODE_ANY);
610 JSON_DECODE_ANY, JSON_ALLOW_NUL. */
611 char *string = json_dumps (json, JSON_COMPACT);
612 if (string == NULL) 612 if (string == NULL)
613 json_out_of_memory (); 613 json_out_of_memory ();
614 record_unwind_protect_ptr (json_free, string); 614 record_unwind_protect_ptr (json_free, string);
@@ -723,12 +723,10 @@ usage: (json-insert OBJECT &rest ARGS) */)
723 move_gap_both (PT, PT_BYTE); 723 move_gap_both (PT, PT_BYTE);
724 struct json_insert_data data; 724 struct json_insert_data data;
725 data.inserted_bytes = 0; 725 data.inserted_bytes = 0;
726 /* If desired, we might want to add the following flags: 726 /* Could have used json_dumpb, but that became available only in
727 JSON_DECODE_ANY, JSON_ALLOW_NUL. */ 727 Jansson 2.10, whereas we want to support 2.7 and upward. */
728 int status 728 int status = json_dump_callback (json, json_insert_callback, &data,
729 /* Could have used json_dumpb, but that became available only in 729 JSON_COMPACT | JSON_ENCODE_ANY);
730 Jansson 2.10, whereas we want to support 2.7 and upward. */
731 = json_dump_callback (json, json_insert_callback, &data, JSON_COMPACT);
732 if (status == -1) 730 if (status == -1)
733 { 731 {
734 if (CONSP (data.error)) 732 if (CONSP (data.error))
@@ -791,7 +789,7 @@ usage: (json-insert OBJECT &rest ARGS) */)
791/* Convert a JSON object to a Lisp object. */ 789/* Convert a JSON object to a Lisp object. */
792 790
793static Lisp_Object ARG_NONNULL ((1)) 791static Lisp_Object ARG_NONNULL ((1))
794json_to_lisp (json_t *json, struct json_configuration *conf) 792json_to_lisp (json_t *json, const struct json_configuration *conf)
795{ 793{
796 switch (json_typeof (json)) 794 switch (json_typeof (json))
797 { 795 {
@@ -932,12 +930,12 @@ DEFUN ("json-parse-string", Fjson_parse_string, Sjson_parse_string, 1, MANY,
932 NULL, 930 NULL,
933 doc: /* Parse the JSON STRING into a Lisp object. 931 doc: /* Parse the JSON STRING into a Lisp object.
934This is essentially the reverse operation of `json-serialize', which 932This is essentially the reverse operation of `json-serialize', which
935see. The returned object will be a vector, list, hashtable, alist, or 933see. The returned object will be the JSON null value, the JSON false
936plist. Its elements will be the JSON null value, the JSON false 934value, t, a number, a string, a vector, a list, a hashtable, an alist,
937value, t, numbers, strings, or further vectors, hashtables, alists, or 935or a plist. Its elements will be further objects of these types. If
938plists. If there are duplicate keys in an object, all but the last 936there are duplicate keys in an object, all but the last one are
939one are ignored. If STRING doesn't contain a valid JSON object, this 937ignored. If STRING doesn't contain a valid JSON object, this function
940function signals an error of type `json-parse-error'. 938signals an error of type `json-parse-error'.
941 939
942The arguments ARGS are a list of keyword/argument pairs: 940The arguments ARGS are a list of keyword/argument pairs:
943 941
@@ -982,7 +980,8 @@ usage: (json-parse-string STRING &rest ARGS) */)
982 json_parse_args (nargs - 1, args + 1, &conf, true); 980 json_parse_args (nargs - 1, args + 1, &conf, true);
983 981
984 json_error_t error; 982 json_error_t error;
985 json_t *object = json_loads (SSDATA (encoded), 0, &error); 983 json_t *object
984 = json_loads (SSDATA (encoded), JSON_DECODE_ANY, &error);
986 if (object == NULL) 985 if (object == NULL)
987 json_parse_error (&error); 986 json_parse_error (&error);
988 987
@@ -1078,8 +1077,10 @@ usage: (json-parse-buffer &rest args) */)
1078 ptrdiff_t point = PT_BYTE; 1077 ptrdiff_t point = PT_BYTE;
1079 struct json_read_buffer_data data = {.point = point}; 1078 struct json_read_buffer_data data = {.point = point};
1080 json_error_t error; 1079 json_error_t error;
1081 json_t *object = json_load_callback (json_read_buffer_callback, &data, 1080 json_t *object
1082 JSON_DISABLE_EOF_CHECK, &error); 1081 = json_load_callback (json_read_buffer_callback, &data,
1082 JSON_DECODE_ANY | JSON_DISABLE_EOF_CHECK,
1083 &error);
1083 1084
1084 if (object == NULL) 1085 if (object == NULL)
1085 json_parse_error (&error); 1086 json_parse_error (&error);
diff --git a/src/lisp.h b/src/lisp.h
index 409a1e70608..b95f389b890 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4091,6 +4091,7 @@ intern_c_string (const char *str)
4091} 4091}
4092 4092
4093/* Defined in eval.c. */ 4093/* Defined in eval.c. */
4094extern EMACS_INT minibuffer_quit_level;
4094extern Lisp_Object Vautoload_queue; 4095extern Lisp_Object Vautoload_queue;
4095extern Lisp_Object Vrun_hooks; 4096extern Lisp_Object Vrun_hooks;
4096extern Lisp_Object Vsignaling_function; 4097extern Lisp_Object Vsignaling_function;
@@ -4220,6 +4221,8 @@ extern Lisp_Object module_function_documentation
4220 (struct Lisp_Module_Function const *); 4221 (struct Lisp_Module_Function const *);
4221extern Lisp_Object module_function_interactive_form 4222extern Lisp_Object module_function_interactive_form
4222 (const struct Lisp_Module_Function *); 4223 (const struct Lisp_Module_Function *);
4224extern Lisp_Object module_function_command_modes
4225 (const struct Lisp_Module_Function *);
4223extern module_funcptr module_function_address 4226extern module_funcptr module_function_address
4224 (struct Lisp_Module_Function const *); 4227 (struct Lisp_Module_Function const *);
4225extern void *module_function_data (const struct Lisp_Module_Function *); 4228extern void *module_function_data (const struct Lisp_Module_Function *);
@@ -4369,6 +4372,7 @@ extern void syms_of_casetab (void);
4369 4372
4370/* Defined in keyboard.c. */ 4373/* Defined in keyboard.c. */
4371 4374
4375extern EMACS_INT command_loop_level;
4372extern Lisp_Object echo_message_buffer; 4376extern Lisp_Object echo_message_buffer;
4373extern struct kboard *echo_kboard; 4377extern struct kboard *echo_kboard;
4374extern void cancel_echoing (void); 4378extern void cancel_echoing (void);
diff --git a/src/lread.c b/src/lread.c
index 010194c34ea..dea1b232fff 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4833,7 +4833,8 @@ to find all the symbols in an obarray, use `mapatoms'. */);
4833 4833
4834 DEFVAR_LISP ("values", Vvalues, 4834 DEFVAR_LISP ("values", Vvalues,
4835 doc: /* List of values of all expressions which were read, evaluated and printed. 4835 doc: /* List of values of all expressions which were read, evaluated and printed.
4836Order is reverse chronological. */); 4836Order is reverse chronological.
4837This variable is obsolete as of Emacs 28.1 and should not be used. */);
4837 XSYMBOL (intern ("values"))->u.s.declared_special = false; 4838 XSYMBOL (intern ("values"))->u.s.declared_special = false;
4838 4839
4839 DEFVAR_LISP ("standard-input", Vstandard_input, 4840 DEFVAR_LISP ("standard-input", Vstandard_input,
diff --git a/src/minibuf.c b/src/minibuf.c
index 949c3d989d5..4b1f4b1ff72 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -41,6 +41,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
41 minibuffer recursions are encountered. */ 41 minibuffer recursions are encountered. */
42 42
43Lisp_Object Vminibuffer_list; 43Lisp_Object Vminibuffer_list;
44Lisp_Object Vcommand_loop_level_list;
44 45
45/* Data to remember during recursive minibuffer invocations. */ 46/* Data to remember during recursive minibuffer invocations. */
46 47
@@ -64,6 +65,8 @@ static Lisp_Object minibuf_prompt;
64static ptrdiff_t minibuf_prompt_width; 65static ptrdiff_t minibuf_prompt_width;
65 66
66static Lisp_Object nth_minibuffer (EMACS_INT depth); 67static Lisp_Object nth_minibuffer (EMACS_INT depth);
68static EMACS_INT minibuf_c_loop_level (EMACS_INT depth);
69static void set_minibuffer_mode (Lisp_Object buf, EMACS_INT depth);
67 70
68 71
69/* Return TRUE when a frame switch causes a minibuffer on the old 72/* Return TRUE when a frame switch causes a minibuffer on the old
@@ -181,7 +184,12 @@ void move_minibuffer_onto_frame (void)
181 set_window_buffer (sf->minibuffer_window, nth_minibuffer (i), 0, 0); 184 set_window_buffer (sf->minibuffer_window, nth_minibuffer (i), 0, 0);
182 minibuf_window = sf->minibuffer_window; 185 minibuf_window = sf->minibuffer_window;
183 if (of != sf) 186 if (of != sf)
184 set_window_buffer (of->minibuffer_window, get_minibuffer (0), 0, 0); 187 {
188 Lisp_Object temp = get_minibuffer (0);
189
190 set_window_buffer (of->minibuffer_window, temp, 0, 0);
191 set_minibuffer_mode (temp, 0);
192 }
185 } 193 }
186} 194}
187 195
@@ -389,6 +397,21 @@ No argument or nil as argument means use the current buffer as BUFFER. */)
389 : Qnil; 397 : Qnil;
390} 398}
391 399
400DEFUN ("minibuffer-innermost-command-loop-p", Fminibuffer_innermost_command_loop_p,
401 Sminibuffer_innermost_command_loop_p, 0, 1, 0,
402 doc: /* Return t if BUFFER is a minibuffer at the current command loop level.
403No argument or nil as argument means use the current buffer as BUFFER. */)
404 (Lisp_Object buffer)
405{
406 EMACS_INT depth;
407 if (NILP (buffer))
408 buffer = Fcurrent_buffer ();
409 depth = this_minibuffer_depth (buffer);
410 return depth && minibuf_c_loop_level (depth) == command_loop_level
411 ? Qt
412 : Qnil;
413}
414
392/* Return the nesting depth of the active minibuffer BUFFER, or 0 if 415/* Return the nesting depth of the active minibuffer BUFFER, or 0 if
393 BUFFER isn't such a thing. If BUFFER is nil, this means use the current 416 BUFFER isn't such a thing. If BUFFER is nil, this means use the current
394 buffer. */ 417 buffer. */
@@ -420,12 +443,17 @@ confirm the aborting of the current minibuffer and all contained ones. */)
420 443
421 if (!minibuf_depth) 444 if (!minibuf_depth)
422 error ("Not in a minibuffer"); 445 error ("Not in a minibuffer");
446 if (NILP (Fminibuffer_innermost_command_loop_p (Qnil)))
447 error ("Not in most nested command loop");
423 if (minibuf_depth < minibuf_level) 448 if (minibuf_depth < minibuf_level)
424 { 449 {
425 array[0] = fmt; 450 array[0] = fmt;
426 array[1] = make_fixnum (minibuf_level - minibuf_depth + 1); 451 array[1] = make_fixnum (minibuf_level - minibuf_depth + 1);
427 if (!NILP (Fyes_or_no_p (Fformat (2, array)))) 452 if (!NILP (Fyes_or_no_p (Fformat (2, array))))
428 Fthrow (Qexit, Qt); 453 {
454 minibuffer_quit_level = minibuf_depth;
455 Fthrow (Qexit, Qt);
456 }
429 } 457 }
430 else 458 else
431 Fthrow (Qexit, Qt); 459 Fthrow (Qexit, Qt);
@@ -508,6 +536,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
508 ptrdiff_t count = SPECPDL_INDEX (); 536 ptrdiff_t count = SPECPDL_INDEX ();
509 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; 537 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
510 Lisp_Object calling_frame = selected_frame; 538 Lisp_Object calling_frame = selected_frame;
539 Lisp_Object calling_window = selected_window;
511 Lisp_Object enable_multibyte; 540 Lisp_Object enable_multibyte;
512 EMACS_INT pos = 0; 541 EMACS_INT pos = 0;
513 /* String to add to the history. */ 542 /* String to add to the history. */
@@ -598,7 +627,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
598 627
599 if (minibuf_level > 1 628 if (minibuf_level > 1
600 && minibuf_moves_frame_when_opened () 629 && minibuf_moves_frame_when_opened ()
601 && !minibuf_follows_frame ()) 630 && (!minibuf_follows_frame ()
631 || (!EQ (mini_frame, selected_frame))))
602 { 632 {
603 EMACS_INT i; 633 EMACS_INT i;
604 634
@@ -607,8 +637,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
607 set_window_buffer (minibuf_window, nth_minibuffer (i), 0, 0); 637 set_window_buffer (minibuf_window, nth_minibuffer (i), 0, 0);
608 } 638 }
609 639
610 record_unwind_protect_void (choose_minibuf_frame);
611
612 record_unwind_protect (restore_window_configuration, 640 record_unwind_protect (restore_window_configuration,
613 Fcons (Qt, Fcurrent_window_configuration (Qnil))); 641 Fcons (Qt, Fcurrent_window_configuration (Qnil)));
614 642
@@ -640,7 +668,9 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
640 minibuf_save_list 668 minibuf_save_list
641 = Fcons (Voverriding_local_map, 669 = Fcons (Voverriding_local_map,
642 Fcons (minibuf_window, 670 Fcons (minibuf_window,
643 minibuf_save_list)); 671 Fcons (calling_frame,
672 Fcons (calling_window,
673 minibuf_save_list))));
644 minibuf_save_list 674 minibuf_save_list
645 = Fcons (minibuf_prompt, 675 = Fcons (minibuf_prompt,
646 Fcons (make_fixnum (minibuf_prompt_width), 676 Fcons (make_fixnum (minibuf_prompt_width),
@@ -694,6 +724,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
694 /* Switch to the minibuffer. */ 724 /* Switch to the minibuffer. */
695 725
696 minibuffer = get_minibuffer (minibuf_level); 726 minibuffer = get_minibuffer (minibuf_level);
727 set_minibuffer_mode (minibuffer, minibuf_level);
697 Fset_buffer (minibuffer); 728 Fset_buffer (minibuffer);
698 729
699 /* Defeat (setq-default truncate-lines t), since truncated lines do 730 /* Defeat (setq-default truncate-lines t), since truncated lines do
@@ -738,6 +769,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
738 where there is an active minibuffer. 769 where there is an active minibuffer.
739 Set them to point to ` *Minibuf-0*', which is always empty. */ 770 Set them to point to ` *Minibuf-0*', which is always empty. */
740 empty_minibuf = get_minibuffer (0); 771 empty_minibuf = get_minibuffer (0);
772 set_minibuffer_mode (empty_minibuf, 0);
741 773
742 FOR_EACH_FRAME (dummy, frame) 774 FOR_EACH_FRAME (dummy, frame)
743 { 775 {
@@ -837,20 +869,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
837 869
838 recursive_edit_1 (); 870 recursive_edit_1 ();
839 871
840 /* We've exited the recursive edit without an error, so switch the
841 current window away from the expired minibuffer window. */
842 {
843 Lisp_Object prev = Fprevious_window (minibuf_window, Qnil, Qnil);
844 /* PREV can be on a different frame when we have a minibuffer only
845 frame, the other frame's minibuffer window is MINIBUF_WINDOW,
846 and its "focus window" is also MINIBUF_WINDOW. */
847 while (!EQ (prev, minibuf_window)
848 && !EQ (selected_frame, WINDOW_FRAME (XWINDOW (prev))))
849 prev = Fprevious_window (prev, Qnil, Qnil);
850 if (!EQ (prev, minibuf_window))
851 Fset_frame_selected_window (selected_frame, prev, Qnil);
852 }
853
854 /* If cursor is on the minibuffer line, 872 /* If cursor is on the minibuffer line,
855 show the user we have exited by putting it in column 0. */ 873 show the user we have exited by putting it in column 0. */
856 if (XWINDOW (minibuf_window)->cursor.vpos >= 0 874 if (XWINDOW (minibuf_window)->cursor.vpos >= 0
@@ -959,11 +977,16 @@ Lisp_Object
959get_minibuffer (EMACS_INT depth) 977get_minibuffer (EMACS_INT depth)
960{ 978{
961 Lisp_Object tail = Fnthcdr (make_fixnum (depth), Vminibuffer_list); 979 Lisp_Object tail = Fnthcdr (make_fixnum (depth), Vminibuffer_list);
980 Lisp_Object cll_tail = Fnthcdr (make_fixnum (depth),
981 Vcommand_loop_level_list);
962 if (NILP (tail)) 982 if (NILP (tail))
963 { 983 {
964 tail = list1 (Qnil); 984 tail = list1 (Qnil);
965 Vminibuffer_list = nconc2 (Vminibuffer_list, tail); 985 Vminibuffer_list = nconc2 (Vminibuffer_list, tail);
986 cll_tail = list1 (Qnil);
987 Vcommand_loop_level_list = nconc2 (Vcommand_loop_level_list, cll_tail);
966 } 988 }
989 XSETCAR (cll_tail, make_fixnum (depth ? command_loop_level : 0));
967 Lisp_Object buf = Fcar (tail); 990 Lisp_Object buf = Fcar (tail);
968 if (NILP (buf) || !BUFFER_LIVE_P (XBUFFER (buf))) 991 if (NILP (buf) || !BUFFER_LIVE_P (XBUFFER (buf)))
969 { 992 {
@@ -973,7 +996,6 @@ get_minibuffer (EMACS_INT depth)
973 buf = Fget_buffer_create (lname, Qnil); 996 buf = Fget_buffer_create (lname, Qnil);
974 /* Do this before set_minibuffer_mode. */ 997 /* Do this before set_minibuffer_mode. */
975 XSETCAR (tail, buf); 998 XSETCAR (tail, buf);
976 set_minibuffer_mode (buf, depth);
977 /* Although the buffer's name starts with a space, undo should be 999 /* Although the buffer's name starts with a space, undo should be
978 enabled in it. */ 1000 enabled in it. */
979 Fbuffer_enable_undo (buf); 1001 Fbuffer_enable_undo (buf);
@@ -985,12 +1007,19 @@ get_minibuffer (EMACS_INT depth)
985 while the buffer doesn't know about them any more. */ 1007 while the buffer doesn't know about them any more. */
986 delete_all_overlays (XBUFFER (buf)); 1008 delete_all_overlays (XBUFFER (buf));
987 reset_buffer (XBUFFER (buf)); 1009 reset_buffer (XBUFFER (buf));
988 set_minibuffer_mode (buf, depth);
989 } 1010 }
990 1011
991 return buf; 1012 return buf;
992} 1013}
993 1014
1015static EMACS_INT minibuf_c_loop_level (EMACS_INT depth)
1016{
1017 Lisp_Object cll = Fnth (make_fixnum (depth), Vcommand_loop_level_list);
1018 if (FIXNUMP (cll))
1019 return XFIXNUM (cll);
1020 return 0;
1021}
1022
994static void 1023static void
995run_exit_minibuf_hook (void) 1024run_exit_minibuf_hook (void)
996{ 1025{
@@ -1004,17 +1033,16 @@ static void
1004read_minibuf_unwind (void) 1033read_minibuf_unwind (void)
1005{ 1034{
1006 Lisp_Object old_deactivate_mark; 1035 Lisp_Object old_deactivate_mark;
1007 Lisp_Object window; 1036 Lisp_Object calling_frame;
1037 Lisp_Object calling_window;
1008 Lisp_Object future_mini_window; 1038 Lisp_Object future_mini_window;
1009 1039
1010 /* If this was a recursive minibuffer,
1011 tie the minibuffer window back to the outer level minibuffer buffer. */
1012 minibuf_level--;
1013
1014 window = minibuf_window;
1015 /* To keep things predictable, in case it matters, let's be in the 1040 /* To keep things predictable, in case it matters, let's be in the
1016 minibuffer when we reset the relevant variables. */ 1041 minibuffer when we reset the relevant variables. Don't depend on
1017 Fset_buffer (XWINDOW (window)->contents); 1042 `minibuf_window' here. This could by now be the mini-window of any
1043 frame. */
1044 Fset_buffer (nth_minibuffer (minibuf_level));
1045 minibuf_level--;
1018 1046
1019 /* Restore prompt, etc, from outer minibuffer level. */ 1047 /* Restore prompt, etc, from outer minibuffer level. */
1020 Lisp_Object key_vec = Fcar (minibuf_save_list); 1048 Lisp_Object key_vec = Fcar (minibuf_save_list);
@@ -1042,6 +1070,10 @@ read_minibuf_unwind (void)
1042#endif 1070#endif
1043 future_mini_window = Fcar (minibuf_save_list); 1071 future_mini_window = Fcar (minibuf_save_list);
1044 minibuf_save_list = Fcdr (minibuf_save_list); 1072 minibuf_save_list = Fcdr (minibuf_save_list);
1073 calling_frame = Fcar (minibuf_save_list);
1074 minibuf_save_list = Fcdr (minibuf_save_list);
1075 calling_window = Fcar (minibuf_save_list);
1076 minibuf_save_list = Fcdr (minibuf_save_list);
1045 1077
1046 /* Erase the minibuffer we were using at this level. */ 1078 /* Erase the minibuffer we were using at this level. */
1047 { 1079 {
@@ -1059,7 +1091,7 @@ read_minibuf_unwind (void)
1059 mini-window back to its normal size. */ 1091 mini-window back to its normal size. */
1060 if (minibuf_level == 0 1092 if (minibuf_level == 0
1061 || !EQ (selected_frame, WINDOW_FRAME (XWINDOW (future_mini_window)))) 1093 || !EQ (selected_frame, WINDOW_FRAME (XWINDOW (future_mini_window))))
1062 resize_mini_window (XWINDOW (window), 0); 1094 resize_mini_window (XWINDOW (minibuf_window), 0);
1063 1095
1064 /* Deal with frames that should be removed when exiting the 1096 /* Deal with frames that should be removed when exiting the
1065 minibuffer. */ 1097 minibuffer. */
@@ -1090,6 +1122,24 @@ read_minibuf_unwind (void)
1090 to make sure we don't leave around bindings and stuff which only 1122 to make sure we don't leave around bindings and stuff which only
1091 made sense during the read_minibuf invocation. */ 1123 made sense during the read_minibuf invocation. */
1092 call0 (intern ("minibuffer-inactive-mode")); 1124 call0 (intern ("minibuffer-inactive-mode"));
1125
1126 /* We've exited the recursive edit, so switch the current windows
1127 away from the expired minibuffer window, both in the current
1128 minibuffer's frame and the original calling frame. */
1129 choose_minibuf_frame ();
1130 if (!EQ (WINDOW_FRAME (XWINDOW (minibuf_window)), calling_frame))
1131 {
1132 Lisp_Object prev = Fprevious_window (minibuf_window, Qnil, Qnil);
1133 /* PREV can be on a different frame when we have a minibuffer only
1134 frame, the other frame's minibuffer window is MINIBUF_WINDOW,
1135 and its "focus window" is also MINIBUF_WINDOW. */
1136 if (!EQ (prev, minibuf_window)
1137 && EQ (WINDOW_FRAME (XWINDOW (prev)),
1138 WINDOW_FRAME (XWINDOW (minibuf_window))))
1139 Fset_frame_selected_window (selected_frame, prev, Qnil);
1140 }
1141 else
1142 Fset_frame_selected_window (calling_frame, calling_window, Qnil);
1093} 1143}
1094 1144
1095 1145
@@ -2137,6 +2187,7 @@ void
2137init_minibuf_once (void) 2187init_minibuf_once (void)
2138{ 2188{
2139 staticpro (&Vminibuffer_list); 2189 staticpro (&Vminibuffer_list);
2190 staticpro (&Vcommand_loop_level_list);
2140 pdumper_do_now_and_after_load (init_minibuf_once_for_pdumper); 2191 pdumper_do_now_and_after_load (init_minibuf_once_for_pdumper);
2141} 2192}
2142 2193
@@ -2150,6 +2201,7 @@ init_minibuf_once_for_pdumper (void)
2150 restore from a dump file. pdumper doesn't try to preserve 2201 restore from a dump file. pdumper doesn't try to preserve
2151 frames, windows, and so on, so reset everything related here. */ 2202 frames, windows, and so on, so reset everything related here. */
2152 Vminibuffer_list = Qnil; 2203 Vminibuffer_list = Qnil;
2204 Vcommand_loop_level_list = Qnil;
2153 minibuf_level = 0; 2205 minibuf_level = 0;
2154 minibuf_prompt = Qnil; 2206 minibuf_prompt = Qnil;
2155 minibuf_save_list = Qnil; 2207 minibuf_save_list = Qnil;
@@ -2380,6 +2432,7 @@ instead. */);
2380 2432
2381 defsubr (&Sminibufferp); 2433 defsubr (&Sminibufferp);
2382 defsubr (&Sinnermost_minibuffer_p); 2434 defsubr (&Sinnermost_minibuffer_p);
2435 defsubr (&Sminibuffer_innermost_command_loop_p);
2383 defsubr (&Sabort_minibuffers); 2436 defsubr (&Sabort_minibuffers);
2384 defsubr (&Sminibuffer_prompt_end); 2437 defsubr (&Sminibuffer_prompt_end);
2385 defsubr (&Sminibuffer_contents); 2438 defsubr (&Sminibuffer_contents);
diff --git a/src/nsfns.m b/src/nsfns.m
index c7857eac731..5c4cc915e7c 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -690,17 +690,24 @@ ns_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
690static void 690static void
691ns_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 691ns_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
692{ 692{
693 int old_width = FRAME_CHILD_FRAME_BORDER_WIDTH (f); 693 int border;
694 int new_width = check_int_nonnegative (arg);
695 694
696 if (new_width == old_width) 695 if (NILP (arg))
697 return; 696 border = -1;
698 f->child_frame_border_width = new_width; 697 else if (RANGED_FIXNUMP (0, arg, INT_MAX))
698 border = XFIXNAT (arg);
699 else
700 signal_error ("Invalid child frame border width", arg);
699 701
700 if (FRAME_NATIVE_WINDOW (f) != 0) 702 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
701 adjust_frame_size (f, -1, -1, 3, 0, Qchild_frame_border_width); 703 {
704 f->child_frame_border_width = border;
702 705
703 SET_FRAME_GARBAGED (f); 706 if (FRAME_NATIVE_WINDOW (f) != 0)
707 adjust_frame_size (f, -1, -1, 3, 0, Qchild_frame_border_width);
708
709 SET_FRAME_GARBAGED (f);
710 }
704} 711}
705 712
706static void 713static void
@@ -1213,7 +1220,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1213 gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2), 1220 gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2),
1214 "internalBorderWidth", "InternalBorderWidth", 1221 "internalBorderWidth", "InternalBorderWidth",
1215 RES_TYPE_NUMBER); 1222 RES_TYPE_NUMBER);
1216 gui_default_parameter (f, parms, Qchild_frame_border_width, make_fixnum (2), 1223 gui_default_parameter (f, parms, Qchild_frame_border_width, Qnil,
1217 "childFrameBorderWidth", "childFrameBorderWidth", 1224 "childFrameBorderWidth", "childFrameBorderWidth",
1218 RES_TYPE_NUMBER); 1225 RES_TYPE_NUMBER);
1219 gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), 1226 gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
diff --git a/src/nsterm.h b/src/nsterm.h
index eae1d0725ea..017c2394ef1 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1252,6 +1252,7 @@ struct input_event;
1252extern void ns_init_events (struct input_event *); 1252extern void ns_init_events (struct input_event *);
1253extern void ns_finish_events (void); 1253extern void ns_finish_events (void);
1254 1254
1255extern double ns_frame_scale_factor (struct frame *);
1255 1256
1256#ifdef NS_IMPL_GNUSTEP 1257#ifdef NS_IMPL_GNUSTEP
1257extern char gnustep_base_version[]; /* version tracking */ 1258extern char gnustep_base_version[]; /* version tracking */
diff --git a/src/nsterm.m b/src/nsterm.m
index 1b2328628ee..6551694abee 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -857,6 +857,17 @@ ns_row_rect (struct window *w, struct glyph_row *row,
857} 857}
858 858
859 859
860double
861ns_frame_scale_factor (struct frame *f)
862{
863#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > 1060
864 return [[FRAME_NS_VIEW (f) window] backingScaleFactor];
865#else
866 return [[FRAME_NS_VIEW (f) window] userSpaceScaleFactor];
867#endif
868}
869
870
860/* ========================================================================== 871/* ==========================================================================
861 872
862 Focus (clipping) and screen update 873 Focus (clipping) and screen update
@@ -7339,6 +7350,8 @@ not_in_argv (NSString *arg)
7339 7350
7340 [surface release]; 7351 [surface release];
7341 surface = nil; 7352 surface = nil;
7353
7354 [self setNeedsDisplay:YES];
7342 } 7355 }
7343#endif 7356#endif
7344 7357
@@ -7510,6 +7523,16 @@ not_in_argv (NSString *arg)
7510 [self initWithFrame: r]; 7523 [self initWithFrame: r];
7511 [self setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; 7524 [self setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
7512 7525
7526#ifdef NS_DRAW_TO_BUFFER
7527 /* These settings mean AppKit will retain the contents of the frame
7528 on resize. Unfortunately it also means the frame will not be
7529 automatically marked for display, but we can do that ourselves in
7530 viewDidResize. */
7531 [self setLayerContentsRedrawPolicy:
7532 NSViewLayerContentsRedrawOnSetNeedsDisplay];
7533 [self setLayerContentsPlacement:NSViewLayerContentsPlacementTopLeft];
7534#endif
7535
7513 FRAME_NS_VIEW (f) = self; 7536 FRAME_NS_VIEW (f) = self;
7514 emacsframe = f; 7537 emacsframe = f;
7515#ifdef NS_IMPL_COCOA 7538#ifdef NS_IMPL_COCOA
@@ -8354,6 +8377,11 @@ not_in_argv (NSString *arg)
8354 surface = [[EmacsSurface alloc] initWithSize:s 8377 surface = [[EmacsSurface alloc] initWithSize:s
8355 ColorSpace:[[[self window] colorSpace] 8378 ColorSpace:[[[self window] colorSpace]
8356 CGColorSpace]]; 8379 CGColorSpace]];
8380
8381 /* Since we're using NSViewLayerContentsRedrawOnSetNeedsDisplay
8382 the layer's scale factor is not set automatically, so do it
8383 now. */
8384 [[self layer] setContentsScale:[[self window] backingScaleFactor]];
8357 } 8385 }
8358 8386
8359 CGContextRef context = [surface getContext]; 8387 CGContextRef context = [surface getContext];
@@ -8452,6 +8480,34 @@ not_in_argv (NSString *arg)
8452} 8480}
8453 8481
8454 8482
8483#ifdef NS_IMPL_COCOA
8484/* If the frame has been garbaged but the toolkit wants to draw, for
8485 example when resizing the frame, we end up with a blank screen.
8486 Sometimes this results in an unpleasant flicker, so try to
8487 redisplay before drawing. */
8488- (void)viewWillDraw
8489{
8490 if (FRAME_GARBAGED_P (emacsframe)
8491 && !redisplaying_p)
8492 {
8493 /* If there is IO going on when redisplay is run here Emacs
8494 crashes. I think it's because this code will always be run
8495 within the run loop and for whatever reason processing input
8496 is dangerous. This technique was stolen wholesale from
8497 nsmenu.m and seems to work. */
8498 bool owfi = waiting_for_input;
8499 waiting_for_input = 0;
8500 block_input ();
8501
8502 redisplay ();
8503
8504 unblock_input ();
8505 waiting_for_input = owfi;
8506 }
8507}
8508#endif
8509
8510
8455#ifdef NS_DRAW_TO_BUFFER 8511#ifdef NS_DRAW_TO_BUFFER
8456- (BOOL)wantsUpdateLayer 8512- (BOOL)wantsUpdateLayer
8457{ 8513{
@@ -8469,6 +8525,13 @@ not_in_argv (NSString *arg)
8469{ 8525{
8470 NSTRACE ("[EmacsView updateLayer]"); 8526 NSTRACE ("[EmacsView updateLayer]");
8471 8527
8528 /* We run redisplay on frames that are garbaged, but marked for
8529 display, before updateLayer is called so if the frame is still
8530 garbaged that means the last redisplay must have refused to
8531 update the frame. */
8532 if (FRAME_GARBAGED_P (emacsframe))
8533 return;
8534
8472 /* This can fail to update the screen if the same surface is 8535 /* This can fail to update the screen if the same surface is
8473 provided twice in a row, even if its contents have changed. 8536 provided twice in a row, even if its contents have changed.
8474 There's a private method, -[CALayer setContentsChanged], that we 8537 There's a private method, -[CALayer setContentsChanged], that we
diff --git a/src/pdumper.c b/src/pdumper.c
index c1388ebbb37..337742fda4a 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2692,7 +2692,7 @@ dump_hash_table (struct dump_context *ctx,
2692static dump_off 2692static dump_off
2693dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) 2693dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
2694{ 2694{
2695#if CHECK_STRUCTS && !defined HASH_buffer_99D642C1CB 2695#if CHECK_STRUCTS && !defined HASH_buffer_F8FE65D42F
2696# error "buffer changed. See CHECK_STRUCTS comment in config.h." 2696# error "buffer changed. See CHECK_STRUCTS comment in config.h."
2697#endif 2697#endif
2698 struct buffer munged_buffer = *in_buffer; 2698 struct buffer munged_buffer = *in_buffer;
@@ -2703,6 +2703,7 @@ dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
2703 buffer->window_count = 0; 2703 buffer->window_count = 0;
2704 else 2704 else
2705 eassert (buffer->window_count == -1); 2705 eassert (buffer->window_count == -1);
2706 buffer->local_minor_modes_ = Qnil;
2706 buffer->last_selected_window_ = Qnil; 2707 buffer->last_selected_window_ = Qnil;
2707 buffer->display_count_ = make_fixnum (0); 2708 buffer->display_count_ = make_fixnum (0);
2708 buffer->clip_changed = 0; 2709 buffer->clip_changed = 0;
diff --git a/src/process.c b/src/process.c
index 5ac0d20df5b..dbf8552ca74 100644
--- a/src/process.c
+++ b/src/process.c
@@ -8259,7 +8259,7 @@ init_process_emacs (int sockfd)
8259 private SIGCHLD handler, allowing catch_child_signal to copy 8259 private SIGCHLD handler, allowing catch_child_signal to copy
8260 it into lib_child_handler. 8260 it into lib_child_handler.
8261 8261
8262 Unfortunatly in glib commit 2e471acf, the behavior changed to 8262 Unfortunately in glib commit 2e471acf, the behavior changed to
8263 always install a signal handler when g_child_watch_source_new 8263 always install a signal handler when g_child_watch_source_new
8264 is called and not just the first time it's called. Glib also 8264 is called and not just the first time it's called. Glib also
8265 now resets signal handlers to SIG_DFL when it no longer has a 8265 now resets signal handlers to SIG_DFL when it no longer has a
diff --git a/src/w32.c b/src/w32.c
index a3c247b8b0d..aade8024811 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -346,6 +346,7 @@ static BOOL g_b_init_get_adapters_addresses;
346static BOOL g_b_init_reg_open_key_ex_w; 346static BOOL g_b_init_reg_open_key_ex_w;
347static BOOL g_b_init_reg_query_value_ex_w; 347static BOOL g_b_init_reg_query_value_ex_w;
348static BOOL g_b_init_expand_environment_strings_w; 348static BOOL g_b_init_expand_environment_strings_w;
349static BOOL g_b_init_get_user_default_ui_language;
349 350
350BOOL g_b_init_compare_string_w; 351BOOL g_b_init_compare_string_w;
351BOOL g_b_init_debug_break_process; 352BOOL g_b_init_debug_break_process;
@@ -533,6 +534,7 @@ DWORD multiByteToWideCharFlags;
533typedef LONG (WINAPI *RegOpenKeyExW_Proc) (HKEY,LPCWSTR,DWORD,REGSAM,PHKEY); 534typedef LONG (WINAPI *RegOpenKeyExW_Proc) (HKEY,LPCWSTR,DWORD,REGSAM,PHKEY);
534typedef LONG (WINAPI *RegQueryValueExW_Proc) (HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); 535typedef LONG (WINAPI *RegQueryValueExW_Proc) (HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
535typedef DWORD (WINAPI *ExpandEnvironmentStringsW_Proc) (LPCWSTR,LPWSTR,DWORD); 536typedef DWORD (WINAPI *ExpandEnvironmentStringsW_Proc) (LPCWSTR,LPWSTR,DWORD);
537typedef LANGID (WINAPI *GetUserDefaultUILanguage_Proc) (void);
536 538
537 /* ** A utility function ** */ 539 /* ** A utility function ** */
538static BOOL 540static BOOL
@@ -1489,6 +1491,28 @@ expand_environment_strings_w (LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize)
1489 return s_pfn_Expand_Environment_Strings_w (lpSrc, lpDst, nSize); 1491 return s_pfn_Expand_Environment_Strings_w (lpSrc, lpDst, nSize);
1490} 1492}
1491 1493
1494static LANGID WINAPI
1495get_user_default_ui_language (void)
1496{
1497 static GetUserDefaultUILanguage_Proc s_pfn_GetUserDefaultUILanguage = NULL;
1498 HMODULE hm_kernel32 = NULL;
1499
1500 if (is_windows_9x () == TRUE)
1501 return 0;
1502
1503 if (g_b_init_get_user_default_ui_language == 0)
1504 {
1505 g_b_init_get_user_default_ui_language = 1;
1506 hm_kernel32 = LoadLibrary ("Kernel32.dll");
1507 if (hm_kernel32)
1508 s_pfn_GetUserDefaultUILanguage = (GetUserDefaultUILanguage_Proc)
1509 get_proc_addr (hm_kernel32, "GetUserDefaultUILanguage");
1510 }
1511 if (s_pfn_GetUserDefaultUILanguage == NULL)
1512 return 0;
1513 return s_pfn_GetUserDefaultUILanguage ();
1514}
1515
1492 1516
1493 1517
1494/* Return 1 if P is a valid pointer to an object of size SIZE. Return 1518/* Return 1 if P is a valid pointer to an object of size SIZE. Return
@@ -2947,6 +2971,32 @@ init_environment (char ** argv)
2947 LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP, 2971 LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP,
2948 locale_name, sizeof (locale_name))) 2972 locale_name, sizeof (locale_name)))
2949 { 2973 {
2974 /* Microsoft are migrating away of locale IDs, replacing them
2975 with locale names, such as "en-US", and are therefore
2976 deprecating the APIs which use LCID etc. As part of that
2977 deprecation, they don't bother inventing LCID and LANGID
2978 codes for new locales and language/culture combinations;
2979 instead, those get LCID of 0xC000 and LANGID of 0x2000, for
2980 which the LCID/LANGID oriented APIs return "ZZZ" as the
2981 "language name". Such "language name" is useless for our
2982 purposes. So we instead use the default UI language, in the
2983 hope of getting something usable. */
2984 if (strcmp (locale_name, "ZZZ") == 0)
2985 {
2986 LANGID lang_id = get_user_default_ui_language ();
2987
2988 if (lang_id != 0)
2989 {
2990 /* Disregard the sorting order differences between cultures. */
2991 LCID def_lcid = MAKELCID (lang_id, SORT_DEFAULT);
2992 char locale_name_def[32];
2993
2994 if (GetLocaleInfo (def_lcid,
2995 LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP,
2996 locale_name_def, sizeof (locale_name_def)))
2997 strcpy (locale_name, locale_name_def);
2998 }
2999 }
2950 for (i = 0; i < N_ENV_VARS; i++) 3000 for (i = 0; i < N_ENV_VARS; i++)
2951 { 3001 {
2952 if (strcmp (env_vars[i].name, "LANG") == 0) 3002 if (strcmp (env_vars[i].name, "LANG") == 0)
@@ -10580,6 +10630,7 @@ globals_of_w32 (void)
10580 g_b_init_expand_environment_strings_w = 0; 10630 g_b_init_expand_environment_strings_w = 0;
10581 g_b_init_compare_string_w = 0; 10631 g_b_init_compare_string_w = 0;
10582 g_b_init_debug_break_process = 0; 10632 g_b_init_debug_break_process = 0;
10633 g_b_init_get_user_default_ui_language = 0;
10583 num_of_processors = 0; 10634 num_of_processors = 0;
10584 /* The following sets a handler for shutdown notifications for 10635 /* The following sets a handler for shutdown notifications for
10585 console apps. This actually applies to Emacs in both console and 10636 console apps. This actually applies to Emacs in both console and
diff --git a/src/w32fns.c b/src/w32fns.c
index 5704f1d3c33..9db367bfafe 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1561,8 +1561,14 @@ w32_clear_under_internal_border (struct frame *f)
1561static void 1561static void
1562w32_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 1562w32_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1563{ 1563{
1564 int argval = check_integer_range (arg, INT_MIN, INT_MAX); 1564 int border;
1565 int border = max (argval, 0); 1565
1566 if (NILP (arg))
1567 border = -1;
1568 else if (RANGED_FIXNUMP (0, arg, INT_MAX))
1569 border = XFIXNAT (arg);
1570 else
1571 signal_error ("Invalid child frame border width", arg);
1566 1572
1567 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f)) 1573 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
1568 { 1574 {
@@ -3887,7 +3893,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam,
3887 Essentially, we have no information about the "role" of 3893 Essentially, we have no information about the "role" of
3888 modifiers on this key: which contribute into the 3894 modifiers on this key: which contribute into the
3889 produced character (so "are consumed"), and which are 3895 produced character (so "are consumed"), and which are
3890 "extra" (must attache to bindable events). 3896 "extra" (must attach to bindable events).
3891 3897
3892 The default above would consume ALL modifiers, so the 3898 The default above would consume ALL modifiers, so the
3893 character is reported "as is". However, on many layouts 3899 character is reported "as is". However, on many layouts
@@ -5896,37 +5902,33 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
5896 Lisp_Object value; 5902 Lisp_Object value;
5897 5903
5898 value = gui_display_get_arg (dpyinfo, parameters, Qinternal_border_width, 5904 value = gui_display_get_arg (dpyinfo, parameters, Qinternal_border_width,
5899 "internalBorder", "InternalBorder", 5905 "internalBorder", "internalBorder",
5900 RES_TYPE_NUMBER); 5906 RES_TYPE_NUMBER);
5901 if (! EQ (value, Qunbound)) 5907 if (! EQ (value, Qunbound))
5902 parameters = Fcons (Fcons (Qinternal_border_width, value), 5908 parameters = Fcons (Fcons (Qinternal_border_width, value),
5903 parameters); 5909 parameters);
5904 } 5910 }
5905 5911
5912 gui_default_parameter (f, parameters, Qinternal_border_width, make_fixnum (0),
5913 "internalBorderWidth", "internalBorderWidth",
5914 RES_TYPE_NUMBER);
5915
5906 /* Same for child frames. */ 5916 /* Same for child frames. */
5907 if (NILP (Fassq (Qchild_frame_border_width, parameters))) 5917 if (NILP (Fassq (Qchild_frame_border_width, parameters)))
5908 { 5918 {
5909 Lisp_Object value; 5919 Lisp_Object value;
5910 5920
5911 value = gui_display_get_arg (dpyinfo, parameters, Qchild_frame_border_width, 5921 value = gui_display_get_arg (dpyinfo, parameters, Qchild_frame_border_width,
5912 "childFrameBorderWidth", "childFrameBorderWidth", 5922 "childFrameBorder", "childFrameBorder",
5913 RES_TYPE_NUMBER); 5923 RES_TYPE_NUMBER);
5914 if (! EQ (value, Qunbound)) 5924 if (!EQ (value, Qunbound))
5915 parameters = Fcons (Fcons (Qchild_frame_border_width, value), 5925 parameters = Fcons (Fcons (Qchild_frame_border_width, value),
5916 parameters); 5926 parameters);
5917
5918 } 5927 }
5919 5928
5920 gui_default_parameter (f, parameters, Qchild_frame_border_width, 5929 gui_default_parameter (f, parameters, Qchild_frame_border_width, Qnil,
5921#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */
5922 make_fixnum (0),
5923#else
5924 make_fixnum (1),
5925#endif
5926 "childFrameBorderWidth", "childFrameBorderWidth", 5930 "childFrameBorderWidth", "childFrameBorderWidth",
5927 RES_TYPE_NUMBER); 5931 RES_TYPE_NUMBER);
5928 gui_default_parameter (f, parameters, Qinternal_border_width, make_fixnum (0),
5929 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER);
5930 gui_default_parameter (f, parameters, Qright_divider_width, make_fixnum (0), 5932 gui_default_parameter (f, parameters, Qright_divider_width, make_fixnum (0),
5931 NULL, NULL, RES_TYPE_NUMBER); 5933 NULL, NULL, RES_TYPE_NUMBER);
5932 gui_default_parameter (f, parameters, Qbottom_divider_width, make_fixnum (0), 5934 gui_default_parameter (f, parameters, Qbottom_divider_width, make_fixnum (0),
diff --git a/src/window.h b/src/window.h
index 4271fc88306..4f209f32d34 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1120,10 +1120,6 @@ void set_window_buffer (Lisp_Object window, Lisp_Object buffer,
1120 1120
1121extern Lisp_Object echo_area_window; 1121extern Lisp_Object echo_area_window;
1122 1122
1123/* Depth in recursive edits. */
1124
1125extern EMACS_INT command_loop_level;
1126
1127/* Non-zero if we should redraw the mode lines on the next redisplay. 1123/* Non-zero if we should redraw the mode lines on the next redisplay.
1128 Usually set to a unique small integer so we can track the main causes of 1124 Usually set to a unique small integer so we can track the main causes of
1129 full redisplays in `redisplay--mode-lines-cause'. */ 1125 full redisplays in `redisplay--mode-lines-cause'. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 170546001db..d37a5657b87 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9227,10 +9227,10 @@ move_it_in_display_line_to (struct it *it,
9227 || prev_method == GET_FROM_STRING) 9227 || prev_method == GET_FROM_STRING)
9228 /* Passed TO_CHARPOS from left to right. */ 9228 /* Passed TO_CHARPOS from left to right. */
9229 && ((prev_pos < to_charpos 9229 && ((prev_pos < to_charpos
9230 && IT_CHARPOS (*it) > to_charpos) 9230 && IT_CHARPOS (*it) >= to_charpos)
9231 /* Passed TO_CHARPOS from right to left. */ 9231 /* Passed TO_CHARPOS from right to left. */
9232 || (prev_pos > to_charpos 9232 || (prev_pos > to_charpos
9233 && IT_CHARPOS (*it) < to_charpos))))) 9233 && IT_CHARPOS (*it) <= to_charpos)))))
9234 { 9234 {
9235 if (it->line_wrap != WORD_WRAP || wrap_it.sp < 0) 9235 if (it->line_wrap != WORD_WRAP || wrap_it.sp < 0)
9236 { 9236 {
@@ -10049,7 +10049,10 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
10049 it->continuation_lines_width = 0; 10049 it->continuation_lines_width = 0;
10050 reseat_at_next_visible_line_start (it, false); 10050 reseat_at_next_visible_line_start (it, false);
10051 if ((op & MOVE_TO_POS) != 0 10051 if ((op & MOVE_TO_POS) != 0
10052 && IT_CHARPOS (*it) > to_charpos) 10052 && (IT_CHARPOS (*it) > to_charpos
10053 || (IT_CHARPOS (*it) == to_charpos
10054 && to_charpos == ZV
10055 && FETCH_BYTE (ZV_BYTE - 1) != '\n')))
10053 { 10056 {
10054 reached = 9; 10057 reached = 9;
10055 goto out; 10058 goto out;
@@ -19452,8 +19455,11 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
19452 'start_display' again. */ 19455 'start_display' again. */
19453 ptrdiff_t it_charpos = IT_CHARPOS (it); 19456 ptrdiff_t it_charpos = IT_CHARPOS (it);
19454 19457
19455 /* Don't let the cursor end in the scroll margins. */ 19458 /* Don't let the cursor end in the scroll margins. However, when
19459 the window is vscrolled, we leave it to vscroll to handle the
19460 margins, see window_scroll_pixel_based. */
19456 if ((flags & TRY_WINDOW_CHECK_MARGINS) 19461 if ((flags & TRY_WINDOW_CHECK_MARGINS)
19462 && w->vscroll == 0
19457 && !MINI_WINDOW_P (w)) 19463 && !MINI_WINDOW_P (w))
19458 { 19464 {
19459 int top_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); 19465 int top_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS);
@@ -19462,7 +19468,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
19462 top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w); 19468 top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w);
19463 start_display (&it, w, pos); 19469 start_display (&it, w, pos);
19464 19470
19465 if ((w->cursor.y >= 0 /* not vscrolled */ 19471 if ((w->cursor.y >= 0
19466 && w->cursor.y < top_scroll_margin 19472 && w->cursor.y < top_scroll_margin
19467 && CHARPOS (pos) > BEGV) 19473 && CHARPOS (pos) > BEGV)
19468 /* rms: considering make_cursor_line_fully_visible_p here 19474 /* rms: considering make_cursor_line_fully_visible_p here
diff --git a/src/xfaces.c b/src/xfaces.c
index b3960fbf9a8..dde611ee6da 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -293,7 +293,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
293/* Size of hash table of realized faces in face caches (should be a 293/* Size of hash table of realized faces in face caches (should be a
294 prime number). */ 294 prime number). */
295 295
296#define FACE_CACHE_BUCKETS_SIZE 1001 296#define FACE_CACHE_BUCKETS_SIZE 1009
297 297
298char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg"; 298char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg";
299 299
diff --git a/src/xfns.c b/src/xfns.c
index cac41ee4856..d90644819b6 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1803,7 +1803,14 @@ x_change_tool_bar_height (struct frame *f, int height)
1803static void 1803static void
1804x_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 1804x_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1805{ 1805{
1806 int border = check_int_nonnegative (arg); 1806 int border;
1807
1808 if (NILP (arg))
1809 border = -1;
1810 else if (RANGED_FIXNUMP (0, arg, INT_MAX))
1811 border = XFIXNAT (arg);
1812 else
1813 signal_error ("Invalid child frame border width", arg);
1807 1814
1808 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f)) 1815 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
1809 { 1816 {
@@ -3920,36 +3927,31 @@ This function is an internal primitive--use `make-frame' instead. */)
3920 parms); 3927 parms);
3921 } 3928 }
3922 3929
3930 gui_default_parameter (f, parms, Qinternal_border_width,
3931#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */
3932 make_fixnum (0),
3933#else
3934 make_fixnum (1),
3935#endif
3936 "internalBorderWidth", "internalBorderWidth",
3937 RES_TYPE_NUMBER);
3938
3923 /* Same for child frames. */ 3939 /* Same for child frames. */
3924 if (NILP (Fassq (Qchild_frame_border_width, parms))) 3940 if (NILP (Fassq (Qchild_frame_border_width, parms)))
3925 { 3941 {
3926 Lisp_Object value; 3942 Lisp_Object value;
3927 3943
3928 value = gui_display_get_arg (dpyinfo, parms, Qchild_frame_border_width, 3944 value = gui_display_get_arg (dpyinfo, parms, Qchild_frame_border_width,
3929 "childFrameBorderWidth", "childFrameBorderWidth", 3945 "childFrameBorder", "childFrameBorder",
3930 RES_TYPE_NUMBER); 3946 RES_TYPE_NUMBER);
3931 if (! EQ (value, Qunbound)) 3947 if (! EQ (value, Qunbound))
3932 parms = Fcons (Fcons (Qchild_frame_border_width, value), 3948 parms = Fcons (Fcons (Qchild_frame_border_width, value),
3933 parms); 3949 parms);
3934
3935 } 3950 }
3936 3951
3937 gui_default_parameter (f, parms, Qchild_frame_border_width, 3952 gui_default_parameter (f, parms, Qchild_frame_border_width, Qnil,
3938#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */
3939 make_fixnum (0),
3940#else
3941 make_fixnum (1),
3942#endif
3943 "childFrameBorderWidth", "childFrameBorderWidth", 3953 "childFrameBorderWidth", "childFrameBorderWidth",
3944 RES_TYPE_NUMBER); 3954 RES_TYPE_NUMBER);
3945 gui_default_parameter (f, parms, Qinternal_border_width,
3946#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */
3947 make_fixnum (0),
3948#else
3949 make_fixnum (1),
3950#endif
3951 "internalBorderWidth", "internalBorderWidth",
3952 RES_TYPE_NUMBER);
3953 gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), 3955 gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
3954 NULL, NULL, RES_TYPE_NUMBER); 3956 NULL, NULL, RES_TYPE_NUMBER);
3955 gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), 3957 gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0),
@@ -4597,7 +4599,7 @@ On MS Windows, this just returns nil. */)
4597 return Qnil; 4599 return Qnil;
4598} 4600}
4599 4601
4600#if !defined USE_GTK || !defined HAVE_GTK3 4602#if !(defined USE_GTK && defined HAVE_GTK3)
4601 4603
4602/* Store the geometry of the workarea on display DPYINFO into *RECT. 4604/* Store the geometry of the workarea on display DPYINFO into *RECT.
4603 Return false if and only if the workarea information cannot be 4605 Return false if and only if the workarea information cannot be
@@ -4660,6 +4662,9 @@ x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
4660 4662
4661 return result; 4663 return result;
4662} 4664}
4665#endif /* !(USE_GTK && HAVE_GTK3) */
4666
4667#ifndef USE_GTK
4663 4668
4664/* Return monitor number where F is "most" or closest to. */ 4669/* Return monitor number where F is "most" or closest to. */
4665static int 4670static int
@@ -4875,6 +4880,8 @@ x_get_monitor_attributes_xrandr (struct x_display_info *dpyinfo)
4875 pxid = XRRGetOutputPrimary (dpy, dpyinfo->root_window); 4880 pxid = XRRGetOutputPrimary (dpy, dpyinfo->root_window);
4876#endif 4881#endif
4877 4882
4883#undef RANDR13_LIBRARY
4884
4878 for (i = 0; i < n_monitors; ++i) 4885 for (i = 0; i < n_monitors; ++i)
4879 { 4886 {
4880 XRROutputInfo *info = XRRGetOutputInfo (dpy, resources, 4887 XRROutputInfo *info = XRRGetOutputInfo (dpy, resources,