]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert field-related thingatpt changes
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 22 Dec 2021 12:56:47 +0000 (13:56 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 22 Dec 2021 12:56:47 +0000 (13:56 +0100)
This reverts 7db376e560448e61485ba054def8c82b21f33d6a, which led to
severe performance regressions when being run in large buffers with no
fields (bug#52593)

etc/NEWS
lisp/thingatpt.el
test/lisp/thingatpt-tests.el

index 02b6f665b07afa795c44707a9f06bcadd3d3ff95..1664ccfd044818736828183fed751232632af9ae 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3038,7 +3038,6 @@ checkdoc will now check the format of 'yes-or-no-p'.
 *** New command 'checkdoc-dired'.
 This can be used to run checkdoc on files from a Dired buffer.
 
----
 *** No longer checks for 'A-' modifiers.
 Checkdoc recommends usage of command substitutions ("\\[foo-command]")
 in favor of writing keybindings like 'C-c f'.  It now no longer warns
index 32e66184d702b6d2f9895950d8783deb1061fc21..4d3e68ec9c446f5861a60695d54d10ba86eba4e5 100644 (file)
@@ -162,30 +162,24 @@ Possibilities include `symbol', `list', `sexp', `defun',
 When the optional argument NO-PROPERTIES is non-nil,
 strip text properties from the return value.
 
-If the current buffer uses fields (see Info node `(elisp)Fields'),
-this function will narrow to the field before identifying the
-thing at point.
-
 See the file `thingatpt.el' for documentation on how to define
 a symbol as a valid THING."
-  (save-restriction
-    (narrow-to-region (field-beginning) (field-end))
-    (let ((text
-           (cond
-            ((cl-loop for (pthing . function) in thing-at-point-provider-alist
-                      when (eq pthing thing)
-                      for result = (funcall function)
-                      when result
-                      return result))
-            ((get thing 'thing-at-point)
-             (funcall (get thing 'thing-at-point)))
-            (t
-             (let ((bounds (bounds-of-thing-at-point thing)))
-               (when bounds
-                 (buffer-substring (car bounds) (cdr bounds))))))))
-      (when (and text no-properties (sequencep text))
-        (set-text-properties 0 (length text) nil text))
-      text)))
+  (let ((text
+         (cond
+          ((cl-loop for (pthing . function) in thing-at-point-provider-alist
+                    when (eq pthing thing)
+                    for result = (funcall function)
+                    when result
+                    return result))
+          ((get thing 'thing-at-point)
+           (funcall (get thing 'thing-at-point)))
+          (t
+           (let ((bounds (bounds-of-thing-at-point thing)))
+             (when bounds
+               (buffer-substring (car bounds) (cdr bounds))))))))
+    (when (and text no-properties (sequencep text))
+      (set-text-properties 0 (length text) nil text))
+    text))
 
 ;;;###autoload
 (defun bounds-of-thing-at-mouse (event thing)
index 2a32dc57b1cf3536aef96a134c395f47ea267b84..dc108c77c5c0a995c3ccf159cc25c4bd476cb745 100644 (file)
@@ -223,12 +223,4 @@ position to retrieve THING.")
   (should (equal (test--number "0xf00" 2) 3840))
   (should (equal (test--number "0xf00" 3) 3840)))
 
-(ert-deftest test-fields ()
-  (with-temp-buffer
-    (insert (propertize "foo" 'field 1) "bar" (propertize "zot" 'field 2))
-    (goto-char 1)
-    (should (eq (symbol-at-point) 'foo))
-    (goto-char 5)
-    (should (eq (symbol-at-point) 'bar))))
-
 ;;; thingatpt-tests.el ends here