aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Albinus2026-03-03 16:59:23 +0100
committerMichael Albinus2026-03-03 16:59:23 +0100
commit72a1bda7595d5c4928b3da2801450ebc1e5300ae (patch)
treed78bbb48e0ecc43b740962470b531d7089cde3e9 /src
parentca63ef00afbf3675ed157914f7210f6eeaef85c0 (diff)
parent8670baf06b5baae09a54b84cc06fb726fe5d6ff7 (diff)
downloademacs-72a1bda7595d5c4928b3da2801450ebc1e5300ae.tar.gz
emacs-72a1bda7595d5c4928b3da2801450ebc1e5300ae.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c34
-rw-r--r--src/xdisp.c196
2 files changed, 175 insertions, 55 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 994356b0919..8753bebce9c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -14451,36 +14451,10 @@ function is called to remap that sequence. */);
14451 DEFVAR_BOOL ("multiple-terminals-merge-keyboards", 14451 DEFVAR_BOOL ("multiple-terminals-merge-keyboards",
14452 multiple_terminals_merge_keyboards, 14452 multiple_terminals_merge_keyboards,
14453 doc: /* If non-nil, treat different terminals' keyboards as less isolated. 14453 doc: /* If non-nil, treat different terminals' keyboards as less isolated.
14454 14454If this option is non-nil, Emacs will not enter single-keyboard mode
14455Each terminal displaying Emacs frames has an associated keyboard. 14455when entering a recursive edit. It will still enter single-keyboard
14456Normally, Emacs assumes that these keyboards are physically 14456mode in certain other cases where doing so is necessary for the
14457distinct, so that someone could be typing on one keyboard and 14457operation to work at all. */);
14458someone else typing on another, into different frames on different
14459terminals. In certain situations, however, Emacs enters
14460single-keyboard mode, in which input from all but one keyboard is
14461blocked. This prevents keys typed on one keyboard from interfering
14462with an operation started on another keyboard. The main operation
14463to which this applies is entering a recursive edit, which includes
14464all minibuffer prompting.
14465
14466Single-keyboard mode can be inconvenient when there are distinct
14467terminals and so distinct keyboards, but only one user and one
14468physical keyboard in control of Emacs. This can happen with X
14469forwarding: with a remote Emacs daemon and multiple frames created
14470with a command like `ssh -X daemon-host emacsclient -c', then from
14471the remote Emacs daemon's point of view there is one terminal and
14472one keyboard per `ssh -X daemon-host' command invoked, but in fact a
14473single local X server displays all frames, and there is just one
14474physical keyboard. In this situation, you may prefer to have the
14475different frames behave as though they had been created with
14476\\[make-frame-command]. In that case, starting a recursive edit in \
14477one frame does
14478not mean that keyboard input into other frames is blocked.
14479
14480If this option is non-nil, Emacs will not enter single-keyboard
14481mode when entering a recursive edit. It will still enter
14482single-keyboard mode in certain other cases where doing so is
14483necessary for the operation to work at all. */);
14484 multiple_terminals_merge_keyboards = false; 14458 multiple_terminals_merge_keyboards = false;
14485 14459
14486 pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper); 14460 pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper);
diff --git a/src/xdisp.c b/src/xdisp.c
index c8e4bf0cf10..d73fc331733 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1229,7 +1229,8 @@ static void get_cursor_offset_for_mouse_face (struct window *w,
1229 int *offset); 1229 int *offset);
1230#endif /* HAVE_WINDOW_SYSTEM */ 1230#endif /* HAVE_WINDOW_SYSTEM */
1231 1231
1232static void produce_special_glyphs (struct it *, enum display_element_type); 1232static void produce_special_glyphs (struct it *, enum display_element_type,
1233 bidi_dir_t direction, bool left_edge_p);
1233static void pad_mode_line (struct it *, bool); 1234static void pad_mode_line (struct it *, bool);
1234static void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face, bool); 1235static void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face, bool);
1235static bool coords_in_mouse_face_p (struct window *, int, int); 1236static bool coords_in_mouse_face_p (struct window *, int, int);
@@ -3423,19 +3424,29 @@ init_iterator (struct it *it, struct window *w,
3423 frame parameter. */ 3424 frame parameter. */
3424 if (!it->f->no_special_glyphs) 3425 if (!it->f->no_special_glyphs)
3425 { 3426 {
3427 int width;
3428
3429 /* For each special glyph, we get the dimensions in the L2R and in
3430 the R2L case and use the maximum produced width. This is
3431 because the glyph can come from a different font in each
3432 case. */
3426 if (it->line_wrap == TRUNCATE) 3433 if (it->line_wrap == TRUNCATE)
3427 { 3434 {
3428 /* We will need the truncation glyph. */ 3435 /* We will need the truncation glyph. */
3429 eassert (it->glyph_row == NULL); 3436 eassert (it->glyph_row == NULL);
3430 produce_special_glyphs (it, IT_TRUNCATION); 3437 produce_special_glyphs (it, IT_TRUNCATION, L2R, false);
3431 it->truncation_pixel_width = it->pixel_width; 3438 width = it->pixel_width;
3439 produce_special_glyphs (it, IT_TRUNCATION, R2L, false);
3440 it->truncation_pixel_width = max (width, it->pixel_width);
3432 } 3441 }
3433 else 3442 else
3434 { 3443 {
3435 /* We will need the continuation glyph. */ 3444 /* We will need the continuation glyph. */
3436 eassert (it->glyph_row == NULL); 3445 eassert (it->glyph_row == NULL);
3437 produce_special_glyphs (it, IT_CONTINUATION); 3446 produce_special_glyphs (it, IT_CONTINUATION, L2R, false);
3438 it->continuation_pixel_width = it->pixel_width; 3447 width = it->pixel_width;
3448 produce_special_glyphs (it, IT_CONTINUATION, R2L, false);
3449 it->continuation_pixel_width = max (width, it->pixel_width);
3439 } 3450 }
3440 } 3451 }
3441 3452
@@ -23815,7 +23826,8 @@ insert_left_trunc_glyphs (struct it *it)
23815 truncate_it.glyph_row->used[TEXT_AREA] = 0; 23826 truncate_it.glyph_row->used[TEXT_AREA] = 0;
23816 CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1; 23827 CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1;
23817 truncate_it.object = Qnil; 23828 truncate_it.object = Qnil;
23818 produce_special_glyphs (&truncate_it, IT_TRUNCATION); 23829 produce_special_glyphs (&truncate_it, IT_TRUNCATION,
23830 it->bidi_it.paragraph_dir, true);
23819 23831
23820 /* Overwrite glyphs from IT with truncation glyphs. */ 23832 /* Overwrite glyphs from IT with truncation glyphs. */
23821 if (!it->glyph_row->reversed_p) 23833 if (!it->glyph_row->reversed_p)
@@ -26191,7 +26203,8 @@ display_line (struct it *it, int cursor_vpos)
26191 glyphs like in 20.x. */ 26203 glyphs like in 20.x. */
26192 while (row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] 26204 while (row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]
26193 < row->glyphs[1 + TEXT_AREA]) 26205 < row->glyphs[1 + TEXT_AREA])
26194 produce_special_glyphs (it, IT_CONTINUATION); 26206 produce_special_glyphs (it, IT_CONTINUATION,
26207 it->bidi_it.paragraph_dir, false);
26195 26208
26196 row->continued_p = true; 26209 row->continued_p = true;
26197 it->current_x = x_before; 26210 it->current_x = x_before;
@@ -26246,7 +26259,8 @@ display_line (struct it *it, int cursor_vpos)
26246 if ((row->reversed_p 26259 if ((row->reversed_p
26247 ? WINDOW_LEFT_FRINGE_WIDTH (it->w) 26260 ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
26248 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0) 26261 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0)
26249 produce_special_glyphs (it, IT_CONTINUATION); 26262 produce_special_glyphs (it, IT_CONTINUATION,
26263 it->bidi_it.paragraph_dir, false);
26250 it->continuation_lines_width += it->last_visible_x; 26264 it->continuation_lines_width += it->last_visible_x;
26251 row->ends_in_middle_of_char_p = true; 26265 row->ends_in_middle_of_char_p = true;
26252 row->continued_p = true; 26266 row->continued_p = true;
@@ -26273,7 +26287,8 @@ display_line (struct it *it, int cursor_vpos)
26273 || (row->reversed_p 26287 || (row->reversed_p
26274 ? WINDOW_LEFT_FRINGE_WIDTH (it->w) 26288 ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
26275 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0) 26289 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0)
26276 produce_special_glyphs (it, IT_CONTINUATION); 26290 produce_special_glyphs (it, IT_CONTINUATION,
26291 it->bidi_it.paragraph_dir, false);
26277 row->continued_p = true; 26292 row->continued_p = true;
26278 26293
26279 extend_face_to_end_of_line (it); 26294 extend_face_to_end_of_line (it);
@@ -26463,13 +26478,15 @@ display_line (struct it *it, int cursor_vpos)
26463 for (n = row->used[TEXT_AREA]; i < n; ++i) 26478 for (n = row->used[TEXT_AREA]; i < n; ++i)
26464 { 26479 {
26465 row->used[TEXT_AREA] = i; 26480 row->used[TEXT_AREA] = i;
26466 produce_special_glyphs (it, IT_TRUNCATION); 26481 produce_special_glyphs (it, IT_TRUNCATION,
26482 it->bidi_it.paragraph_dir, false);
26467 } 26483 }
26468 } 26484 }
26469 else 26485 else
26470 { 26486 {
26471 row->used[TEXT_AREA] = i; 26487 row->used[TEXT_AREA] = i;
26472 produce_special_glyphs (it, IT_TRUNCATION); 26488 produce_special_glyphs (it, IT_TRUNCATION,
26489 it->bidi_it.paragraph_dir, false);
26473 } 26490 }
26474 it->hpos = hpos_before; 26491 it->hpos = hpos_before;
26475 } 26492 }
@@ -29988,10 +30005,13 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
29988 if (row->mode_line_p) 30005 if (row->mode_line_p)
29989 pad_mode_line (it, mode_line_p); 30006 pad_mode_line (it, mode_line_p);
29990 else 30007 else
29991 produce_special_glyphs (it, IT_TRUNCATION); 30008 produce_special_glyphs (it, IT_TRUNCATION,
30009 it->bidi_it.paragraph_dir,
30010 false);
29992 } 30011 }
29993 } 30012 }
29994 produce_special_glyphs (it, IT_TRUNCATION); 30013 produce_special_glyphs (it, IT_TRUNCATION,
30014 it->bidi_it.paragraph_dir, false);
29995 } 30015 }
29996 row->truncated_on_right_p = true; 30016 row->truncated_on_right_p = true;
29997 } 30017 }
@@ -32785,17 +32805,20 @@ produce_stretch_glyph (struct it *it)
32785 it->nglyphs = width; 32805 it->nglyphs = width;
32786} 32806}
32787 32807
32788/* Get information about special display element WHAT in an 32808/* Get information about special display element WHAT in an environment
32789 environment described by IT. WHAT is one of IT_TRUNCATION or 32809 described by IT. WHAT is one of IT_TRUNCATION or IT_CONTINUATION.
32790 IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a 32810 Maybe produce glyphs for WHAT if IT has a non-null glyph_row member.
32791 non-null glyph_row member. This function ensures that fields like 32811 DIRECTION is the paragraph direction. LEFT_EDGE_P tells whether the
32792 face_id, c, len of IT are left untouched. */ 32812 glyph is to be produced on the left side of the window. This
32813 function ensures that fields like face_id, c, len of IT are left
32814 untouched. */
32793 32815
32794static void 32816static void
32795produce_special_glyphs (struct it *it, enum display_element_type what) 32817produce_special_glyphs (struct it *it, enum display_element_type what,
32818 bidi_dir_t direction, bool left_edge_p)
32796{ 32819{
32797 struct it temp_it; 32820 struct it temp_it;
32798 Lisp_Object gc; 32821 Lisp_Object gc, val;
32799 GLYPH glyph; 32822 GLYPH glyph;
32800 /* Take face-remapping into consideration. */ 32823 /* Take face-remapping into consideration. */
32801 int face_id = lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID); 32824 int face_id = lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID);
@@ -32807,28 +32830,129 @@ produce_special_glyphs (struct it *it, enum display_element_type what)
32807 if (what == IT_CONTINUATION) 32830 if (what == IT_CONTINUATION)
32808 { 32831 {
32809 /* Continuation glyph. For R2L lines, we mirror it by hand. */ 32832 /* Continuation glyph. For R2L lines, we mirror it by hand. */
32810 if (it->bidi_it.paragraph_dir == R2L) 32833 if (direction == R2L)
32811 SET_GLYPH (glyph, '/', face_id); 32834 SET_GLYPH (glyph, '/', face_id);
32812 else 32835 else
32813 SET_GLYPH (glyph, '\\', face_id); 32836 SET_GLYPH (glyph, '\\', face_id);
32837
32838 /* Is there a display table entry for the continuation glyph? */
32814 if (it->dp 32839 if (it->dp
32815 && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc))) 32840 && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc)))
32816 { 32841 {
32817 /* FIXME: Should we mirror GC for R2L lines? */ 32842 /* Mirror for R2L. */
32818 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); 32843 if (direction == R2L)
32844 {
32845 /* Try bidi mirroring first. */
32846 int c = bidi_mirror_char (GLYPH_CODE_CHAR (gc));
32847
32848 /* If there was no bidi mirroring, try
32849 special_mirror_table. */
32850 if (c == GLYPH_CODE_CHAR (gc))
32851 {
32852 val = CHAR_TABLE_REF (Vspecial_mirror_table,
32853 GLYPH_CODE_CHAR (gc));
32854 if (FIXNUMP (val))
32855 {
32856 c = XFIXNUM (val);
32857
32858 /* If something goes wrong defaults to '/'. */
32859 if (CHAR_VALID_P (c))
32860 SET_GLYPH (glyph, c, face_id);
32861 else
32862 SET_GLYPH (glyph, '/', face_id);
32863 }
32864 }
32865 else
32866 /* Bidi mirroring. */
32867 SET_GLYPH (glyph, c, face_id);
32868 }
32869 else
32870 /* No mirroring. */
32871 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
32872
32873 /* Make sure the glyph face is realized. */
32819 spec_glyph_lookup_face (it->w, &glyph); 32874 spec_glyph_lookup_face (it->w, &glyph);
32875
32876#ifdef HAVE_WINDOW_SYSTEM
32877 /* Adjust face ID for a non-ASCII character. */
32878 if (FRAME_WINDOW_P (it->f))
32879 {
32880 int c = GLYPH_CHAR (glyph);
32881 face_id = GLYPH_FACE (glyph);
32882 /* Find or create the face ID for displaying the
32883 character. */
32884 int new_id = FACE_FOR_CHAR (it->f, FACE_FROM_ID (it->f, face_id),
32885 c, -1, Qnil);
32886 /* Update the face in the glyph. */
32887 SET_GLYPH_FACE (glyph, new_id);
32888 }
32889#endif
32820 } 32890 }
32821 } 32891 }
32822 else if (what == IT_TRUNCATION) 32892 else if (what == IT_TRUNCATION)
32823 { 32893 {
32824 /* Truncation glyph. */ 32894 /* Truncation glyph. */
32825 SET_GLYPH (glyph, '$', face_id); 32895 SET_GLYPH (glyph, '$', face_id);
32896
32897 /* Is there a display table entry for the truncation glyph? */
32826 if (it->dp 32898 if (it->dp
32827 && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc))) 32899 && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc)))
32828 { 32900 {
32829 /* FIXME: Should we mirror GC for R2L lines? */ 32901 /* Mirror for R2L on the right hand side of the window and for
32830 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); 32902 L2R on the left hand side. */
32903 if (((it->bidi_it.paragraph_dir == R2L) && !left_edge_p) ||
32904 ((it->bidi_it.paragraph_dir == L2R) && left_edge_p))
32905 {
32906 /* Try bidi mirroring first. */
32907 int c = bidi_mirror_char (GLYPH_CODE_CHAR (gc));
32908
32909 /* If there was no bidi mirroring, try
32910 special_mirror_table. */
32911 if (c == GLYPH_CODE_CHAR (gc))
32912 {
32913 val = CHAR_TABLE_REF (Vspecial_mirror_table,
32914 GLYPH_CODE_CHAR (gc));
32915 if (FIXNUMP (val))
32916 {
32917 c = XFIXNUM (val);
32918
32919 /* If something goes wrong defaults to '$'. */
32920 if (CHAR_VALID_P (c))
32921 SET_GLYPH (glyph, c, face_id);
32922 else
32923 SET_GLYPH (glyph, '$', face_id);
32924 }
32925 }
32926 else
32927 {
32928 struct face *face = FACE_FROM_ID (it->f, face_id);
32929 int id = FACE_FOR_CHAR (it->f, face, c, -1, Qnil);
32930
32931 /* Bidi mirroring. */
32932 SET_GLYPH (glyph, c, id);
32933 }
32934 }
32935 else
32936 /* No mirroring. */
32937 SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
32938
32939 /* Make sure the glyph face is realized. */
32831 spec_glyph_lookup_face (it->w, &glyph); 32940 spec_glyph_lookup_face (it->w, &glyph);
32941
32942#ifdef HAVE_WINDOW_SYSTEM
32943 /* Adjust face ID for a non-ASCII character. */
32944 if (FRAME_WINDOW_P (it->f))
32945 {
32946 int c = GLYPH_CHAR (glyph);
32947 face_id = GLYPH_FACE (glyph);
32948 /* Find or create the face ID for displaying the
32949 character. */
32950 int new_id = FACE_FOR_CHAR (it->f, FACE_FROM_ID (it->f, face_id),
32951 c, -1, Qnil);
32952 /* Update the face in the glyph. */
32953 SET_GLYPH_FACE (glyph, new_id);
32954 }
32955#endif
32832 } 32956 }
32833 } 32957 }
32834 else 32958 else
@@ -38864,6 +38988,28 @@ display table takes effect; in this case, Emacs does not consult
38864 Fset_char_table_extra_slot (Vglyphless_char_display, make_fixnum (0), 38988 Fset_char_table_extra_slot (Vglyphless_char_display, make_fixnum (0),
38865 Qempty_box); 38989 Qempty_box);
38866 38990
38991 DEFVAR_LISP ("special-mirror-table", Vspecial_mirror_table,
38992 doc: /* Char-table used to mirror special characters.
38993
38994This table is used to mirror special characters (truncation and
38995continuation) under certain conditions. For example, if a user modifies
38996the display table to use a different continuation character like this:
38997
38998(set-display-table-slot standard-display-table 'wrap #x21A9)
38999
39000then, using this table, this character is mirrored accordingly when
39001displaying R2L text. The same applies to the truncation character which
39002is mirrored depending if it appears on the right or on the left hand
39003side of a window.
39004
39005This table comes pre-populated with some Unicode arrow chars but you can
39006customize it by adding a character and its mirror both way like in the
39007following example with the Pilcrow sign:
39008
39009(aset special-mirror-table #xB6 #x204B)
39010(aset special-mirror-table #x204B #xB6) */);
39011 Vspecial_mirror_table = Fmake_char_table (Qnil, Qnil);
39012
38867 DEFVAR_LISP ("debug-on-message", Vdebug_on_message, 39013 DEFVAR_LISP ("debug-on-message", Vdebug_on_message,
38868 doc: /* If non-nil, debug if a message matching this regexp is displayed. */); 39014 doc: /* If non-nil, debug if a message matching this regexp is displayed. */);
38869 Vdebug_on_message = Qnil; 39015 Vdebug_on_message = Qnil;