diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-10-29 12:11:50 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-10-29 12:11:50 -0400 |
commit | 3472b6c682817242f8b6134dea06a6ce4777e419 (patch) | |
tree | 5e1fb55e804a07a91ad431b95b1e168df0ea7bf1 /src/insdel.c | |
parent | 2d9783e0b938d0e3550fee7efbb3c6b8b5f18462 (diff) |
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/insdel.c b/src/insdel.c index 0eb80c04d9..7e6182deb9 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1778,6 +1778,8 @@ modify_text (ptrdiff_t start, ptrdiff_t end) bset_point_before_scroll (current_buffer, Qnil); } +Lisp_Object Qregion_extract_function; + /* Check that it is okay to modify the buffer between START and END, which are char positions. @@ -1843,6 +1845,7 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, #endif /* not CLASH_DETECTION */ /* If `select-active-regions' is non-nil, save the region text. */ + /* FIXME: Move this to Elisp (via before-change-functions). */ if (!NILP (BVAR (current_buffer, mark_active)) && !inhibit_modification_hooks && XMARKER (BVAR (current_buffer, mark))->buffer @@ -1854,10 +1857,8 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, { ptrdiff_t b = marker_position (BVAR (current_buffer, mark)); ptrdiff_t e = PT; - if (b < e) - Vsaved_region_selection = make_buffer_string (b, e, 0); - else if (b > e) - Vsaved_region_selection = make_buffer_string (e, b, 0); + Vsaved_region_selection + = call1 (Fsymbol_value (Qregion_extract_function), Qnil); } signal_before_change (start, end, preserve_ptr); @@ -2202,5 +2203,7 @@ as well as hooks attached to text properties and overlays. */); inhibit_modification_hooks = 0; DEFSYM (Qinhibit_modification_hooks, "inhibit-modification-hooks"); + DEFSYM (Qregion_extract_function, "region-extract-function"); + defsubr (&Scombine_after_change_execute); } |