summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2024-04-21 21:51:09 +0800
committerPo Lu <luangruo@yahoo.com>2024-04-29 12:34:39 +0800
commit430088c9ccec5fe9be57d267f45acdc87aa3b28e (patch)
treea953f845c4176e4a18a542c1e321f80ad34ab4af /src/minibuf.c
parentee2e0031d8cc32bb7837ea97ce07ef3b25463223 (diff)
downloademacs-430088c9ccec5fe9be57d267f45acdc87aa3b28e.tar.gz
emacs-430088c9ccec5fe9be57d267f45acdc87aa3b28e.tar.bz2
emacs-430088c9ccec5fe9be57d267f45acdc87aa3b28e.zip
Take fields into account during text conversion
* lisp/cus-edit.el (Custom-mode): Enable text conversion, now that fields are correctly treated. * src/alloc.c (mark_frame): Mark f->conversion.field. * src/androidterm.c (android_update_selection): Adjust conversion region and selection position by the field start and end. * src/editfns.c (find_field): Export function. * src/frame.c (make_frame): Clear f->conversion.field. * src/frame.h (struct text_conversion_state) <field>: New field. * src/lisp.h (find_fields, reset_frame_conversion): Export functions. * src/minibuf.c (Fread_from_minibuffer): Reset frame conversion if Voverriding_text_conversion_style is set. * src/textconv.c (textconv_query): Narrow to field. (reset_frame_conversion): New function. (reset_frame_state): Clear conversion field. (really_delete_surrounding_text): Narrow to field. (locate_and_save_position_in_field): New function. (really_request_point_update, really_set_point_and_mark) (complete_edit_check, handle_pending_conversion_events_1) (handle_pending_conversion_events, get_conversion_field) (set_composing_region, textconv_set_point_and_mark, replace_text) (get_extracted_text, get_surrounding_text, report_point_change): Compute, narrow to and offset by the currently active field whenever point is updated or a command is received. (syms_of_textconv): Revise doc strings. * src/textconv.h (get_conversion_field): Export function.
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 51816133fb2..1029fcdb1ba 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1367,6 +1367,20 @@ and some related functions, which use zero-indexing for POSITION. */)
if (NILP (histpos))
XSETFASTINT (histpos, 0);
+#ifdef HAVE_TEXT_CONVERSION
+ /* If overriding-text-conversion-style is set, assume that it was
+ changed prior to this call and force text conversion to be reset,
+ since redisplay might conclude that the value was retained
+ unmodified from a previous call to Fread_from_minibuffer as the
+ selected window will not have changed. */
+ if (!EQ (Voverriding_text_conversion_style, Qlambda)
+ /* Separate minibuffer frames are not material here, since they
+ will already be selected if the situation that this is meant to
+ prevent is possible. */
+ && FRAME_WINDOW_P (SELECTED_FRAME ()))
+ reset_frame_conversion (SELECTED_FRAME ());
+#endif /* HAVE_TEXT_CONVERSION */
+
val = read_minibuf (keymap, initial_contents, prompt,
!NILP (read),
histvar, histpos, default_value,