mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-05 03:20:39 -08:00
Speed up find_field when called from outside a field
* src/editfns.c (find_field): Speed up the field functions when called from outside a field (bug#52593). (In some cursory tests, this makes the called-from-outside-a-field case about 3x faster.)
This commit is contained in:
parent
0c4fc7032a
commit
4d8af56c76
1 changed files with 21 additions and 0 deletions
|
|
@ -437,6 +437,27 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
|
|||
|
||||
after_field
|
||||
= get_char_property_and_overlay (pos, Qfield, Qnil, NULL);
|
||||
|
||||
/* We're not in a field, so find the prev/next area with a field
|
||||
property. */
|
||||
if (NILP (after_field))
|
||||
{
|
||||
if (beg)
|
||||
{
|
||||
Lisp_Object p = Fprevious_single_char_property_change (pos, Qfield,
|
||||
Qnil,
|
||||
beg_limit);
|
||||
*beg = NILP (p) ? BEGV : XFIXNAT (p);
|
||||
}
|
||||
if (end)
|
||||
{
|
||||
Lisp_Object p = Fnext_single_char_property_change (pos, Qfield, Qnil,
|
||||
end_limit);
|
||||
*end = NILP (p) ? ZV : XFIXNAT (p);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
before_field
|
||||
= (XFIXNAT (pos) > BEGV
|
||||
? get_char_property_and_overlay (make_fixnum (XFIXNUM (pos) - 1),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue