From 85ed1c9ca6b786763740766d77b1f806c2f301a1 Mon Sep 17 00:00:00 2001 From: Gregory Heytings Date: Tue, 28 Mar 2023 23:06:54 +0000 Subject: Code cleanup for long line optimizations This commit does not change any code, it merely renames functions and clarifies the documentation, to make the code hopefully easier to grasp. * src/dispextern.h (struct it): Rename the 'narrowed_begv', 'narrowed_zv', 'locked_narrowing_begv', 'locked_narrowing_zv' to 'medium_narrowing_begv', 'medium_narrowing_zv', 'large_narrowing_begv', 'large_narrowing_zv'. Clarify the comments. Update the prototypes of the functions renamed in xdisp.c. * src/lisp.h: Update the prototypes of the functions renamed in editfns.c. Remove the prototype of 'safe_run_hooks_maybe_narrowed', which is used only in keyboard.c. * src/xdisp.c (get_small_narrowing_begv): Renamed from 'get_closer_narrowed_begv'. (get_medium_narrowing_begv): Renamed from 'get_narrowed_begv'. (get_medium_narrowing_zv): Renamed from 'get_narrowed_zv'. (get_large_narrowing_begv): Renamed from 'get_locked_narrowing_begv'. (get_large_narrowing_zv): Renamed from 'get_locked_narrowing_zv'. (SET_WITH_NARROWED_BEGV): Use the new field names. (handle_fontified_prop): Use the new function and new field names. (back_to_previous_line_start): Use the new field name. (back_to_previous_visible_line_start): Use the new field name. (reseat): Use the new function and new field names. (get_visually_first_element): Use the new field name. (move_it_vertically_backward): Use the new function name. (redisplay_internal): Use the new function name. Also add a large comment to explain how Emacs deals with long lines. * src/keyboard.c: (safe_run_hooks_maybe_narrowed): Use the new function names from xdisp.c and editfns.c. Make the function static, and add a prototype. * src/editfns.c: (labeled_restrictions): Renamed from 'narrowing_locks'. (labeled_restrictions_add): Renamed from 'narrowing_locks_add'. (labeled_restrictions_remove): Renamed from 'narrowing_locks_remove'. (labeled_restrictions_get_bound): Renamed from 'narrowing_lock_get_bound'. (labeled_restrictions_peek_label): Renamed from 'narrowing_lock_peek_tag'. (labeled_restrictions_push): Renamed from 'narrowing_lock_push'. (labeled_restrictions_pop): Renamed from 'narrowing_lock_pop'. (unwind_reset_outermost_restriction): Renamed from 'unwind_reset_outermost_narrowing'. (reset_outermost_restrictions): Renamed from 'reset_outermost_narrowings'. (labeled_restrictions_save): Renamed from 'narrowing_locks_save'. (labeled_restrictions_restore): Renamed from 'narrowing_locks_restore'. (unwind_labeled_narrow_to_region): Renamed from 'unwind_narrow_to_region_locked'. (labeled_narrow_to_region): Renamed from 'narrow_to_region_locked'. (Finternal__label_restriction): Renamed from 'Finternal__lock_narrowing'. (Finternal__unlabel_restriction): Renamed from 'Finternal__unlock_narrowing'. (Fwiden): Use the new function names. (Fnarrow_to_region): Use the new function names. (save_restriction_save): Use the new function names. (syms_of_editfns): Use the new function names. : Renamed from 'outermost-narrowing'. * lisp/subr.el (internal--with-restriction): Use the new internal function name. (internal--without-restriction): Use the new internal function name. * src/composite.c (composition_compute_stop_pos): (find_automatic_composition): Use the new function name. * doc/lispref/positions.texi (Narrowing): Add index entry. --- lisp/subr.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/subr.el') diff --git a/lisp/subr.el b/lisp/subr.el index f82826e819c..ca1fc2886b4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3975,7 +3975,7 @@ same LABEL argument. "Helper function for `with-restriction', which see." (save-restriction (narrow-to-region start end) - (if label (internal--lock-narrowing label)) + (if label (internal--label-restriction label)) (funcall body))) (defmacro without-restriction (&rest rest) @@ -3997,7 +3997,7 @@ are lifted. (defun internal--without-restriction (body &optional label) "Helper function for `without-restriction', which see." (save-restriction - (if label (internal--unlock-narrowing label)) + (if label (internal--unlabel-restriction label)) (widen) (funcall body))) -- cgit v1.2.1