diff options
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/frame.h | 2 | ||||
| -rw-r--r-- | src/keymap.c | 9 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/lread.c | 114 | ||||
| -rw-r--r-- | src/macros.c | 5 | ||||
| -rw-r--r-- | src/minibuf.c | 64 | ||||
| -rw-r--r-- | src/nsfns.m | 2 | ||||
| -rw-r--r-- | src/nsmenu.m | 4 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32menu.c | 10 | ||||
| -rw-r--r-- | src/xdisp.c | 45 | ||||
| -rw-r--r-- | src/xmenu.c | 14 |
15 files changed, 185 insertions, 103 deletions
diff --git a/src/data.c b/src/data.c index 35a6890b9bd..38cde0ff8b2 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1819,7 +1819,9 @@ a variable local to the current buffer for one particular use, use | |||
| 1819 | while setting up a new major mode, unless they have a `permanent-local' | 1819 | while setting up a new major mode, unless they have a `permanent-local' |
| 1820 | property. | 1820 | property. |
| 1821 | 1821 | ||
| 1822 | The function `default-value' gets the default value and `set-default' sets it. */) | 1822 | The function `default-value' gets the default value and `set-default' sets it. |
| 1823 | |||
| 1824 | See also `defvar-local'. */) | ||
| 1823 | (register Lisp_Object variable) | 1825 | (register Lisp_Object variable) |
| 1824 | { | 1826 | { |
| 1825 | struct Lisp_Symbol *sym; | 1827 | 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 5bf3faebc85..3aff3b56d52 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -818,6 +818,8 @@ The optional argument DOCSTRING is a documentation string for the | |||
| 818 | variable. | 818 | variable. |
| 819 | 819 | ||
| 820 | To define a user option, use `defcustom' instead of `defvar'. | 820 | To define a user option, use `defcustom' instead of `defvar'. |
| 821 | |||
| 822 | To define a buffer-local variable, use `defvar-local'. | ||
| 821 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | 823 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) |
| 822 | (Lisp_Object args) | 824 | (Lisp_Object args) |
| 823 | { | 825 | { |
diff --git a/src/frame.h b/src/frame.h index a80d2a1f5ae..47ee6a832fb 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1716,7 +1716,7 @@ extern Lisp_Object gui_display_get_resource (Display_Info *, | |||
| 1716 | Lisp_Object component, | 1716 | Lisp_Object component, |
| 1717 | Lisp_Object subclass); | 1717 | Lisp_Object subclass); |
| 1718 | 1718 | ||
| 1719 | extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p); | 1719 | extern void set_frame_menubar (struct frame *f, bool deep_p); |
| 1720 | extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); | 1720 | extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); |
| 1721 | extern void free_frame_menubar (struct frame *); | 1721 | extern void free_frame_menubar (struct frame *); |
| 1722 | extern bool frame_ancestor_p (struct frame *af, struct frame *df); | 1722 | 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 f6588685443..409a1e70608 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3734,6 +3734,7 @@ extern void message_log_maybe_newline (void); | |||
| 3734 | extern void update_echo_area (void); | 3734 | extern void update_echo_area (void); |
| 3735 | extern void truncate_echo_area (ptrdiff_t); | 3735 | extern void truncate_echo_area (ptrdiff_t); |
| 3736 | extern void redisplay (void); | 3736 | extern void redisplay (void); |
| 3737 | extern ptrdiff_t count_lines (ptrdiff_t start_byte, ptrdiff_t end_byte); | ||
| 3737 | 3738 | ||
| 3738 | void set_frame_cursor_types (struct frame *, Lisp_Object); | 3739 | void set_frame_cursor_types (struct frame *, Lisp_Object); |
| 3739 | extern void syms_of_xdisp (void); | 3740 | extern void syms_of_xdisp (void); |
diff --git a/src/lread.c b/src/lread.c index 72b68df6631..010194c34ea 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 | ||
| @@ -2330,16 +2365,6 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) | |||
| 2330 | } | 2365 | } |
| 2331 | 2366 | ||
| 2332 | 2367 | ||
| 2333 | /* Signal Qinvalid_read_syntax error. | ||
| 2334 | S is error string of length N (if > 0) */ | ||
| 2335 | |||
| 2336 | static AVOID | ||
| 2337 | invalid_syntax (const char *s) | ||
| 2338 | { | ||
| 2339 | xsignal1 (Qinvalid_read_syntax, build_string (s)); | ||
| 2340 | } | ||
| 2341 | |||
| 2342 | |||
| 2343 | /* Use this for recursive reads, in contexts where internal tokens | 2368 | /* Use this for recursive reads, in contexts where internal tokens |
| 2344 | are not allowed. */ | 2369 | are not allowed. */ |
| 2345 | 2370 | ||
| @@ -2353,8 +2378,8 @@ read0 (Lisp_Object readcharfun) | |||
| 2353 | if (!c) | 2378 | if (!c) |
| 2354 | return val; | 2379 | return val; |
| 2355 | 2380 | ||
| 2356 | xsignal1 (Qinvalid_read_syntax, | 2381 | invalid_syntax_lisp (Fmake_string (make_fixnum (1), make_fixnum (c), Qnil), |
| 2357 | Fmake_string (make_fixnum (1), make_fixnum (c), Qnil)); | 2382 | readcharfun); |
| 2358 | } | 2383 | } |
| 2359 | 2384 | ||
| 2360 | /* Grow a read buffer BUF that contains OFFSET useful bytes of data, | 2385 | /* Grow a read buffer BUF that contains OFFSET useful bytes of data, |
| @@ -2384,7 +2409,8 @@ grow_read_buffer (char *buf, ptrdiff_t offset, | |||
| 2384 | /* Return the scalar value that has the Unicode character name NAME. | 2409 | /* Return the scalar value that has the Unicode character name NAME. |
| 2385 | Raise 'invalid-read-syntax' if there is no such character. */ | 2410 | Raise 'invalid-read-syntax' if there is no such character. */ |
| 2386 | static int | 2411 | static int |
| 2387 | character_name_to_code (char const *name, ptrdiff_t name_len) | 2412 | character_name_to_code (char const *name, ptrdiff_t name_len, |
| 2413 | Lisp_Object readcharfun) | ||
| 2388 | { | 2414 | { |
| 2389 | /* For "U+XXXX", pass the leading '+' to string_to_number to reject | 2415 | /* For "U+XXXX", pass the leading '+' to string_to_number to reject |
| 2390 | monstrosities like "U+-0000". */ | 2416 | monstrosities like "U+-0000". */ |
| @@ -2400,7 +2426,7 @@ character_name_to_code (char const *name, ptrdiff_t name_len) | |||
| 2400 | { | 2426 | { |
| 2401 | AUTO_STRING (format, "\\N{%s}"); | 2427 | AUTO_STRING (format, "\\N{%s}"); |
| 2402 | AUTO_STRING_WITH_LEN (namestr, name, name_len); | 2428 | AUTO_STRING_WITH_LEN (namestr, name, name_len); |
| 2403 | xsignal1 (Qinvalid_read_syntax, CALLN (Fformat, format, namestr)); | 2429 | invalid_syntax_lisp (CALLN (Fformat, format, namestr), readcharfun); |
| 2404 | } | 2430 | } |
| 2405 | 2431 | ||
| 2406 | return XFIXNUM (code); | 2432 | return XFIXNUM (code); |
| @@ -2619,7 +2645,7 @@ read_escape (Lisp_Object readcharfun, bool stringp) | |||
| 2619 | { | 2645 | { |
| 2620 | c = READCHAR; | 2646 | c = READCHAR; |
| 2621 | if (c != '{') | 2647 | if (c != '{') |
| 2622 | invalid_syntax ("Expected opening brace after \\N"); | 2648 | invalid_syntax ("Expected opening brace after \\N", readcharfun); |
| 2623 | char name[UNICODE_CHARACTER_NAME_LENGTH_BOUND + 1]; | 2649 | char name[UNICODE_CHARACTER_NAME_LENGTH_BOUND + 1]; |
| 2624 | bool whitespace = false; | 2650 | bool whitespace = false; |
| 2625 | ptrdiff_t length = 0; | 2651 | ptrdiff_t length = 0; |
| @@ -2634,8 +2660,9 @@ read_escape (Lisp_Object readcharfun, bool stringp) | |||
| 2634 | { | 2660 | { |
| 2635 | AUTO_STRING (format, | 2661 | AUTO_STRING (format, |
| 2636 | "Invalid character U+%04X in character name"); | 2662 | "Invalid character U+%04X in character name"); |
| 2637 | xsignal1 (Qinvalid_read_syntax, | 2663 | invalid_syntax_lisp (CALLN (Fformat, format, |
| 2638 | CALLN (Fformat, format, make_fixed_natnum (c))); | 2664 | make_fixed_natnum (c)), |
| 2665 | readcharfun); | ||
| 2639 | } | 2666 | } |
| 2640 | /* Treat multiple adjacent whitespace characters as a | 2667 | /* Treat multiple adjacent whitespace characters as a |
| 2641 | single space character. This makes it easier to use | 2668 | single space character. This makes it easier to use |
| @@ -2651,15 +2678,15 @@ read_escape (Lisp_Object readcharfun, bool stringp) | |||
| 2651 | whitespace = false; | 2678 | whitespace = false; |
| 2652 | name[length++] = c; | 2679 | name[length++] = c; |
| 2653 | if (length >= sizeof name) | 2680 | if (length >= sizeof name) |
| 2654 | invalid_syntax ("Character name too long"); | 2681 | invalid_syntax ("Character name too long", readcharfun); |
| 2655 | } | 2682 | } |
| 2656 | if (length == 0) | 2683 | if (length == 0) |
| 2657 | invalid_syntax ("Empty character name"); | 2684 | invalid_syntax ("Empty character name", readcharfun); |
| 2658 | name[length] = '\0'; | 2685 | name[length] = '\0'; |
| 2659 | 2686 | ||
| 2660 | /* character_name_to_code can invoke read1, recursively. | 2687 | /* character_name_to_code can invoke read1, recursively. |
| 2661 | This is why read1's buffer is not static. */ | 2688 | This is why read1's buffer is not static. */ |
| 2662 | return character_name_to_code (name, length); | 2689 | return character_name_to_code (name, length, readcharfun); |
| 2663 | } | 2690 | } |
| 2664 | 2691 | ||
| 2665 | default: | 2692 | default: |
| @@ -2697,10 +2724,11 @@ enum { stackbufsize = max (64, | |||
| 2697 | + INT_STRLEN_BOUND (EMACS_INT) + 1)) }; | 2724 | + INT_STRLEN_BOUND (EMACS_INT) + 1)) }; |
| 2698 | 2725 | ||
| 2699 | static void | 2726 | static void |
| 2700 | invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS (stackbufsize)]) | 2727 | invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS (stackbufsize)], |
| 2728 | Lisp_Object readcharfun) | ||
| 2701 | { | 2729 | { |
| 2702 | sprintf (stackbuf, invalid_radix_integer_format, radix); | 2730 | sprintf (stackbuf, invalid_radix_integer_format, radix); |
| 2703 | invalid_syntax (stackbuf); | 2731 | invalid_syntax (stackbuf, readcharfun); |
| 2704 | } | 2732 | } |
| 2705 | 2733 | ||
| 2706 | /* Read an integer in radix RADIX using READCHARFUN to read | 2734 | /* Read an integer in radix RADIX using READCHARFUN to read |
| @@ -2760,7 +2788,7 @@ read_integer (Lisp_Object readcharfun, int radix, | |||
| 2760 | UNREAD (c); | 2788 | UNREAD (c); |
| 2761 | 2789 | ||
| 2762 | if (valid != 1) | 2790 | if (valid != 1) |
| 2763 | invalid_radix_integer (radix, stackbuf); | 2791 | invalid_radix_integer (radix, stackbuf, readcharfun); |
| 2764 | 2792 | ||
| 2765 | *p = '\0'; | 2793 | *p = '\0'; |
| 2766 | return unbind_to (count, string_to_number (read_buffer, radix, NULL)); | 2794 | return unbind_to (count, string_to_number (read_buffer, radix, NULL)); |
| @@ -2896,7 +2924,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2896 | return ht; | 2924 | return ht; |
| 2897 | } | 2925 | } |
| 2898 | UNREAD (c); | 2926 | UNREAD (c); |
| 2899 | invalid_syntax ("#"); | 2927 | invalid_syntax ("#", readcharfun); |
| 2900 | } | 2928 | } |
| 2901 | if (c == '^') | 2929 | if (c == '^') |
| 2902 | { | 2930 | { |
| @@ -2948,9 +2976,9 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2948 | } | 2976 | } |
| 2949 | return tbl; | 2977 | return tbl; |
| 2950 | } | 2978 | } |
| 2951 | invalid_syntax ("#^^"); | 2979 | invalid_syntax ("#^^", readcharfun); |
| 2952 | } | 2980 | } |
| 2953 | invalid_syntax ("#^"); | 2981 | invalid_syntax ("#^", readcharfun); |
| 2954 | } | 2982 | } |
| 2955 | if (c == '&') | 2983 | if (c == '&') |
| 2956 | { | 2984 | { |
| @@ -2973,7 +3001,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2973 | version. */ | 3001 | version. */ |
| 2974 | && ! (XFIXNAT (length) | 3002 | && ! (XFIXNAT (length) |
| 2975 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) | 3003 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) |
| 2976 | invalid_syntax ("#&..."); | 3004 | invalid_syntax ("#&...", readcharfun); |
| 2977 | 3005 | ||
| 2978 | val = make_uninit_bool_vector (XFIXNAT (length)); | 3006 | val = make_uninit_bool_vector (XFIXNAT (length)); |
| 2979 | data = bool_vector_uchar_data (val); | 3007 | data = bool_vector_uchar_data (val); |
| @@ -2984,7 +3012,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2984 | &= (1 << (XFIXNUM (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; | 3012 | &= (1 << (XFIXNUM (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; |
| 2985 | return val; | 3013 | return val; |
| 2986 | } | 3014 | } |
| 2987 | invalid_syntax ("#&..."); | 3015 | invalid_syntax ("#&...", readcharfun); |
| 2988 | } | 3016 | } |
| 2989 | if (c == '[') | 3017 | if (c == '[') |
| 2990 | { | 3018 | { |
| @@ -3002,7 +3030,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3002 | && VECTORP (AREF (tmp, COMPILED_CONSTANTS))) | 3030 | && VECTORP (AREF (tmp, COMPILED_CONSTANTS))) |
| 3003 | || CONSP (AREF (tmp, COMPILED_BYTECODE))) | 3031 | || CONSP (AREF (tmp, COMPILED_BYTECODE))) |
| 3004 | && FIXNATP (AREF (tmp, COMPILED_STACK_DEPTH)))) | 3032 | && FIXNATP (AREF (tmp, COMPILED_STACK_DEPTH)))) |
| 3005 | invalid_syntax ("Invalid byte-code object"); | 3033 | invalid_syntax ("Invalid byte-code object", readcharfun); |
| 3006 | 3034 | ||
| 3007 | if (STRINGP (AREF (tmp, COMPILED_BYTECODE)) | 3035 | if (STRINGP (AREF (tmp, COMPILED_BYTECODE)) |
| 3008 | && STRING_MULTIBYTE (AREF (tmp, COMPILED_BYTECODE))) | 3036 | && STRING_MULTIBYTE (AREF (tmp, COMPILED_BYTECODE))) |
| @@ -3044,7 +3072,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3044 | /* Read the string itself. */ | 3072 | /* Read the string itself. */ |
| 3045 | tmp = read1 (readcharfun, &ch, 0); | 3073 | tmp = read1 (readcharfun, &ch, 0); |
| 3046 | if (ch != 0 || !STRINGP (tmp)) | 3074 | if (ch != 0 || !STRINGP (tmp)) |
| 3047 | invalid_syntax ("#"); | 3075 | invalid_syntax ("#", readcharfun); |
| 3048 | /* Read the intervals and their properties. */ | 3076 | /* Read the intervals and their properties. */ |
| 3049 | while (1) | 3077 | while (1) |
| 3050 | { | 3078 | { |
| @@ -3059,7 +3087,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3059 | if (ch == 0) | 3087 | if (ch == 0) |
| 3060 | plist = read1 (readcharfun, &ch, 0); | 3088 | plist = read1 (readcharfun, &ch, 0); |
| 3061 | if (ch) | 3089 | if (ch) |
| 3062 | invalid_syntax ("Invalid string property list"); | 3090 | invalid_syntax ("Invalid string property list", readcharfun); |
| 3063 | Fset_text_properties (beg, end, plist, tmp); | 3091 | Fset_text_properties (beg, end, plist, tmp); |
| 3064 | } | 3092 | } |
| 3065 | 3093 | ||
| @@ -3207,7 +3235,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3207 | if (c == 'r' || c == 'R') | 3235 | if (c == 'r' || c == 'R') |
| 3208 | { | 3236 | { |
| 3209 | if (! (2 <= n && n <= 36)) | 3237 | if (! (2 <= n && n <= 36)) |
| 3210 | invalid_radix_integer (n, stackbuf); | 3238 | invalid_radix_integer (n, stackbuf, readcharfun); |
| 3211 | return read_integer (readcharfun, n, stackbuf); | 3239 | return read_integer (readcharfun, n, stackbuf); |
| 3212 | } | 3240 | } |
| 3213 | 3241 | ||
| @@ -3301,7 +3329,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3301 | return read_integer (readcharfun, 2, stackbuf); | 3329 | return read_integer (readcharfun, 2, stackbuf); |
| 3302 | 3330 | ||
| 3303 | UNREAD (c); | 3331 | UNREAD (c); |
| 3304 | invalid_syntax ("#"); | 3332 | invalid_syntax ("#", readcharfun); |
| 3305 | 3333 | ||
| 3306 | case ';': | 3334 | case ';': |
| 3307 | while ((c = READCHAR) >= 0 && c != '\n'); | 3335 | while ((c = READCHAR) >= 0 && c != '\n'); |
| @@ -3373,7 +3401,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3373 | if (ok) | 3401 | if (ok) |
| 3374 | return make_fixnum (c); | 3402 | return make_fixnum (c); |
| 3375 | 3403 | ||
| 3376 | invalid_syntax ("?"); | 3404 | invalid_syntax ("?", readcharfun); |
| 3377 | } | 3405 | } |
| 3378 | 3406 | ||
| 3379 | case '"': | 3407 | case '"': |
| @@ -3459,7 +3487,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3459 | 3487 | ||
| 3460 | /* Any modifiers remaining are invalid. */ | 3488 | /* Any modifiers remaining are invalid. */ |
| 3461 | if (modifiers) | 3489 | if (modifiers) |
| 3462 | invalid_syntax ("Invalid modifier in string"); | 3490 | invalid_syntax ("Invalid modifier in string", readcharfun); |
| 3463 | p += CHAR_STRING (ch, (unsigned char *) p); | 3491 | p += CHAR_STRING (ch, (unsigned char *) p); |
| 3464 | } | 3492 | } |
| 3465 | else | 3493 | else |
| @@ -3999,7 +4027,7 @@ read_list (bool flag, Lisp_Object readcharfun) | |||
| 3999 | { | 4027 | { |
| 4000 | if (ch == ']') | 4028 | if (ch == ']') |
| 4001 | return val; | 4029 | return val; |
| 4002 | invalid_syntax (") or . in a vector"); | 4030 | invalid_syntax (") or . in a vector", readcharfun); |
| 4003 | } | 4031 | } |
| 4004 | if (ch == ')') | 4032 | if (ch == ')') |
| 4005 | return val; | 4033 | return val; |
| @@ -4079,9 +4107,9 @@ read_list (bool flag, Lisp_Object readcharfun) | |||
| 4079 | 4107 | ||
| 4080 | return val; | 4108 | return val; |
| 4081 | } | 4109 | } |
| 4082 | invalid_syntax (". in wrong context"); | 4110 | invalid_syntax (". in wrong context", readcharfun); |
| 4083 | } | 4111 | } |
| 4084 | invalid_syntax ("] in a list"); | 4112 | invalid_syntax ("] in a list", readcharfun); |
| 4085 | } | 4113 | } |
| 4086 | tem = list1 (elt); | 4114 | tem = list1 (elt); |
| 4087 | if (!NILP (tail)) | 4115 | if (!NILP (tail)) |
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..c7857eac731 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]; |
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..5704f1d3c33 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1637,7 +1637,7 @@ w32_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1637 | if (!old) | 1637 | if (!old) |
| 1638 | /* Make menu bar when there was none. Emacs 25 waited until | 1638 | /* Make menu bar when there was none. Emacs 25 waited until |
| 1639 | the next redisplay for this to take effect. */ | 1639 | the next redisplay for this to take effect. */ |
| 1640 | set_frame_menubar (f, false, true); | 1640 | set_frame_menubar (f, true); |
| 1641 | else | 1641 | else |
| 1642 | { | 1642 | { |
| 1643 | /* Remove menu bar. */ | 1643 | /* Remove menu bar. */ |
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 c63a6e5171b..170546001db 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 |
| @@ -26974,6 +26996,15 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 26974 | return ""; | 26996 | return ""; |
| 26975 | } | 26997 | } |
| 26976 | 26998 | ||
| 26999 | /* Return the number of lines between start_byte and end_byte in the | ||
| 27000 | current buffer. */ | ||
| 27001 | |||
| 27002 | ptrdiff_t | ||
| 27003 | count_lines (ptrdiff_t start_byte, ptrdiff_t end_byte) | ||
| 27004 | { | ||
| 27005 | ptrdiff_t ignored; | ||
| 27006 | return display_count_lines (start_byte, end_byte, ZV, &ignored); | ||
| 27007 | } | ||
| 26977 | 27008 | ||
| 26978 | /* Count up to COUNT lines starting from START_BYTE. COUNT negative | 27009 | /* Count up to COUNT lines starting from START_BYTE. COUNT negative |
| 26979 | means count lines back from START_BYTE. But don't go beyond | 27010 | means count lines back from START_BYTE. But don't go beyond |
| @@ -35116,7 +35147,8 @@ of your window manager. */); | |||
| 35116 | This dynamically changes the tab-bar's height to the minimum height | 35147 | This dynamically changes the tab-bar's height to the minimum height |
| 35117 | that is needed to make all tab-bar items visible. | 35148 | that is needed to make all tab-bar items visible. |
| 35118 | If value is `grow-only', the tab-bar's height is only increased | 35149 | If value is `grow-only', the tab-bar's height is only increased |
| 35119 | automatically; to decrease the tab-bar height, use \\[recenter]. */); | 35150 | automatically; to decrease the tab-bar height, use \\[recenter], |
| 35151 | after setting `recenter-redisplay' to the value of t. */); | ||
| 35120 | Vauto_resize_tab_bars = Qt; | 35152 | Vauto_resize_tab_bars = Qt; |
| 35121 | 35153 | ||
| 35122 | DEFVAR_BOOL ("auto-raise-tab-bar-buttons", auto_raise_tab_bar_buttons_p, | 35154 | DEFVAR_BOOL ("auto-raise-tab-bar-buttons", auto_raise_tab_bar_buttons_p, |
| @@ -35128,7 +35160,8 @@ automatically; to decrease the tab-bar height, use \\[recenter]. */); | |||
| 35128 | This dynamically changes the tool-bar's height to the minimum height | 35160 | This dynamically changes the tool-bar's height to the minimum height |
| 35129 | that is needed to make all tool-bar items visible. | 35161 | that is needed to make all tool-bar items visible. |
| 35130 | If value is `grow-only', the tool-bar's height is only increased | 35162 | If value is `grow-only', the tool-bar's height is only increased |
| 35131 | automatically; to decrease the tool-bar height, use \\[recenter]. */); | 35163 | automatically; to decrease the tool-bar height, use \\[recenter], |
| 35164 | after setting `recenter-redisplay' to the value of t. */); | ||
| 35132 | Vauto_resize_tool_bars = Qt; | 35165 | Vauto_resize_tool_bars = Qt; |
| 35133 | 35166 | ||
| 35134 | DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p, | 35167 | DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p, |
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 | ||