diff options
| author | Andrea Corallo | 2021-02-10 21:56:55 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2021-02-10 21:56:55 +0100 |
| commit | 2fcb85c3e780f1f2871ce0f300cfaffce9836eb0 (patch) | |
| tree | a8857ccad8bff12080062a3edaad1a55a3eb8171 /src | |
| parent | 1f626e9662d8120acd5a937f847123cc2b8c6e31 (diff) | |
| parent | 6bfdfeed36fab4680c8db90c22da8f6611694186 (diff) | |
| download | emacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.tar.gz emacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.zip | |
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'src')
| -rw-r--r-- | src/data.c | 4 | ||||
| -rw-r--r-- | src/editfns.c | 10 | ||||
| -rw-r--r-- | src/eval.c | 2 | ||||
| -rw-r--r-- | src/filelock.c | 2 | ||||
| -rw-r--r-- | src/fns.c | 33 | ||||
| -rw-r--r-- | src/frame.c | 16 | ||||
| -rw-r--r-- | src/frame.h | 12 | ||||
| -rw-r--r-- | src/keymap.c | 9 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/lread.c | 117 | ||||
| -rw-r--r-- | src/macros.c | 5 | ||||
| -rw-r--r-- | src/minibuf.c | 64 | ||||
| -rw-r--r-- | src/nsfns.m | 27 | ||||
| -rw-r--r-- | src/nsmenu.m | 4 | ||||
| -rw-r--r-- | src/w32fns.c | 32 | ||||
| -rw-r--r-- | src/w32menu.c | 10 | ||||
| -rw-r--r-- | src/xdisp.c | 52 | ||||
| -rw-r--r-- | src/xfaces.c | 2 | ||||
| -rw-r--r-- | src/xfns.c | 36 | ||||
| -rw-r--r-- | src/xmenu.c | 14 |
20 files changed, 296 insertions, 156 deletions
diff --git a/src/data.c b/src/data.c index 0dc21c8c2a1..2fa92fecc4f 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1893,7 +1893,9 @@ a variable local to the current buffer for one particular use, use | |||
| 1893 | while setting up a new major mode, unless they have a `permanent-local' | 1893 | while setting up a new major mode, unless they have a `permanent-local' |
| 1894 | property. | 1894 | property. |
| 1895 | 1895 | ||
| 1896 | The function `default-value' gets the default value and `set-default' sets it. */) | 1896 | The function `default-value' gets the default value and `set-default' sets it. |
| 1897 | |||
| 1898 | See also `defvar-local'. */) | ||
| 1897 | (register Lisp_Object variable) | 1899 | (register Lisp_Object variable) |
| 1898 | { | 1900 | { |
| 1899 | struct Lisp_Symbol *sym; | 1901 | struct Lisp_Symbol *sym; |
diff --git a/src/editfns.c b/src/editfns.c index e3285494c14..991f79abac7 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3134,6 +3134,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 3134 | char *format_start = SSDATA (args[0]); | 3134 | char *format_start = SSDATA (args[0]); |
| 3135 | bool multibyte_format = STRING_MULTIBYTE (args[0]); | 3135 | bool multibyte_format = STRING_MULTIBYTE (args[0]); |
| 3136 | ptrdiff_t formatlen = SBYTES (args[0]); | 3136 | ptrdiff_t formatlen = SBYTES (args[0]); |
| 3137 | bool fmt_props = string_intervals (args[0]); | ||
| 3137 | 3138 | ||
| 3138 | /* Upper bound on number of format specs. Each uses at least 2 chars. */ | 3139 | /* Upper bound on number of format specs. Each uses at least 2 chars. */ |
| 3139 | ptrdiff_t nspec_bound = SCHARS (args[0]) >> 1; | 3140 | ptrdiff_t nspec_bound = SCHARS (args[0]) >> 1; |
| @@ -3406,13 +3407,20 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 3406 | convbytes += padding; | 3407 | convbytes += padding; |
| 3407 | if (convbytes <= buf + bufsize - p) | 3408 | if (convbytes <= buf + bufsize - p) |
| 3408 | { | 3409 | { |
| 3410 | /* If the format spec has properties, we should account | ||
| 3411 | for the padding on the left in the info[] array. */ | ||
| 3412 | if (fmt_props) | ||
| 3413 | spec->start = nchars; | ||
| 3409 | if (! minus_flag) | 3414 | if (! minus_flag) |
| 3410 | { | 3415 | { |
| 3411 | memset (p, ' ', padding); | 3416 | memset (p, ' ', padding); |
| 3412 | p += padding; | 3417 | p += padding; |
| 3413 | nchars += padding; | 3418 | nchars += padding; |
| 3414 | } | 3419 | } |
| 3415 | spec->start = nchars; | 3420 | /* If the properties will come from the argument, we |
| 3421 | don't extend them to the left due to padding. */ | ||
| 3422 | if (!fmt_props) | ||
| 3423 | spec->start = nchars; | ||
| 3416 | 3424 | ||
| 3417 | if (p > buf | 3425 | if (p > buf |
| 3418 | && multibyte | 3426 | && multibyte |
diff --git a/src/eval.c b/src/eval.c index cef9407dbfa..bf5f6995d87 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -827,6 +827,8 @@ The optional argument DOCSTRING is a documentation string for the | |||
| 827 | variable. | 827 | variable. |
| 828 | 828 | ||
| 829 | To define a user option, use `defcustom' instead of `defvar'. | 829 | To define a user option, use `defcustom' instead of `defvar'. |
| 830 | |||
| 831 | To define a buffer-local variable, use `defvar-local'. | ||
| 830 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | 832 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) |
| 831 | (Lisp_Object args) | 833 | (Lisp_Object args) |
| 832 | { | 834 | { |
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; |
| @@ -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 | |||
| 5762 | DEFUN ("line-number-at-pos", Fline_number_at_pos, | ||
| 5763 | Sline_number_at_pos, 0, 2, 0, | ||
| 5764 | doc: /* Return the line number at POSITION. | ||
| 5765 | If POSITION is nil, use the current buffer location. | ||
| 5766 | |||
| 5767 | If the buffer is narrowed, the position returned is the position in the | ||
| 5768 | visible part of the buffer. If ABSOLUTE is non-nil, count the lines | ||
| 5769 | from 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 | ||
| 5763 | void | 5795 | void |
| @@ -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/frame.c b/src/frame.c index a2167ce1e49..635fc945604 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -898,6 +898,7 @@ make_frame (bool mini_p) | |||
| 898 | f->no_accept_focus = false; | 898 | f->no_accept_focus = false; |
| 899 | f->z_group = z_group_none; | 899 | f->z_group = z_group_none; |
| 900 | f->tooltip = false; | 900 | f->tooltip = false; |
| 901 | f->child_frame_border_width = -1; | ||
| 901 | f->last_tab_bar_item = -1; | 902 | f->last_tab_bar_item = -1; |
| 902 | #ifndef HAVE_EXT_TOOL_BAR | 903 | #ifndef HAVE_EXT_TOOL_BAR |
| 903 | f->last_tool_bar_item = -1; | 904 | f->last_tool_bar_item = -1; |
| @@ -3544,10 +3545,17 @@ DEFUN ("frame-fringe-width", Ffringe_width, Sfringe_width, 0, 1, 0, | |||
| 3544 | } | 3545 | } |
| 3545 | 3546 | ||
| 3546 | DEFUN ("frame-child-frame-border-width", Fframe_child_frame_border_width, Sframe_child_frame_border_width, 0, 1, 0, | 3547 | DEFUN ("frame-child-frame-border-width", Fframe_child_frame_border_width, Sframe_child_frame_border_width, 0, 1, 0, |
| 3547 | doc: /* Return width of FRAME's child-frame border in pixels. */) | 3548 | doc: /* Return width of FRAME's child-frame border in pixels. |
| 3549 | If FRAME's 'child-frame-border-width' parameter is nil, return FRAME's | ||
| 3550 | internal border width instead. */) | ||
| 3548 | (Lisp_Object frame) | 3551 | (Lisp_Object frame) |
| 3549 | { | 3552 | { |
| 3550 | return make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame))); | 3553 | int width = FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame)); |
| 3554 | |||
| 3555 | if (width < 0) | ||
| 3556 | return make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (decode_any_frame (frame))); | ||
| 3557 | else | ||
| 3558 | return make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame))); | ||
| 3551 | } | 3559 | } |
| 3552 | 3560 | ||
| 3553 | DEFUN ("frame-internal-border-width", Fframe_internal_border_width, Sframe_internal_border_width, 0, 1, 0, | 3561 | DEFUN ("frame-internal-border-width", Fframe_internal_border_width, Sframe_internal_border_width, 0, 1, 0, |
| @@ -4311,7 +4319,9 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr) | |||
| 4311 | store_in_alist (alistptr, Qborder_width, | 4319 | store_in_alist (alistptr, Qborder_width, |
| 4312 | make_fixnum (f->border_width)); | 4320 | make_fixnum (f->border_width)); |
| 4313 | store_in_alist (alistptr, Qchild_frame_border_width, | 4321 | store_in_alist (alistptr, Qchild_frame_border_width, |
| 4314 | make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (f))); | 4322 | FRAME_CHILD_FRAME_BORDER_WIDTH (f) >= 0 |
| 4323 | ? make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (f)) | ||
| 4324 | : Qnil); | ||
| 4315 | store_in_alist (alistptr, Qinternal_border_width, | 4325 | store_in_alist (alistptr, Qinternal_border_width, |
| 4316 | make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f))); | 4326 | make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f))); |
| 4317 | store_in_alist (alistptr, Qright_divider_width, | 4327 | store_in_alist (alistptr, Qright_divider_width, |
diff --git a/src/frame.h b/src/frame.h index 9b0852c7b9c..9ddcb4c6810 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1449,11 +1449,11 @@ INLINE int | |||
| 1449 | FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) | 1449 | FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) |
| 1450 | { | 1450 | { |
| 1451 | #ifdef HAVE_WINDOW_SYSTEM | 1451 | #ifdef HAVE_WINDOW_SYSTEM |
| 1452 | return FRAME_PARENT_FRAME(f) | 1452 | return (FRAME_PARENT_FRAME(f) |
| 1453 | ? (f->child_frame_border_width | 1453 | ? (FRAME_CHILD_FRAME_BORDER_WIDTH(f) >= 0 |
| 1454 | ? FRAME_CHILD_FRAME_BORDER_WIDTH(f) | 1454 | ? FRAME_CHILD_FRAME_BORDER_WIDTH(f) |
| 1455 | : frame_dimension (f->internal_border_width)) | 1455 | : frame_dimension (f->internal_border_width)) |
| 1456 | : frame_dimension (f->internal_border_width); | 1456 | : frame_dimension (f->internal_border_width)); |
| 1457 | #else | 1457 | #else |
| 1458 | return frame_dimension (f->internal_border_width); | 1458 | return frame_dimension (f->internal_border_width); |
| 1459 | #endif | 1459 | #endif |
| @@ -1707,7 +1707,7 @@ extern Lisp_Object gui_display_get_resource (Display_Info *, | |||
| 1707 | Lisp_Object component, | 1707 | Lisp_Object component, |
| 1708 | Lisp_Object subclass); | 1708 | Lisp_Object subclass); |
| 1709 | 1709 | ||
| 1710 | extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p); | 1710 | extern void set_frame_menubar (struct frame *f, bool deep_p); |
| 1711 | extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); | 1711 | extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); |
| 1712 | extern void free_frame_menubar (struct frame *); | 1712 | extern void free_frame_menubar (struct frame *); |
| 1713 | extern bool frame_ancestor_p (struct frame *af, struct frame *df); | 1713 | extern bool frame_ancestor_p (struct frame *af, struct frame *df); |
diff --git a/src/keymap.c b/src/keymap.c index de9b2b58c5e..782931fadff 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1065,9 +1065,6 @@ binding KEY to DEF is added at the front of KEYMAP. */) | |||
| 1065 | if (length == 0) | 1065 | if (length == 0) |
| 1066 | return Qnil; | 1066 | return Qnil; |
| 1067 | 1067 | ||
| 1068 | if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt)) | ||
| 1069 | Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands); | ||
| 1070 | |||
| 1071 | int meta_bit = (VECTORP (key) || (STRINGP (key) && STRING_MULTIBYTE (key)) | 1068 | int meta_bit = (VECTORP (key) || (STRINGP (key) && STRING_MULTIBYTE (key)) |
| 1072 | ? meta_modifier : 0x80); | 1069 | ? meta_modifier : 0x80); |
| 1073 | 1070 | ||
| @@ -3132,12 +3129,6 @@ syms_of_keymap (void) | |||
| 3132 | pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" "))); | 3129 | pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" "))); |
| 3133 | staticpro (&exclude_keys); | 3130 | staticpro (&exclude_keys); |
| 3134 | 3131 | ||
| 3135 | DEFVAR_LISP ("define-key-rebound-commands", Vdefine_key_rebound_commands, | ||
| 3136 | doc: /* List of commands given new key bindings recently. | ||
| 3137 | This is used for internal purposes during Emacs startup; | ||
| 3138 | don't alter it yourself. */); | ||
| 3139 | Vdefine_key_rebound_commands = Qt; | ||
| 3140 | |||
| 3141 | DEFVAR_LISP ("minibuffer-local-map", Vminibuffer_local_map, | 3132 | DEFVAR_LISP ("minibuffer-local-map", Vminibuffer_local_map, |
| 3142 | doc: /* Default keymap to use when reading from the minibuffer. */); | 3133 | doc: /* Default keymap to use when reading from the minibuffer. */); |
| 3143 | Vminibuffer_local_map = Fmake_sparse_keymap (Qnil); | 3134 | Vminibuffer_local_map = Fmake_sparse_keymap (Qnil); |
diff --git a/src/lisp.h b/src/lisp.h index 296f9af7337..1d4f16bd581 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3752,6 +3752,7 @@ extern void message_log_maybe_newline (void); | |||
| 3752 | extern void update_echo_area (void); | 3752 | extern void update_echo_area (void); |
| 3753 | extern void truncate_echo_area (ptrdiff_t); | 3753 | extern void truncate_echo_area (ptrdiff_t); |
| 3754 | extern void redisplay (void); | 3754 | extern void redisplay (void); |
| 3755 | extern ptrdiff_t count_lines (ptrdiff_t start_byte, ptrdiff_t end_byte); | ||
| 3755 | 3756 | ||
| 3756 | void set_frame_cursor_types (struct frame *, Lisp_Object); | 3757 | void set_frame_cursor_types (struct frame *, Lisp_Object); |
| 3757 | extern void syms_of_xdisp (void); | 3758 | extern void syms_of_xdisp (void); |
diff --git a/src/lread.c b/src/lread.c index 4cf4f8cde9b..d947c4e519a 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -537,6 +537,33 @@ readbyte_from_string (int c, Lisp_Object readcharfun) | |||
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | 539 | ||
| 540 | /* Signal Qinvalid_read_syntax error. | ||
| 541 | S is error string of length N (if > 0) */ | ||
| 542 | |||
| 543 | static AVOID | ||
| 544 | invalid_syntax_lisp (Lisp_Object s, Lisp_Object readcharfun) | ||
| 545 | { | ||
| 546 | if (BUFFERP (readcharfun)) | ||
| 547 | { | ||
| 548 | xsignal (Qinvalid_read_syntax, | ||
| 549 | list3 (s, | ||
| 550 | /* We should already be in the readcharfun | ||
| 551 | buffer when this error is called, so no need | ||
| 552 | to switch to it first. */ | ||
| 553 | make_fixnum (count_lines (BEGV_BYTE, PT_BYTE) + 1), | ||
| 554 | make_fixnum (current_column ()))); | ||
| 555 | } | ||
| 556 | else | ||
| 557 | xsignal1 (Qinvalid_read_syntax, s); | ||
| 558 | } | ||
| 559 | |||
| 560 | static AVOID | ||
| 561 | invalid_syntax (const char *s, Lisp_Object readcharfun) | ||
| 562 | { | ||
| 563 | invalid_syntax_lisp (build_string (s), readcharfun); | ||
| 564 | } | ||
| 565 | |||
| 566 | |||
| 540 | /* Read one non-ASCII character from INFILE. The character is | 567 | /* Read one non-ASCII character from INFILE. The character is |
| 541 | encoded in `emacs-mule' and the first byte is already read in | 568 | encoded in `emacs-mule' and the first byte is already read in |
| 542 | C. */ | 569 | C. */ |
| @@ -594,8 +621,7 @@ read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object rea | |||
| 594 | } | 621 | } |
| 595 | c = DECODE_CHAR (charset, code); | 622 | c = DECODE_CHAR (charset, code); |
| 596 | if (c < 0) | 623 | if (c < 0) |
| 597 | Fsignal (Qinvalid_read_syntax, | 624 | invalid_syntax ("invalid multibyte form", readcharfun); |
| 598 | list1 (build_string ("invalid multibyte form"))); | ||
| 599 | return c; | 625 | return c; |
| 600 | } | 626 | } |
| 601 | 627 | ||
| @@ -778,7 +804,10 @@ If `inhibit-interaction' is non-nil, this function will signal an | |||
| 778 | barf_if_interaction_inhibited (); | 804 | barf_if_interaction_inhibited (); |
| 779 | 805 | ||
| 780 | if (! NILP (prompt)) | 806 | if (! NILP (prompt)) |
| 781 | message_with_string ("%s", prompt, 0); | 807 | { |
| 808 | cancel_echoing (); | ||
| 809 | message_with_string ("%s", prompt, 0); | ||
| 810 | } | ||
| 782 | val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds); | 811 | val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds); |
| 783 | 812 | ||
| 784 | return (NILP (val) ? Qnil | 813 | return (NILP (val) ? Qnil |
| @@ -813,7 +842,10 @@ If `inhibit-interaction' is non-nil, this function will signal an | |||
| 813 | barf_if_interaction_inhibited (); | 842 | barf_if_interaction_inhibited (); |
| 814 | 843 | ||
| 815 | if (! NILP (prompt)) | 844 | if (! NILP (prompt)) |
| 816 | message_with_string ("%s", prompt, 0); | 845 | { |
| 846 | cancel_echoing (); | ||
| 847 | message_with_string ("%s", prompt, 0); | ||
| 848 | } | ||
| 817 | return read_filtered_event (0, 0, 0, ! NILP (inherit_input_method), seconds); | 849 | return read_filtered_event (0, 0, 0, ! NILP (inherit_input_method), seconds); |
| 818 | } | 850 | } |
| 819 | 851 | ||
| @@ -849,7 +881,10 @@ If `inhibit-interaction' is non-nil, this function will signal an | |||
| 849 | barf_if_interaction_inhibited (); | 881 | barf_if_interaction_inhibited (); |
| 850 | 882 | ||
| 851 | if (! NILP (prompt)) | 883 | if (! NILP (prompt)) |
| 852 | message_with_string ("%s", prompt, 0); | 884 | { |
| 885 | cancel_echoing (); | ||
| 886 | message_with_string ("%s", prompt, 0); | ||
| 887 | } | ||
| 853 | 888 | ||
| 854 | val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds); | 889 | val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds); |
| 855 | 890 | ||
| @@ -2424,16 +2459,6 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) | |||
| 2424 | } | 2459 | } |
| 2425 | 2460 | ||
| 2426 | 2461 | ||
| 2427 | /* Signal Qinvalid_read_syntax error. | ||
| 2428 | S is error string of length N (if > 0) */ | ||
| 2429 | |||
| 2430 | static AVOID | ||
| 2431 | invalid_syntax (const char *s) | ||
| 2432 | { | ||
| 2433 | xsignal1 (Qinvalid_read_syntax, build_string (s)); | ||
| 2434 | } | ||
| 2435 | |||
| 2436 | |||
| 2437 | /* Use this for recursive reads, in contexts where internal tokens | 2462 | /* Use this for recursive reads, in contexts where internal tokens |
| 2438 | are not allowed. */ | 2463 | are not allowed. */ |
| 2439 | 2464 | ||
| @@ -2447,8 +2472,8 @@ read0 (Lisp_Object readcharfun) | |||
| 2447 | if (!c) | 2472 | if (!c) |
| 2448 | return val; | 2473 | return val; |
| 2449 | 2474 | ||
| 2450 | xsignal1 (Qinvalid_read_syntax, | 2475 | invalid_syntax_lisp (Fmake_string (make_fixnum (1), make_fixnum (c), Qnil), |
| 2451 | Fmake_string (make_fixnum (1), make_fixnum (c), Qnil)); | 2476 | readcharfun); |
| 2452 | } | 2477 | } |
| 2453 | 2478 | ||
| 2454 | /* Grow a read buffer BUF that contains OFFSET useful bytes of data, | 2479 | /* Grow a read buffer BUF that contains OFFSET useful bytes of data, |
| @@ -2478,7 +2503,8 @@ grow_read_buffer (char *buf, ptrdiff_t offset, | |||
| 2478 | /* Return the scalar value that has the Unicode character name NAME. | 2503 | /* Return the scalar value that has the Unicode character name NAME. |
| 2479 | Raise 'invalid-read-syntax' if there is no such character. */ | 2504 | Raise 'invalid-read-syntax' if there is no such character. */ |
| 2480 | static int | 2505 | static int |
| 2481 | character_name_to_code (char const *name, ptrdiff_t name_len) | 2506 | character_name_to_code (char const *name, ptrdiff_t name_len, |
| 2507 | Lisp_Object readcharfun) | ||
| 2482 | { | 2508 | { |
| 2483 | /* For "U+XXXX", pass the leading '+' to string_to_number to reject | 2509 | /* For "U+XXXX", pass the leading '+' to string_to_number to reject |
| 2484 | monstrosities like "U+-0000". */ | 2510 | monstrosities like "U+-0000". */ |
| @@ -2494,7 +2520,7 @@ character_name_to_code (char const *name, ptrdiff_t name_len) | |||
| 2494 | { | 2520 | { |
| 2495 | AUTO_STRING (format, "\\N{%s}"); | 2521 | AUTO_STRING (format, "\\N{%s}"); |
| 2496 | AUTO_STRING_WITH_LEN (namestr, name, name_len); | 2522 | AUTO_STRING_WITH_LEN (namestr, name, name_len); |
| 2497 | xsignal1 (Qinvalid_read_syntax, CALLN (Fformat, format, namestr)); | 2523 | invalid_syntax_lisp (CALLN (Fformat, format, namestr), readcharfun); |
| 2498 | } | 2524 | } |
| 2499 | 2525 | ||
| 2500 | return XFIXNUM (code); | 2526 | return XFIXNUM (code); |
| @@ -2713,7 +2739,7 @@ read_escape (Lisp_Object readcharfun, bool stringp) | |||
| 2713 | { | 2739 | { |
| 2714 | c = READCHAR; | 2740 | c = READCHAR; |
| 2715 | if (c != '{') | 2741 | if (c != '{') |
| 2716 | invalid_syntax ("Expected opening brace after \\N"); | 2742 | invalid_syntax ("Expected opening brace after \\N", readcharfun); |
| 2717 | char name[UNICODE_CHARACTER_NAME_LENGTH_BOUND + 1]; | 2743 | char name[UNICODE_CHARACTER_NAME_LENGTH_BOUND + 1]; |
| 2718 | bool whitespace = false; | 2744 | bool whitespace = false; |
| 2719 | ptrdiff_t length = 0; | 2745 | ptrdiff_t length = 0; |
| @@ -2728,8 +2754,9 @@ read_escape (Lisp_Object readcharfun, bool stringp) | |||
| 2728 | { | 2754 | { |
| 2729 | AUTO_STRING (format, | 2755 | AUTO_STRING (format, |
| 2730 | "Invalid character U+%04X in character name"); | 2756 | "Invalid character U+%04X in character name"); |
| 2731 | xsignal1 (Qinvalid_read_syntax, | 2757 | invalid_syntax_lisp (CALLN (Fformat, format, |
| 2732 | CALLN (Fformat, format, make_fixed_natnum (c))); | 2758 | make_fixed_natnum (c)), |
| 2759 | readcharfun); | ||
| 2733 | } | 2760 | } |
| 2734 | /* Treat multiple adjacent whitespace characters as a | 2761 | /* Treat multiple adjacent whitespace characters as a |
| 2735 | single space character. This makes it easier to use | 2762 | single space character. This makes it easier to use |
| @@ -2745,15 +2772,15 @@ read_escape (Lisp_Object readcharfun, bool stringp) | |||
| 2745 | whitespace = false; | 2772 | whitespace = false; |
| 2746 | name[length++] = c; | 2773 | name[length++] = c; |
| 2747 | if (length >= sizeof name) | 2774 | if (length >= sizeof name) |
| 2748 | invalid_syntax ("Character name too long"); | 2775 | invalid_syntax ("Character name too long", readcharfun); |
| 2749 | } | 2776 | } |
| 2750 | if (length == 0) | 2777 | if (length == 0) |
| 2751 | invalid_syntax ("Empty character name"); | 2778 | invalid_syntax ("Empty character name", readcharfun); |
| 2752 | name[length] = '\0'; | 2779 | name[length] = '\0'; |
| 2753 | 2780 | ||
| 2754 | /* character_name_to_code can invoke read1, recursively. | 2781 | /* character_name_to_code can invoke read1, recursively. |
| 2755 | This is why read1's buffer is not static. */ | 2782 | This is why read1's buffer is not static. */ |
| 2756 | return character_name_to_code (name, length); | 2783 | return character_name_to_code (name, length, readcharfun); |
| 2757 | } | 2784 | } |
| 2758 | 2785 | ||
| 2759 | default: | 2786 | default: |
| @@ -2791,10 +2818,11 @@ enum { stackbufsize = max (64, | |||
| 2791 | + INT_STRLEN_BOUND (EMACS_INT) + 1)) }; | 2818 | + INT_STRLEN_BOUND (EMACS_INT) + 1)) }; |
| 2792 | 2819 | ||
| 2793 | static void | 2820 | static void |
| 2794 | invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS (stackbufsize)]) | 2821 | invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS (stackbufsize)], |
| 2822 | Lisp_Object readcharfun) | ||
| 2795 | { | 2823 | { |
| 2796 | sprintf (stackbuf, invalid_radix_integer_format, radix); | 2824 | sprintf (stackbuf, invalid_radix_integer_format, radix); |
| 2797 | invalid_syntax (stackbuf); | 2825 | invalid_syntax (stackbuf, readcharfun); |
| 2798 | } | 2826 | } |
| 2799 | 2827 | ||
| 2800 | /* Read an integer in radix RADIX using READCHARFUN to read | 2828 | /* Read an integer in radix RADIX using READCHARFUN to read |
| @@ -2854,7 +2882,7 @@ read_integer (Lisp_Object readcharfun, int radix, | |||
| 2854 | UNREAD (c); | 2882 | UNREAD (c); |
| 2855 | 2883 | ||
| 2856 | if (valid != 1) | 2884 | if (valid != 1) |
| 2857 | invalid_radix_integer (radix, stackbuf); | 2885 | invalid_radix_integer (radix, stackbuf, readcharfun); |
| 2858 | 2886 | ||
| 2859 | *p = '\0'; | 2887 | *p = '\0'; |
| 2860 | return unbind_to (count, string_to_number (read_buffer, radix, NULL)); | 2888 | return unbind_to (count, string_to_number (read_buffer, radix, NULL)); |
| @@ -2990,7 +3018,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2990 | return ht; | 3018 | return ht; |
| 2991 | } | 3019 | } |
| 2992 | UNREAD (c); | 3020 | UNREAD (c); |
| 2993 | invalid_syntax ("#"); | 3021 | invalid_syntax ("#", readcharfun); |
| 2994 | } | 3022 | } |
| 2995 | if (c == '^') | 3023 | if (c == '^') |
| 2996 | { | 3024 | { |
| @@ -3042,9 +3070,9 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3042 | } | 3070 | } |
| 3043 | return tbl; | 3071 | return tbl; |
| 3044 | } | 3072 | } |
| 3045 | invalid_syntax ("#^^"); | 3073 | invalid_syntax ("#^^", readcharfun); |
| 3046 | } | 3074 | } |
| 3047 | invalid_syntax ("#^"); | 3075 | invalid_syntax ("#^", readcharfun); |
| 3048 | } | 3076 | } |
| 3049 | if (c == '&') | 3077 | if (c == '&') |
| 3050 | { | 3078 | { |
| @@ -3067,7 +3095,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3067 | version. */ | 3095 | version. */ |
| 3068 | && ! (XFIXNAT (length) | 3096 | && ! (XFIXNAT (length) |
| 3069 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) | 3097 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) |
| 3070 | invalid_syntax ("#&..."); | 3098 | invalid_syntax ("#&...", readcharfun); |
| 3071 | 3099 | ||
| 3072 | val = make_uninit_bool_vector (XFIXNAT (length)); | 3100 | val = make_uninit_bool_vector (XFIXNAT (length)); |
| 3073 | data = bool_vector_uchar_data (val); | 3101 | data = bool_vector_uchar_data (val); |
| @@ -3078,7 +3106,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3078 | &= (1 << (XFIXNUM (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; | 3106 | &= (1 << (XFIXNUM (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; |
| 3079 | return val; | 3107 | return val; |
| 3080 | } | 3108 | } |
| 3081 | invalid_syntax ("#&..."); | 3109 | invalid_syntax ("#&...", readcharfun); |
| 3082 | } | 3110 | } |
| 3083 | if (c == '[') | 3111 | if (c == '[') |
| 3084 | { | 3112 | { |
| @@ -3096,7 +3124,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3096 | && VECTORP (AREF (tmp, COMPILED_CONSTANTS))) | 3124 | && VECTORP (AREF (tmp, COMPILED_CONSTANTS))) |
| 3097 | || CONSP (AREF (tmp, COMPILED_BYTECODE))) | 3125 | || CONSP (AREF (tmp, COMPILED_BYTECODE))) |
| 3098 | && FIXNATP (AREF (tmp, COMPILED_STACK_DEPTH)))) | 3126 | && FIXNATP (AREF (tmp, COMPILED_STACK_DEPTH)))) |
| 3099 | invalid_syntax ("Invalid byte-code object"); | 3127 | invalid_syntax ("Invalid byte-code object", readcharfun); |
| 3100 | 3128 | ||
| 3101 | if (STRINGP (AREF (tmp, COMPILED_BYTECODE)) | 3129 | if (STRINGP (AREF (tmp, COMPILED_BYTECODE)) |
| 3102 | && STRING_MULTIBYTE (AREF (tmp, COMPILED_BYTECODE))) | 3130 | && STRING_MULTIBYTE (AREF (tmp, COMPILED_BYTECODE))) |
| @@ -3138,7 +3166,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3138 | /* Read the string itself. */ | 3166 | /* Read the string itself. */ |
| 3139 | tmp = read1 (readcharfun, &ch, 0); | 3167 | tmp = read1 (readcharfun, &ch, 0); |
| 3140 | if (ch != 0 || !STRINGP (tmp)) | 3168 | if (ch != 0 || !STRINGP (tmp)) |
| 3141 | invalid_syntax ("#"); | 3169 | invalid_syntax ("#", readcharfun); |
| 3142 | /* Read the intervals and their properties. */ | 3170 | /* Read the intervals and their properties. */ |
| 3143 | while (1) | 3171 | while (1) |
| 3144 | { | 3172 | { |
| @@ -3153,7 +3181,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3153 | if (ch == 0) | 3181 | if (ch == 0) |
| 3154 | plist = read1 (readcharfun, &ch, 0); | 3182 | plist = read1 (readcharfun, &ch, 0); |
| 3155 | if (ch) | 3183 | if (ch) |
| 3156 | invalid_syntax ("Invalid string property list"); | 3184 | invalid_syntax ("Invalid string property list", readcharfun); |
| 3157 | Fset_text_properties (beg, end, plist, tmp); | 3185 | Fset_text_properties (beg, end, plist, tmp); |
| 3158 | } | 3186 | } |
| 3159 | 3187 | ||
| @@ -3301,7 +3329,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3301 | if (c == 'r' || c == 'R') | 3329 | if (c == 'r' || c == 'R') |
| 3302 | { | 3330 | { |
| 3303 | if (! (2 <= n && n <= 36)) | 3331 | if (! (2 <= n && n <= 36)) |
| 3304 | invalid_radix_integer (n, stackbuf); | 3332 | invalid_radix_integer (n, stackbuf, readcharfun); |
| 3305 | return read_integer (readcharfun, n, stackbuf); | 3333 | return read_integer (readcharfun, n, stackbuf); |
| 3306 | } | 3334 | } |
| 3307 | 3335 | ||
| @@ -3395,7 +3423,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3395 | return read_integer (readcharfun, 2, stackbuf); | 3423 | return read_integer (readcharfun, 2, stackbuf); |
| 3396 | 3424 | ||
| 3397 | UNREAD (c); | 3425 | UNREAD (c); |
| 3398 | invalid_syntax ("#"); | 3426 | invalid_syntax ("#", readcharfun); |
| 3399 | 3427 | ||
| 3400 | case ';': | 3428 | case ';': |
| 3401 | while ((c = READCHAR) >= 0 && c != '\n'); | 3429 | while ((c = READCHAR) >= 0 && c != '\n'); |
| @@ -3467,7 +3495,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3467 | if (ok) | 3495 | if (ok) |
| 3468 | return make_fixnum (c); | 3496 | return make_fixnum (c); |
| 3469 | 3497 | ||
| 3470 | invalid_syntax ("?"); | 3498 | invalid_syntax ("?", readcharfun); |
| 3471 | } | 3499 | } |
| 3472 | 3500 | ||
| 3473 | case '"': | 3501 | case '"': |
| @@ -3553,7 +3581,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3553 | 3581 | ||
| 3554 | /* Any modifiers remaining are invalid. */ | 3582 | /* Any modifiers remaining are invalid. */ |
| 3555 | if (modifiers) | 3583 | if (modifiers) |
| 3556 | invalid_syntax ("Invalid modifier in string"); | 3584 | invalid_syntax ("Invalid modifier in string", readcharfun); |
| 3557 | p += CHAR_STRING (ch, (unsigned char *) p); | 3585 | p += CHAR_STRING (ch, (unsigned char *) p); |
| 3558 | } | 3586 | } |
| 3559 | else | 3587 | else |
| @@ -4093,7 +4121,7 @@ read_list (bool flag, Lisp_Object readcharfun) | |||
| 4093 | { | 4121 | { |
| 4094 | if (ch == ']') | 4122 | if (ch == ']') |
| 4095 | return val; | 4123 | return val; |
| 4096 | invalid_syntax (") or . in a vector"); | 4124 | invalid_syntax (") or . in a vector", readcharfun); |
| 4097 | } | 4125 | } |
| 4098 | if (ch == ')') | 4126 | if (ch == ')') |
| 4099 | return val; | 4127 | return val; |
| @@ -4173,9 +4201,9 @@ read_list (bool flag, Lisp_Object readcharfun) | |||
| 4173 | 4201 | ||
| 4174 | return val; | 4202 | return val; |
| 4175 | } | 4203 | } |
| 4176 | invalid_syntax (". in wrong context"); | 4204 | invalid_syntax (". in wrong context", readcharfun); |
| 4177 | } | 4205 | } |
| 4178 | invalid_syntax ("] in a list"); | 4206 | invalid_syntax ("] in a list", readcharfun); |
| 4179 | } | 4207 | } |
| 4180 | tem = list1 (elt); | 4208 | tem = list1 (elt); |
| 4181 | if (!NILP (tail)) | 4209 | if (!NILP (tail)) |
| @@ -4908,7 +4936,8 @@ to find all the symbols in an obarray, use `mapatoms'. */); | |||
| 4908 | 4936 | ||
| 4909 | DEFVAR_LISP ("values", Vvalues, | 4937 | DEFVAR_LISP ("values", Vvalues, |
| 4910 | doc: /* List of values of all expressions which were read, evaluated and printed. | 4938 | doc: /* List of values of all expressions which were read, evaluated and printed. |
| 4911 | Order is reverse chronological. */); | 4939 | Order is reverse chronological. |
| 4940 | This variable is obsolete as of Emacs 28.1 and should not be used. */); | ||
| 4912 | XSYMBOL (intern ("values"))->u.s.declared_special = false; | 4941 | XSYMBOL (intern ("values"))->u.s.declared_special = false; |
| 4913 | 4942 | ||
| 4914 | DEFVAR_LISP ("standard-input", Vstandard_input, | 4943 | DEFVAR_LISP ("standard-input", Vstandard_input, |
diff --git a/src/macros.c b/src/macros.c index c8ce94e63b1..60d0766a754 100644 --- a/src/macros.c +++ b/src/macros.c | |||
| @@ -279,7 +279,10 @@ its function definition is used. | |||
| 279 | COUNT is a repeat count, or nil for once, or 0 for infinite loop. | 279 | COUNT is a repeat count, or nil for once, or 0 for infinite loop. |
| 280 | 280 | ||
| 281 | Optional third arg LOOPFUNC may be a function that is called prior to | 281 | Optional third arg LOOPFUNC may be a function that is called prior to |
| 282 | each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) | 282 | each iteration of the macro. Iteration stops if LOOPFUNC returns nil. |
| 283 | |||
| 284 | The buffer shown in the currently selected window will be made the current | ||
| 285 | buffer before the macro is executed. */) | ||
| 283 | (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc) | 286 | (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc) |
| 284 | { | 287 | { |
| 285 | Lisp_Object final; | 288 | Lisp_Object final; |
diff --git a/src/minibuf.c b/src/minibuf.c index 5df10453739..949c3d989d5 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -594,6 +594,18 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 594 | record_unwind_protect (restore_buffer, Fcurrent_buffer ()); | 594 | record_unwind_protect (restore_buffer, Fcurrent_buffer ()); |
| 595 | 595 | ||
| 596 | choose_minibuf_frame (); | 596 | choose_minibuf_frame (); |
| 597 | mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window)); | ||
| 598 | |||
| 599 | if (minibuf_level > 1 | ||
| 600 | && minibuf_moves_frame_when_opened () | ||
| 601 | && !minibuf_follows_frame ()) | ||
| 602 | { | ||
| 603 | EMACS_INT i; | ||
| 604 | |||
| 605 | /* Stack up the existing minibuffers on the current mini-window */ | ||
| 606 | for (i = 1; i < minibuf_level; i++) | ||
| 607 | set_window_buffer (minibuf_window, nth_minibuffer (i), 0, 0); | ||
| 608 | } | ||
| 597 | 609 | ||
| 598 | record_unwind_protect_void (choose_minibuf_frame); | 610 | record_unwind_protect_void (choose_minibuf_frame); |
| 599 | 611 | ||
| @@ -602,7 +614,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 602 | 614 | ||
| 603 | /* If the minibuffer window is on a different frame, save that | 615 | /* If the minibuffer window is on a different frame, save that |
| 604 | frame's configuration too. */ | 616 | frame's configuration too. */ |
| 605 | mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window)); | ||
| 606 | if (!EQ (mini_frame, selected_frame)) | 617 | if (!EQ (mini_frame, selected_frame)) |
| 607 | record_unwind_protect (restore_window_configuration, | 618 | record_unwind_protect (restore_window_configuration, |
| 608 | Fcons (/* Arrange for the frame later to be | 619 | Fcons (/* Arrange for the frame later to be |
| @@ -745,17 +756,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 745 | } | 756 | } |
| 746 | } | 757 | } |
| 747 | 758 | ||
| 748 | if (minibuf_moves_frame_when_opened ()) | ||
| 749 | { | ||
| 750 | EMACS_INT i; | ||
| 751 | |||
| 752 | /* Stack up all the (recursively) open minibuffers on the selected | ||
| 753 | mini_window. */ | ||
| 754 | for (i = 1; i < minibuf_level; i++) | ||
| 755 | set_window_buffer (XFRAME (mini_frame)->minibuffer_window, | ||
| 756 | nth_minibuffer (i), 0, 0); | ||
| 757 | } | ||
| 758 | |||
| 759 | /* Display this minibuffer in the proper window. */ | 759 | /* Display this minibuffer in the proper window. */ |
| 760 | /* Use set_window_buffer instead of Fset_window_buffer (see | 760 | /* Use set_window_buffer instead of Fset_window_buffer (see |
| 761 | discussion of bug#11984, bug#12025, bug#12026). */ | 761 | discussion of bug#11984, bug#12025, bug#12026). */ |
| @@ -926,6 +926,31 @@ nth_minibuffer (EMACS_INT depth) | |||
| 926 | return XCAR (tail); | 926 | return XCAR (tail); |
| 927 | } | 927 | } |
| 928 | 928 | ||
| 929 | /* Set the major mode of the minibuffer BUF, depending on DEPTH, the | ||
| 930 | minibuffer depth. */ | ||
| 931 | |||
| 932 | static void | ||
| 933 | set_minibuffer_mode (Lisp_Object buf, EMACS_INT depth) | ||
| 934 | { | ||
| 935 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 936 | |||
| 937 | record_unwind_current_buffer (); | ||
| 938 | Fset_buffer (buf); | ||
| 939 | if (depth > 0) | ||
| 940 | { | ||
| 941 | if (!NILP (Ffboundp (intern ("fundamental-mode")))) | ||
| 942 | call0 (intern ("fundamental-mode")); | ||
| 943 | } | ||
| 944 | else | ||
| 945 | { | ||
| 946 | if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode")))) | ||
| 947 | call0 (intern ("minibuffer-inactive-mode")); | ||
| 948 | else | ||
| 949 | Fkill_all_local_variables (); | ||
| 950 | } | ||
| 951 | buf = unbind_to (count, buf); | ||
| 952 | } | ||
| 953 | |||
| 929 | /* Return a buffer to be used as the minibuffer at depth `depth'. | 954 | /* Return a buffer to be used as the minibuffer at depth `depth'. |
| 930 | depth = 0 is the lowest allowed argument, and that is the value | 955 | depth = 0 is the lowest allowed argument, and that is the value |
| 931 | used for nonrecursive minibuffer invocations. */ | 956 | used for nonrecursive minibuffer invocations. */ |
| @@ -946,28 +971,21 @@ get_minibuffer (EMACS_INT depth) | |||
| 946 | char name[sizeof name_fmt + INT_STRLEN_BOUND (EMACS_INT)]; | 971 | char name[sizeof name_fmt + INT_STRLEN_BOUND (EMACS_INT)]; |
| 947 | AUTO_STRING_WITH_LEN (lname, name, sprintf (name, name_fmt, depth)); | 972 | AUTO_STRING_WITH_LEN (lname, name, sprintf (name, name_fmt, depth)); |
| 948 | buf = Fget_buffer_create (lname, Qnil); | 973 | buf = Fget_buffer_create (lname, Qnil); |
| 949 | 974 | /* Do this before set_minibuffer_mode. */ | |
| 975 | XSETCAR (tail, buf); | ||
| 976 | set_minibuffer_mode (buf, depth); | ||
| 950 | /* Although the buffer's name starts with a space, undo should be | 977 | /* Although the buffer's name starts with a space, undo should be |
| 951 | enabled in it. */ | 978 | enabled in it. */ |
| 952 | Fbuffer_enable_undo (buf); | 979 | Fbuffer_enable_undo (buf); |
| 953 | |||
| 954 | XSETCAR (tail, buf); | ||
| 955 | } | 980 | } |
| 956 | else | 981 | else |
| 957 | { | 982 | { |
| 958 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 959 | /* We have to empty both overlay lists. Otherwise we end | 983 | /* We have to empty both overlay lists. Otherwise we end |
| 960 | up with overlays that think they belong to this buffer | 984 | up with overlays that think they belong to this buffer |
| 961 | while the buffer doesn't know about them any more. */ | 985 | while the buffer doesn't know about them any more. */ |
| 962 | delete_all_overlays (XBUFFER (buf)); | 986 | delete_all_overlays (XBUFFER (buf)); |
| 963 | reset_buffer (XBUFFER (buf)); | 987 | reset_buffer (XBUFFER (buf)); |
| 964 | record_unwind_current_buffer (); | 988 | set_minibuffer_mode (buf, depth); |
| 965 | Fset_buffer (buf); | ||
| 966 | if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode")))) | ||
| 967 | call0 (intern ("minibuffer-inactive-mode")); | ||
| 968 | else | ||
| 969 | Fkill_all_local_variables (); | ||
| 970 | buf = unbind_to (count, buf); | ||
| 971 | } | 989 | } |
| 972 | 990 | ||
| 973 | return buf; | 991 | return buf; |
diff --git a/src/nsfns.m b/src/nsfns.m index c383e2f7ecf..5c4cc915e7c 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -482,7 +482,7 @@ ns_set_represented_filename (struct frame *f) | |||
| 482 | #if defined (NS_IMPL_COCOA) && defined (MAC_OS_X_VERSION_10_7) | 482 | #if defined (NS_IMPL_COCOA) && defined (MAC_OS_X_VERSION_10_7) |
| 483 | /* Work around for Mach port leaks on macOS 10.15 (bug#38618). */ | 483 | /* Work around for Mach port leaks on macOS 10.15 (bug#38618). */ |
| 484 | NSURL *fileURL = [NSURL fileURLWithPath:fstr isDirectory:NO]; | 484 | NSURL *fileURL = [NSURL fileURLWithPath:fstr isDirectory:NO]; |
| 485 | NSNumber *isUbiquitousItem = @YES; | 485 | NSNumber *isUbiquitousItem = [NSNumber numberWithBool:YES]; |
| 486 | [fileURL getResourceValue:(id *)&isUbiquitousItem | 486 | [fileURL getResourceValue:(id *)&isUbiquitousItem |
| 487 | forKey:NSURLIsUbiquitousItemKey | 487 | forKey:NSURLIsUbiquitousItemKey |
| 488 | error:nil]; | 488 | error:nil]; |
| @@ -690,17 +690,24 @@ ns_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 690 | static void | 690 | static void |
| 691 | ns_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 691 | ns_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 | ||
| 706 | static void | 713 | static 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/nsmenu.m b/src/nsmenu.m index f8219d27026..24aa5a0ac11 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -405,7 +405,7 @@ ns_update_menubar (struct frame *f, bool deep_p) | |||
| 405 | frame's menus have changed, and the *step representation should be updated | 405 | frame's menus have changed, and the *step representation should be updated |
| 406 | from Lisp. */ | 406 | from Lisp. */ |
| 407 | void | 407 | void |
| 408 | set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | 408 | set_frame_menubar (struct frame *f, bool deep_p) |
| 409 | { | 409 | { |
| 410 | ns_update_menubar (f, deep_p); | 410 | ns_update_menubar (f, deep_p); |
| 411 | } | 411 | } |
| @@ -1795,7 +1795,7 @@ DEFUN ("ns-reset-menu", Fns_reset_menu, Sns_reset_menu, 0, 0, 0, | |||
| 1795 | doc: /* Cause the NS menu to be re-calculated. */) | 1795 | doc: /* Cause the NS menu to be re-calculated. */) |
| 1796 | (void) | 1796 | (void) |
| 1797 | { | 1797 | { |
| 1798 | set_frame_menubar (SELECTED_FRAME (), 1, 0); | 1798 | set_frame_menubar (SELECTED_FRAME (), 0); |
| 1799 | return Qnil; | 1799 | return Qnil; |
| 1800 | } | 1800 | } |
| 1801 | 1801 | ||
diff --git a/src/w32fns.c b/src/w32fns.c index e93a0b85d93..86c3db64e7b 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1561,8 +1561,14 @@ w32_clear_under_internal_border (struct frame *f) | |||
| 1561 | static void | 1561 | static void |
| 1562 | w32_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 1562 | w32_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 | { |
| @@ -1637,7 +1643,7 @@ w32_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1637 | if (!old) | 1643 | if (!old) |
| 1638 | /* Make menu bar when there was none. Emacs 25 waited until | 1644 | /* Make menu bar when there was none. Emacs 25 waited until |
| 1639 | the next redisplay for this to take effect. */ | 1645 | the next redisplay for this to take effect. */ |
| 1640 | set_frame_menubar (f, false, true); | 1646 | set_frame_menubar (f, true); |
| 1641 | else | 1647 | else |
| 1642 | { | 1648 | { |
| 1643 | /* Remove menu bar. */ | 1649 | /* Remove menu bar. */ |
| @@ -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/w32menu.c b/src/w32menu.c index 8bf0c462030..3bf76663947 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -155,7 +155,7 @@ w32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 155 | void | 155 | void |
| 156 | w32_activate_menubar (struct frame *f) | 156 | w32_activate_menubar (struct frame *f) |
| 157 | { | 157 | { |
| 158 | set_frame_menubar (f, false, true); | 158 | set_frame_menubar (f, true); |
| 159 | 159 | ||
| 160 | /* Lock out further menubar changes while active. */ | 160 | /* Lock out further menubar changes while active. */ |
| 161 | f->output_data.w32->menubar_active = 1; | 161 | f->output_data.w32->menubar_active = 1; |
| @@ -258,12 +258,10 @@ menubar_selection_callback (struct frame *f, void * client_data) | |||
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | 260 | ||
| 261 | /* Set the contents of the menubar widgets of frame F. | 261 | /* Set the contents of the menubar widgets of frame F. */ |
| 262 | The argument FIRST_TIME is currently ignored; | ||
| 263 | it is set the first time this is called, from initialize_frame_menubar. */ | ||
| 264 | 262 | ||
| 265 | void | 263 | void |
| 266 | set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | 264 | set_frame_menubar (struct frame *f, bool deep_p) |
| 267 | { | 265 | { |
| 268 | HMENU menubar_widget = f->output_data.w32->menubar_widget; | 266 | HMENU menubar_widget = f->output_data.w32->menubar_widget; |
| 269 | Lisp_Object items; | 267 | Lisp_Object items; |
| @@ -511,7 +509,7 @@ initialize_frame_menubar (struct frame *f) | |||
| 511 | /* This function is called before the first chance to redisplay | 509 | /* This function is called before the first chance to redisplay |
| 512 | the frame. It has to be, so the frame will have the right size. */ | 510 | the frame. It has to be, so the frame will have the right size. */ |
| 513 | fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); | 511 | fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); |
| 514 | set_frame_menubar (f, true, true); | 512 | set_frame_menubar (f, true); |
| 515 | } | 513 | } |
| 516 | 514 | ||
| 517 | /* Get rid of the menu bar of frame F, and free its storage. | 515 | /* Get rid of the menu bar of frame F, and free its storage. |
diff --git a/src/xdisp.c b/src/xdisp.c index 11b9e1becfd..fb8eaf4b967 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10706,6 +10706,7 @@ include the height of both, if present, in the return value. */) | |||
| 10706 | 10706 | ||
| 10707 | itdata = bidi_shelve_cache (); | 10707 | itdata = bidi_shelve_cache (); |
| 10708 | start_display (&it, w, startp); | 10708 | start_display (&it, w, startp); |
| 10709 | int start_y = it.current_y; | ||
| 10709 | /* It makes no sense to measure dimensions of region of text that | 10710 | /* It makes no sense to measure dimensions of region of text that |
| 10710 | crosses the point where bidi reordering changes scan direction. | 10711 | crosses the point where bidi reordering changes scan direction. |
| 10711 | By using unidirectional movement here we at least support the use | 10712 | By using unidirectional movement here we at least support the use |
| @@ -10714,8 +10715,23 @@ include the height of both, if present, in the return value. */) | |||
| 10714 | same directionality. */ | 10715 | same directionality. */ |
| 10715 | it.bidi_p = false; | 10716 | it.bidi_p = false; |
| 10716 | 10717 | ||
| 10718 | /* Start at the beginning of the line containing FROM. Otherwise | ||
| 10719 | IT.current_x will be incorrectly set to zero at some arbitrary | ||
| 10720 | non-zero X coordinate. */ | ||
| 10721 | reseat_at_previous_visible_line_start (&it); | ||
| 10722 | it.current_x = it.hpos = 0; | ||
| 10723 | if (IT_CHARPOS (it) != start) | ||
| 10724 | move_it_to (&it, start, -1, -1, -1, MOVE_TO_POS); | ||
| 10725 | |||
| 10726 | /* Now move to TO. */ | ||
| 10727 | int start_x = it.current_x; | ||
| 10717 | int move_op = MOVE_TO_POS | MOVE_TO_Y; | 10728 | int move_op = MOVE_TO_POS | MOVE_TO_Y; |
| 10718 | int to_x = -1; | 10729 | int to_x = -1; |
| 10730 | it.current_y = start_y; | ||
| 10731 | /* If FROM is on a newline, pretend that we start at the beginning | ||
| 10732 | of the next line, because the newline takes no place on display. */ | ||
| 10733 | if (FETCH_BYTE (start) == '\n') | ||
| 10734 | it.current_x = 0; | ||
| 10719 | if (!NILP (x_limit)) | 10735 | if (!NILP (x_limit)) |
| 10720 | { | 10736 | { |
| 10721 | it.last_visible_x = max_x; | 10737 | it.last_visible_x = max_x; |
| @@ -10758,8 +10774,14 @@ include the height of both, if present, in the return value. */) | |||
| 10758 | x = max_x; | 10774 | x = max_x; |
| 10759 | } | 10775 | } |
| 10760 | 10776 | ||
| 10761 | /* Subtract height of header-line which was counted automatically by | 10777 | /* If text spans more than one screen line, we don't need to adjust |
| 10762 | start_display. */ | 10778 | the x-span for start_x, since the second and subsequent lines |
| 10779 | will begin at zero X coordinate. */ | ||
| 10780 | if (it.current_y > start_y) | ||
| 10781 | start_x = 0; | ||
| 10782 | |||
| 10783 | /* Subtract height of header-line and tab-line which was counted | ||
| 10784 | automatically by start_display. */ | ||
| 10763 | y = it.current_y + it.max_ascent + it.max_descent | 10785 | y = it.current_y + it.max_ascent + it.max_descent |
| 10764 | - WINDOW_TAB_LINE_HEIGHT (w) - WINDOW_HEADER_LINE_HEIGHT (w); | 10786 | - WINDOW_TAB_LINE_HEIGHT (w) - WINDOW_HEADER_LINE_HEIGHT (w); |
| 10765 | /* Don't return more than Y-LIMIT. */ | 10787 | /* Don't return more than Y-LIMIT. */ |
| @@ -10786,7 +10808,7 @@ include the height of both, if present, in the return value. */) | |||
| 10786 | if (old_b) | 10808 | if (old_b) |
| 10787 | set_buffer_internal (old_b); | 10809 | set_buffer_internal (old_b); |
| 10788 | 10810 | ||
| 10789 | return Fcons (make_fixnum (x), make_fixnum (y)); | 10811 | return Fcons (make_fixnum (x - start_x), make_fixnum (y)); |
| 10790 | } | 10812 | } |
| 10791 | 10813 | ||
| 10792 | /*********************************************************************** | 10814 | /*********************************************************************** |
| @@ -12876,7 +12898,7 @@ update_menu_bar (struct frame *f, bool save_match_data, bool hooks_run) | |||
| 12876 | the selected frame should be allowed to set it. */ | 12898 | the selected frame should be allowed to set it. */ |
| 12877 | if (f == SELECTED_FRAME ()) | 12899 | if (f == SELECTED_FRAME ()) |
| 12878 | #endif | 12900 | #endif |
| 12879 | set_frame_menubar (f, false, false); | 12901 | set_frame_menubar (f, false); |
| 12880 | } | 12902 | } |
| 12881 | else | 12903 | else |
| 12882 | /* On a terminal screen, the menu bar is an ordinary screen | 12904 | /* On a terminal screen, the menu bar is an ordinary screen |
| @@ -19430,8 +19452,11 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) | |||
| 19430 | 'start_display' again. */ | 19452 | 'start_display' again. */ |
| 19431 | ptrdiff_t it_charpos = IT_CHARPOS (it); | 19453 | ptrdiff_t it_charpos = IT_CHARPOS (it); |
| 19432 | 19454 | ||
| 19433 | /* Don't let the cursor end in the scroll margins. */ | 19455 | /* Don't let the cursor end in the scroll margins. However, when |
| 19456 | the window is vscrolled, we leave it to vscroll to handle the | ||
| 19457 | margins, see window_scroll_pixel_based. */ | ||
| 19434 | if ((flags & TRY_WINDOW_CHECK_MARGINS) | 19458 | if ((flags & TRY_WINDOW_CHECK_MARGINS) |
| 19459 | && w->vscroll == 0 | ||
| 19435 | && !MINI_WINDOW_P (w)) | 19460 | && !MINI_WINDOW_P (w)) |
| 19436 | { | 19461 | { |
| 19437 | int top_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); | 19462 | int top_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); |
| @@ -19440,7 +19465,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) | |||
| 19440 | top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w); | 19465 | top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w); |
| 19441 | start_display (&it, w, pos); | 19466 | start_display (&it, w, pos); |
| 19442 | 19467 | ||
| 19443 | if ((w->cursor.y >= 0 /* not vscrolled */ | 19468 | if ((w->cursor.y >= 0 |
| 19444 | && w->cursor.y < top_scroll_margin | 19469 | && w->cursor.y < top_scroll_margin |
| 19445 | && CHARPOS (pos) > BEGV) | 19470 | && CHARPOS (pos) > BEGV) |
| 19446 | /* rms: considering make_cursor_line_fully_visible_p here | 19471 | /* rms: considering make_cursor_line_fully_visible_p here |
| @@ -26969,6 +26994,15 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 26969 | return ""; | 26994 | return ""; |
| 26970 | } | 26995 | } |
| 26971 | 26996 | ||
| 26997 | /* Return the number of lines between start_byte and end_byte in the | ||
| 26998 | current buffer. */ | ||
| 26999 | |||
| 27000 | ptrdiff_t | ||
| 27001 | count_lines (ptrdiff_t start_byte, ptrdiff_t end_byte) | ||
| 27002 | { | ||
| 27003 | ptrdiff_t ignored; | ||
| 27004 | return display_count_lines (start_byte, end_byte, ZV, &ignored); | ||
| 27005 | } | ||
| 26972 | 27006 | ||
| 26973 | /* Count up to COUNT lines starting from START_BYTE. COUNT negative | 27007 | /* Count up to COUNT lines starting from START_BYTE. COUNT negative |
| 26974 | means count lines back from START_BYTE. But don't go beyond | 27008 | means count lines back from START_BYTE. But don't go beyond |
| @@ -35101,7 +35135,8 @@ of your window manager. */); | |||
| 35101 | This dynamically changes the tab-bar's height to the minimum height | 35135 | This dynamically changes the tab-bar's height to the minimum height |
| 35102 | that is needed to make all tab-bar items visible. | 35136 | that is needed to make all tab-bar items visible. |
| 35103 | If value is `grow-only', the tab-bar's height is only increased | 35137 | If value is `grow-only', the tab-bar's height is only increased |
| 35104 | automatically; to decrease the tab-bar height, use \\[recenter]. */); | 35138 | automatically; to decrease the tab-bar height, use \\[recenter], |
| 35139 | after setting `recenter-redisplay' to the value of t. */); | ||
| 35105 | Vauto_resize_tab_bars = Qt; | 35140 | Vauto_resize_tab_bars = Qt; |
| 35106 | 35141 | ||
| 35107 | DEFVAR_BOOL ("auto-raise-tab-bar-buttons", auto_raise_tab_bar_buttons_p, | 35142 | DEFVAR_BOOL ("auto-raise-tab-bar-buttons", auto_raise_tab_bar_buttons_p, |
| @@ -35113,7 +35148,8 @@ automatically; to decrease the tab-bar height, use \\[recenter]. */); | |||
| 35113 | This dynamically changes the tool-bar's height to the minimum height | 35148 | This dynamically changes the tool-bar's height to the minimum height |
| 35114 | that is needed to make all tool-bar items visible. | 35149 | that is needed to make all tool-bar items visible. |
| 35115 | If value is `grow-only', the tool-bar's height is only increased | 35150 | If value is `grow-only', the tool-bar's height is only increased |
| 35116 | automatically; to decrease the tool-bar height, use \\[recenter]. */); | 35151 | automatically; to decrease the tool-bar height, use \\[recenter], |
| 35152 | after setting `recenter-redisplay' to the value of t. */); | ||
| 35117 | Vauto_resize_tool_bars = Qt; | 35153 | Vauto_resize_tool_bars = Qt; |
| 35118 | 35154 | ||
| 35119 | DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p, | 35155 | DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p, |
diff --git a/src/xfaces.c b/src/xfaces.c index 12087138e51..4b020001c31 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -289,7 +289,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 289 | /* Size of hash table of realized faces in face caches (should be a | 289 | /* Size of hash table of realized faces in face caches (should be a |
| 290 | prime number). */ | 290 | prime number). */ |
| 291 | 291 | ||
| 292 | #define FACE_CACHE_BUCKETS_SIZE 1001 | 292 | #define FACE_CACHE_BUCKETS_SIZE 1009 |
| 293 | 293 | ||
| 294 | char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg"; | 294 | char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg"; |
| 295 | 295 | ||
diff --git a/src/xfns.c b/src/xfns.c index cac41ee4856..481ee0e2255 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1803,7 +1803,14 @@ x_change_tool_bar_height (struct frame *f, int height) | |||
| 1803 | static void | 1803 | static void |
| 1804 | x_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 1804 | x_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), |
diff --git a/src/xmenu.c b/src/xmenu.c index ea3813a64e2..a83fffbf1ce 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -289,7 +289,7 @@ DEFUN ("x-menu-bar-open-internal", Fx_menu_bar_open_internal, Sx_menu_bar_open_i | |||
| 289 | block_input (); | 289 | block_input (); |
| 290 | 290 | ||
| 291 | if (FRAME_EXTERNAL_MENU_BAR (f)) | 291 | if (FRAME_EXTERNAL_MENU_BAR (f)) |
| 292 | set_frame_menubar (f, false, true); | 292 | set_frame_menubar (f, true); |
| 293 | 293 | ||
| 294 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; | 294 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; |
| 295 | if (menubar) | 295 | if (menubar) |
| @@ -368,7 +368,7 @@ If FRAME is nil or not given, use the selected frame. */) | |||
| 368 | f = decode_window_system_frame (frame); | 368 | f = decode_window_system_frame (frame); |
| 369 | 369 | ||
| 370 | if (FRAME_EXTERNAL_MENU_BAR (f)) | 370 | if (FRAME_EXTERNAL_MENU_BAR (f)) |
| 371 | set_frame_menubar (f, false, true); | 371 | set_frame_menubar (f, true); |
| 372 | 372 | ||
| 373 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; | 373 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; |
| 374 | if (menubar) | 374 | if (menubar) |
| @@ -433,7 +433,7 @@ x_activate_menubar (struct frame *f) | |||
| 433 | return; | 433 | return; |
| 434 | #endif | 434 | #endif |
| 435 | 435 | ||
| 436 | set_frame_menubar (f, false, true); | 436 | set_frame_menubar (f, true); |
| 437 | block_input (); | 437 | block_input (); |
| 438 | popup_activated_flag = 1; | 438 | popup_activated_flag = 1; |
| 439 | #ifdef USE_GTK | 439 | #ifdef USE_GTK |
| @@ -677,12 +677,10 @@ apply_systemfont_to_menu (struct frame *f, Widget w) | |||
| 677 | 677 | ||
| 678 | #endif | 678 | #endif |
| 679 | 679 | ||
| 680 | /* Set the contents of the menubar widgets of frame F. | 680 | /* Set the contents of the menubar widgets of frame F. */ |
| 681 | The argument FIRST_TIME is currently ignored; | ||
| 682 | it is set the first time this is called, from initialize_frame_menubar. */ | ||
| 683 | 681 | ||
| 684 | void | 682 | void |
| 685 | set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | 683 | set_frame_menubar (struct frame *f, bool deep_p) |
| 686 | { | 684 | { |
| 687 | xt_or_gtk_widget menubar_widget, old_widget; | 685 | xt_or_gtk_widget menubar_widget, old_widget; |
| 688 | #ifdef USE_X_TOOLKIT | 686 | #ifdef USE_X_TOOLKIT |
| @@ -1029,7 +1027,7 @@ initialize_frame_menubar (struct frame *f) | |||
| 1029 | /* This function is called before the first chance to redisplay | 1027 | /* This function is called before the first chance to redisplay |
| 1030 | the frame. It has to be, so the frame will have the right size. */ | 1028 | the frame. It has to be, so the frame will have the right size. */ |
| 1031 | fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); | 1029 | fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); |
| 1032 | set_frame_menubar (f, true, true); | 1030 | set_frame_menubar (f, true); |
| 1033 | } | 1031 | } |
| 1034 | 1032 | ||
| 1035 | 1033 | ||