bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#52593: 28.0.90; (thing-at-point thing) has so much overhead since co


From: Lars Ingebrigtsen
Subject: bug#52593: 28.0.90; (thing-at-point thing) has so much overhead since commit 7db376e560448e61485ba054def8c82b21f33d6a
Date: Sun, 19 Dec 2021 17:14:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Never mind, that's not correct -- outside a field, the `field-end'
> should return the position before the beginning of the next field, so I
> that's wrong.

This one should be more correct, but it's just 3x faster than what's on
the trunk...

diff --git a/src/editfns.c b/src/editfns.c
index 5c9c34dc35..355a7a3e29 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -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),


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]