summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-04-25 15:30:05 +0900
committerYuuki Harano <masm+github@masm11.me>2021-04-25 15:30:05 +0900
commitb302a551ab50a3d961f438380e9d095870c11a6c (patch)
tree3b230b6c400b766483f997957eb0fbae28fbac89 /src
parentde46c7796e635faf8647a7c6a5ae34fda9adae3b (diff)
parent86d1b4d88f2999d2b0f94619dc53092bddfa0ec0 (diff)
downloademacs-b302a551ab50a3d961f438380e9d095870c11a6c.tar.gz
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'src')
-rw-r--r--src/character.h2
-rw-r--r--src/frame.c15
-rw-r--r--src/keyboard.c2
-rw-r--r--src/keymap.c6
-rw-r--r--src/minibuf.c87
-rw-r--r--src/w32fns.c2
-rw-r--r--src/window.c60
-rw-r--r--src/xdisp.c14
-rw-r--r--src/xfns.c2
9 files changed, 104 insertions, 86 deletions
diff --git a/src/character.h b/src/character.h
index d19e1e2604c..75351cd1edf 100644
--- a/src/character.h
+++ b/src/character.h
@@ -42,7 +42,7 @@ INLINE_HEADER_BEGIN
F9..FF 11111yyy
In each bit pattern, 'x' and 'y' each represent a single bit of the
- character code payload, and least one 'y' must be a 1 bit.
+ character code payload, and at least one 'y' must be a 1 bit.
In the 5-byte sequence, the 22-bit payload cannot exceed 3FFF7F.
*/
diff --git a/src/frame.c b/src/frame.c
index a20c53699ac..648cc65ab81 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1386,7 +1386,8 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
especially when deleting the initial frame during startup. */
CHECK_FRAME (frame);
f = XFRAME (frame);
- if (!FRAME_LIVE_P (f))
+ /* Silently ignore dead and tooltip frames (Bug#47207). */
+ if (!FRAME_LIVE_P (f) || FRAME_TOOLTIP_P (f))
return Qnil;
else if (f == sf)
return frame;
@@ -1510,7 +1511,16 @@ redisplay will display FRAME.
This function returns FRAME, or nil if FRAME has been deleted. */)
(Lisp_Object frame, Lisp_Object norecord)
{
- return do_switch_frame (frame, 1, 0, norecord);
+ struct frame *f;
+
+ CHECK_LIVE_FRAME (frame);
+ f = XFRAME (frame);
+
+ if (FRAME_TOOLTIP_P (f))
+ /* Do not select a tooltip frame (Bug#47207). */
+ error ("Cannot select a tooltip frame");
+ else
+ return do_switch_frame (frame, 1, 0, norecord);
}
DEFUN ("handle-switch-frame", Fhandle_switch_frame,
@@ -1525,6 +1535,7 @@ necessarily represent user-visible input focus. */)
/* Preserve prefix arg that the command loop just cleared. */
kset_prefix_arg (current_kboard, Vcurrent_prefix_arg);
run_hook (Qmouse_leave_buffer_hook);
+
return do_switch_frame (event, 0, 0, Qnil);
}
diff --git a/src/keyboard.c b/src/keyboard.c
index 9cb37c38edc..fe5815b4f9c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2121,7 +2121,7 @@ read_char_help_form_unwind (void)
Lisp_Object window_config = XCAR (help_form_saved_window_configs);
help_form_saved_window_configs = XCDR (help_form_saved_window_configs);
if (!NILP (window_config))
- Fset_window_configuration (window_config, Qnil);
+ Fset_window_configuration (window_config, Qnil, Qnil);
}
#define STOP_POLLING \
diff --git a/src/keymap.c b/src/keymap.c
index bb26b6389d4..fb8eceaec18 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -3148,12 +3148,6 @@ syms_of_keymap (void)
doc: /* Default keymap to use when reading from the minibuffer. */);
Vminibuffer_local_map = Fmake_sparse_keymap (Qnil);
- DEFVAR_LISP ("minibuffer-local-ns-map", Vminibuffer_local_ns_map,
- doc: /* Local keymap for the minibuffer when spaces are not allowed. */);
- Vminibuffer_local_ns_map = Fmake_sparse_keymap (Qnil);
- Fset_keymap_parent (Vminibuffer_local_ns_map, Vminibuffer_local_map);
-
-
DEFVAR_LISP ("minor-mode-map-alist", Vminor_mode_map_alist,
doc: /* Alist of keymaps to use for minor modes.
Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read
diff --git a/src/minibuf.c b/src/minibuf.c
index a3c1b99bf32..c4482d7f1ee 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -567,7 +567,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
in previous recursive minibuffer, but was not set explicitly
to t for this invocation, so set it to nil in this minibuffer.
Save the old value now, before we change it. */
- specbind (intern ("minibuffer-completing-file-name"),
+ specbind (Qminibuffer_completing_file_name,
Vminibuffer_completing_file_name);
if (EQ (Vminibuffer_completing_file_name, Qlambda))
Vminibuffer_completing_file_name = Qnil;
@@ -660,17 +660,14 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
record_unwind_protect_void (minibuffer_unwind);
record_unwind_protect (restore_window_configuration,
- Fcons (Qt, Fcurrent_window_configuration (Qnil)));
+ list3 (Fcurrent_window_configuration (Qnil), Qt, Qt));
/* If the minibuffer window is on a different frame, save that
frame's configuration too. */
if (!EQ (mini_frame, selected_frame))
record_unwind_protect (restore_window_configuration,
- Fcons (/* Arrange for the frame later to be
- switched back to the calling
- frame. */
- Qnil,
- Fcurrent_window_configuration (mini_frame)));
+ list3 (Fcurrent_window_configuration (mini_frame),
+ Qnil, Qt));
/* If the minibuffer is on an iconified or invisible frame,
make it visible now. */
@@ -728,10 +725,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
Vminibuffer_completing_file_name = Qlambda;
/* If variable is unbound, make it nil. */
- histval = find_symbol_value (Vminibuffer_history_variable);
+ histval = find_symbol_value (histvar);
if (EQ (histval, Qunbound))
{
- Fset (Vminibuffer_history_variable, Qnil);
+ Fset (histvar, Qnil);
histval = Qnil;
}
@@ -753,10 +750,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
not work correctly in minibuffers. (Bug#5715, etc) */
bset_truncate_lines (current_buffer, Qnil);
- /* If appropriate, copy enable-multibyte-characters into the minibuffer. */
- if (inherit_input_method)
- bset_enable_multibyte_characters (current_buffer, enable_multibyte);
-
/* The current buffer's default directory is usually the right thing
for our minibuffer here. However, if you're typing a command at
a minibuffer-only frame when minibuf_level is zero, then buf IS
@@ -808,9 +801,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
specbind (Qinhibit_modification_hooks, Qt);
Ferase_buffer ();
- if (!NILP (BVAR (current_buffer, enable_multibyte_characters))
- && ! STRING_MULTIBYTE (minibuf_prompt))
- minibuf_prompt = Fstring_make_multibyte (minibuf_prompt);
+ /* If appropriate, copy enable-multibyte-characters into the minibuffer.
+ In any case don't blindly inherit the multibyteness used previously. */
+ bset_enable_multibyte_characters (current_buffer,
+ inherit_input_method ? enable_multibyte
+ : Qt);
/* Insert the prompt, record where it ends. */
Finsert (1, &minibuf_prompt);
@@ -920,13 +915,13 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
&& !EQ (XWINDOW (XFRAME (calling_frame)->minibuffer_window)
->frame,
calling_frame))))
- call2 (intern ("select-frame-set-input-focus"), calling_frame, Qnil);
+ call2 (Qselect_frame_set_input_focus, calling_frame, Qnil);
/* Add the value to the appropriate history list, if any. This is
done after the previous buffer has been made current again, in
case the history variable is buffer-local. */
if (! (NILP (Vhistory_add_new_input) || NILP (histstring)))
- call2 (intern ("add-to-history"), histvar, histstring);
+ call2 (Qadd_to_history, histvar, histstring);
/* If Lisp form desired instead of string, parse it. */
if (expflag)
@@ -965,13 +960,13 @@ set_minibuffer_mode (Lisp_Object buf, EMACS_INT depth)
Fset_buffer (buf);
if (depth > 0)
{
- if (!NILP (Ffboundp (intern ("fundamental-mode"))))
- call0 (intern ("fundamental-mode"));
+ if (!NILP (Ffboundp (Qminibuffer_mode)))
+ call0 (Qminibuffer_mode);
}
else
{
- if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode"))))
- call0 (intern ("minibuffer-inactive-mode"));
+ if (!NILP (Ffboundp (Qminibuffer_inactive_mode)))
+ call0 (Qminibuffer_inactive_mode);
else
Fkill_all_local_variables ();
}
@@ -1071,13 +1066,13 @@ read_minibuf_unwind (void)
goto found;
}
}
- return; /* expired minibuffer not found. Maybe we should output an
- error, here. */
+ exp_MB_frame = Qnil; /* "Can't happen." */
found:
- if (!EQ (exp_MB_frame, saved_selected_frame))
+ if (!EQ (exp_MB_frame, saved_selected_frame)
+ && !NILP (exp_MB_frame))
do_switch_frame (exp_MB_frame, 0, 0, Qt); /* This also sets
- minibuff_window */
+ minibuf_window */
/* To keep things predictable, in case it matters, let's be in the
minibuffer when we reset the relevant variables. Don't depend on
@@ -1163,7 +1158,7 @@ read_minibuf_unwind (void)
dead, we may keep displaying this buffer (tho it's inactive), so reset it,
to make sure we don't leave around bindings and stuff which only
made sense during the read_minibuf invocation. */
- call0 (intern ("minibuffer-inactive-mode"));
+ call0 (Qminibuffer_inactive_mode);
/* We've exited the recursive edit, so switch the current windows
away from the expired minibuffer window, both in the current
@@ -1187,7 +1182,8 @@ read_minibuf_unwind (void)
}
/* Restore the selected frame. */
- if (!EQ (exp_MB_frame, saved_selected_frame))
+ if (!EQ (exp_MB_frame, saved_selected_frame)
+ && !NILP (exp_MB_frame))
do_switch_frame (saved_selected_frame, 0, 0, Qt);
}
@@ -1202,6 +1198,7 @@ minibuffer_unwind (void)
Lisp_Object window;
Lisp_Object entry;
+ if (NILP (exp_MB_frame)) return; /* "Can't happen." */
f = XFRAME (exp_MB_frame);
window = f->minibuffer_window;
w = XWINDOW (window);
@@ -1362,30 +1359,6 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
return unbind_to (count, val);
}
-DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1, 3, 0,
- doc: /* Read a string from the terminal, not allowing blanks.
-Prompt with PROMPT. Whitespace terminates the input. If INITIAL is
-non-nil, it should be a string, which is used as initial input, with
-point positioned at the end, so that SPACE will accept the input.
-\(Actually, INITIAL can also be a cons of a string and an integer.
-Such values are treated as in `read-from-minibuffer', but are normally
-not useful in this function.)
-
-Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
-the current input method and the setting of`enable-multibyte-characters'.
-
-If `inhibit-interaction' is non-nil, this function will signal an
-`inhibited-interaction' error. */)
- (Lisp_Object prompt, Lisp_Object initial, Lisp_Object inherit_input_method)
-{
- CHECK_STRING (prompt);
- barf_if_interaction_inhibited ();
-
- return read_minibuf (Vminibuffer_local_ns_map, initial, prompt,
- 0, Qminibuffer_history, make_fixnum (0), Qnil, 0,
- !NILP (inherit_input_method));
-}
-
DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
doc: /* Read the name of a command and return as a symbol.
Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element
@@ -2023,7 +1996,8 @@ HIST, if non-nil, specifies a history list and optionally the initial
(This is the only case in which you should use INITIAL-INPUT instead
of DEF.) Positions are counted starting from 1 at the beginning of
the list. The variable `history-length' controls the maximum length
- of a history list.
+ of a history list. If HIST is the symbol `t', history is not
+ recorded.
DEF, if non-nil, is the default value or the list of default values.
@@ -2332,6 +2306,12 @@ syms_of_minibuf (void)
/* A frame parameter. */
DEFSYM (Qminibuffer_exit, "minibuffer-exit");
+ DEFSYM (Qminibuffer_mode, "minibuffer-mode");
+ DEFSYM (Qminibuffer_inactive_mode, "minibuffer-inactive-mode");
+ DEFSYM (Qminibuffer_completing_file_name, "minibuffer-completing-file-name");
+ DEFSYM (Qselect_frame_set_input_focus, "select-frame-set-input-focus");
+ DEFSYM (Qadd_to_history, "add-to-history");
+
DEFVAR_LISP ("read-expression-history", Vread_expression_history,
doc: /* A history list for arguments that are Lisp expressions to evaluate.
For example, `eval-expression' uses this. */);
@@ -2512,7 +2492,6 @@ instead. */);
defsubr (&Sread_variable);
defsubr (&Sinternal_complete_buffer);
defsubr (&Sread_buffer);
- defsubr (&Sread_no_blanks_input);
defsubr (&Sminibuffer_depth);
defsubr (&Sminibuffer_prompt);
diff --git a/src/w32fns.c b/src/w32fns.c
index 9db367bfafe..c07f32ab0cc 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7434,6 +7434,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
set_window_buffer (window, tip_buf, false, false);
w = XWINDOW (window);
w->pseudo_window_p = true;
+ /* Try to avoid that `other-window' select us (Bug#47207). */
+ Fset_window_parameter (window, Qno_other_window, Qt);
/* Set up the frame's root window. Note: The following code does not
try to size the window or its frame correctly. Its only purpose is
diff --git a/src/window.c b/src/window.c
index 7c238a33fcb..5134c3df63d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -504,10 +504,18 @@ select_window (Lisp_Object window, Lisp_Object norecord,
{
struct window *w;
struct frame *sf;
+ Lisp_Object frame;
+ struct frame *f;
CHECK_LIVE_WINDOW (window);
w = XWINDOW (window);
+ frame = WINDOW_FRAME (w);
+ f = XFRAME (frame);
+
+ if (FRAME_TOOLTIP_P (f))
+ /* Do not select a tooltip window (Bug#47207). */
+ error ("Cannot select a tooltip window");
/* Make the selected window's buffer current. */
Fset_buffer (w->contents);
@@ -528,14 +536,14 @@ select_window (Lisp_Object window, Lisp_Object norecord,
redisplay_other_windows ();
sf = SELECTED_FRAME ();
- if (XFRAME (WINDOW_FRAME (w)) != sf)
+ if (f != sf)
{
- fset_selected_window (XFRAME (WINDOW_FRAME (w)), window);
+ fset_selected_window (f, window);
/* Use this rather than Fhandle_switch_frame
so that FRAME_FOCUS_FRAME is moved appropriately as we
move around in the state where a minibuffer in a separate
frame is active. */
- Fselect_frame (WINDOW_FRAME (w), norecord);
+ Fselect_frame (frame, norecord);
/* Fselect_frame called us back so we've done all the work already. */
eassert (EQ (window, selected_window));
return window;
@@ -2596,7 +2604,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow,
candidate_p = false;
else if (MINI_WINDOW_P (w)
&& (EQ (minibuf, Qlambda)
- || (WINDOWP (minibuf) && !EQ (minibuf, window))))
+ || (WINDOW_LIVE_P (minibuf) && !EQ (minibuf, window))))
{
/* If MINIBUF is `lambda' don't consider any mini-windows.
If it is a window, consider only that one. */
@@ -2640,7 +2648,8 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow,
candidate_p = ((EQ (XWINDOW (all_frames)->frame, w->frame)
|| (EQ (f->minibuffer_window, all_frames)
&& EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f))))
- && !is_minibuffer (0, XWINDOW (all_frames)->contents));
+ && (EQ (minibuf, Qt)
+ || !is_minibuffer (0, XWINDOW (all_frames)->contents)));
else if (FRAMEP (all_frames))
candidate_p = EQ (all_frames, w->frame);
@@ -2659,12 +2668,12 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
Lisp_Object miniwin = XFRAME (w->frame)->minibuffer_window;
XSETWINDOW (*window, w);
- /* MINIBUF nil may or may not include minibuffers. Decide if it
- does. */
- if (NILP (*minibuf))
- *minibuf = this_minibuffer_depth (XWINDOW (miniwin)->contents)
- ? miniwin
- : Qlambda;
+ /* MINIBUF nil may or may not include minibuffer windows. Decide if
+ it does. But first make sure that this frame's minibuffer window
+ is live (Bug#47207). */
+ if (WINDOW_LIVE_P (miniwin) && NILP (*minibuf))
+ *minibuf = (this_minibuffer_depth (XWINDOW (miniwin)->contents)
+ ? miniwin : Qlambda);
else if (!EQ (*minibuf, Qt))
*minibuf = Qlambda;
@@ -2675,9 +2684,10 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
/* ALL_FRAMES nil doesn't specify which frames to include. */
if (NILP (*all_frames))
*all_frames
- = (!EQ (*minibuf, Qlambda)
- ? FRAME_MINIBUF_WINDOW (XFRAME (w->frame))
- : Qnil);
+ /* Once more make sure that this frame's minibuffer window is live
+ before including it (Bug#47207). */
+ = ((WINDOW_LIVE_P (miniwin) && !EQ (*minibuf, Qlambda))
+ ? miniwin : Qnil);
else if (EQ (*all_frames, Qvisible))
;
else if (EQ (*all_frames, make_fixnum (0)))
@@ -6871,19 +6881,22 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
}
DEFUN ("set-window-configuration", Fset_window_configuration,
- Sset_window_configuration, 1, 2, 0,
+ Sset_window_configuration, 1, 3, 0,
doc: /* Set the configuration of windows and buffers as specified by CONFIGURATION.
CONFIGURATION must be a value previously returned
by `current-window-configuration' (which see).
Normally, this function selects the frame of the CONFIGURATION, but if
DONT-SET-FRAME is non-nil, it leaves selected the frame which was
-current at the start of the function.
+current at the start of the function. If DONT-SET-MINIWINDOW is non-nil,
+the mini-window of the frame doesn't get set to the corresponding element
+of CONFIGURATION.
If CONFIGURATION was made from a frame that is now deleted,
only frame-independent values can be restored. In this case,
the return value is nil. Otherwise the value is t. */)
- (Lisp_Object configuration, Lisp_Object dont_set_frame)
+ (Lisp_Object configuration, Lisp_Object dont_set_frame,
+ Lisp_Object dont_set_miniwindow)
{
register struct save_window_data *data;
struct Lisp_Vector *saved_windows;
@@ -7094,8 +7107,10 @@ the return value is nil. Otherwise the value is t. */)
}
}
- if (BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer)))
- /* If saved buffer is alive, install it. */
+ if ((NILP (dont_set_miniwindow) || !MINI_WINDOW_P (w))
+ && BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer)))
+ /* If saved buffer is alive, install it, unless it's a
+ minibuffer we explicitly prohibit. */
{
wset_buffer (w, p->buffer);
w->start_at_line_beg = !NILP (p->start_at_line_beg);
@@ -7248,9 +7263,11 @@ void
restore_window_configuration (Lisp_Object configuration)
{
if (CONSP (configuration))
- Fset_window_configuration (XCDR (configuration), XCAR (configuration));
+ Fset_window_configuration (XCAR (configuration),
+ XCAR (XCDR (configuration)),
+ XCAR (XCDR (XCDR (configuration))));
else
- Fset_window_configuration (configuration, Qnil);
+ Fset_window_configuration (configuration, Qnil, Qnil);
}
@@ -8232,6 +8249,7 @@ syms_of_window (void)
DEFSYM (Qmode_line_format, "mode-line-format");
DEFSYM (Qheader_line_format, "header-line-format");
DEFSYM (Qtab_line_format, "tab-line-format");
+ DEFSYM (Qno_other_window, "no-other-window");
DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function,
doc: /* Non-nil means call as function to display a help buffer.
diff --git a/src/xdisp.c b/src/xdisp.c
index fecf1f6ee41..dd7a4a8a541 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10064,8 +10064,20 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
if ((op & MOVE_TO_POS) != 0
&& (IT_CHARPOS (*it) > to_charpos
|| (IT_CHARPOS (*it) == to_charpos
+ /* Consider TO_CHARPOS as REACHED if we are at
+ EOB that ends in something other than a newline. */
&& to_charpos == ZV
- && (ZV_BYTE <= 1 || FETCH_BYTE (ZV_BYTE - 1) != '\n'))))
+ && (ZV_BYTE <= 1 || FETCH_BYTE (ZV_BYTE - 1) != '\n')
+ /* But if we have a display or an overlay string
+ at EOB, keep going until we exhaust all the
+ characters of the string(s). */
+ && (it->sp == 0
+ || (STRINGP (it->string)
+ && (it->current.overlay_string_index < 0
+ || (it->current.overlay_string_index >= 0
+ && it->current.overlay_string_index
+ >= it->n_overlay_strings - 1))
+ && IT_STRING_CHARPOS (*it) >= it->end_charpos)))))
{
reached = 9;
goto out;
diff --git a/src/xfns.c b/src/xfns.c
index 0507dc8f61d..f120653ee7b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -7076,6 +7076,8 @@ Text larger than the specified size is clipped. */)
set_window_buffer (window, tip_buf, false, false);
w = XWINDOW (window);
w->pseudo_window_p = true;
+ /* Try to avoid that `other-window' select us (Bug#47207). */
+ Fset_window_parameter (window, Qno_other_window, Qt);
/* Set up the frame's root window. Note: The following code does not
try to size the window or its frame correctly. Its only purpose is