aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2024-06-25 11:38:01 +0800
committerPo Lu2024-06-25 11:38:01 +0800
commit34e2adc6997a42d87156972fb2dfee311e996d2c (patch)
treed1e13d0b4afc330be5d6e9272c9bd2965e3dc63a /src
parent279974c14ebb17eb6c29a5cfa3390a682b4fcc7e (diff)
parent1b4c56272110944c4ea1483c6f9662de9e42a07b (diff)
downloademacs-34e2adc6997a42d87156972fb2dfee311e996d2c.tar.gz
emacs-34e2adc6997a42d87156972fb2dfee311e996d2c.zip
Merge from savannah/emacs-30
1b4c5627211 Fix latent side-effects of respecting field boundaries in... e4046f33ab8 ; * lisp/simple.el (undo-auto--boundaries): Doc fix (bug#... 008eeb21fdb ; * lisp/language/cyrillic.el: Delete obsolete commentary... 680155d3f03 Add missing builtin package declarations
Diffstat (limited to 'src')
-rw-r--r--src/textconv.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/textconv.c b/src/textconv.c
index 0e43bd9d458..e3f928cd789 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -153,6 +153,15 @@ select_window (Lisp_Object window, Lisp_Object norecord)
153 Fselect_window (window, norecord); 153 Fselect_window (window, norecord);
154} 154}
155 155
156/* Restore the selected window WINDOW. */
157
158static void
159restore_selected_window (Lisp_Object window)
160{
161 /* FIXME: not sure what to do if WINDOW has been deleted. */
162 select_window (window, Qt);
163}
164
156/* Perform the text conversion operation specified in QUERY and return 165/* Perform the text conversion operation specified in QUERY and return
157 the results. 166 the results.
158 167
@@ -188,6 +197,7 @@ textconv_query (struct frame *f, struct textconv_callback_struct *query,
188 selected window. */ 197 selected window. */
189 count = SPECPDL_INDEX (); 198 count = SPECPDL_INDEX ();
190 record_unwind_protect_excursion (); 199 record_unwind_protect_excursion ();
200 record_unwind_protect (restore_selected_window, selected_window);
191 201
192 /* Inhibit quitting. */ 202 /* Inhibit quitting. */
193 specbind (Qinhibit_quit, Qt); 203 specbind (Qinhibit_quit, Qt);
@@ -586,15 +596,6 @@ detect_conversion_events (void)
586 return false; 596 return false;
587} 597}
588 598
589/* Restore the selected window WINDOW. */
590
591static void
592restore_selected_window (Lisp_Object window)
593{
594 /* FIXME: not sure what to do if WINDOW has been deleted. */
595 select_window (window, Qt);
596}
597
598/* Commit the given text in the composing region. If there is no 599/* Commit the given text in the composing region. If there is no
599 composing region, then insert the text after frame F's selected 600 composing region, then insert the text after frame F's selected
600 window's last point instead, unless the mark is active. Finally, 601 window's last point instead, unless the mark is active. Finally,
@@ -1138,6 +1139,10 @@ locate_and_save_position_in_field (struct frame *f, struct window *w,
1138 1139
1139 /* Set the current buffer to W's. */ 1140 /* Set the current buffer to W's. */
1140 count = SPECPDL_INDEX (); 1141 count = SPECPDL_INDEX ();
1142
1143 /* The current buffer must be saved, not merely the selected
1144 window. */
1145 record_unwind_protect_excursion ();
1141 record_unwind_protect (restore_selected_window, selected_window); 1146 record_unwind_protect (restore_selected_window, selected_window);
1142 XSETWINDOW (window, w); 1147 XSETWINDOW (window, w);
1143 select_window (window, Qt); 1148 select_window (window, Qt);
@@ -2097,6 +2102,7 @@ get_extracted_text (struct frame *f, ptrdiff_t n,
2097 selected window. */ 2102 selected window. */
2098 count = SPECPDL_INDEX (); 2103 count = SPECPDL_INDEX ();
2099 record_unwind_protect_excursion (); 2104 record_unwind_protect_excursion ();
2105 record_unwind_protect (restore_selected_window, selected_window);
2100 2106
2101 /* Inhibit quitting. */ 2107 /* Inhibit quitting. */
2102 specbind (Qinhibit_quit, Qt); 2108 specbind (Qinhibit_quit, Qt);
@@ -2219,6 +2225,7 @@ get_surrounding_text (struct frame *f, ptrdiff_t left,
2219 selected window. */ 2225 selected window. */
2220 count = SPECPDL_INDEX (); 2226 count = SPECPDL_INDEX ();
2221 record_unwind_protect_excursion (); 2227 record_unwind_protect_excursion ();
2228 record_unwind_protect (restore_selected_window, selected_window);
2222 2229
2223 /* Inhibit quitting. */ 2230 /* Inhibit quitting. */
2224 specbind (Qinhibit_quit, Qt); 2231 specbind (Qinhibit_quit, Qt);