mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-16 17:00:06 +00:00
Revert field-related thingatpt changes
This reverts 7db376e560
, which led to
severe performance regressions when being run in large buffers with no
fields (bug#52593)
This commit is contained in:
parent
9bcb732686
commit
29fffbdd87
3 changed files with 16 additions and 31 deletions
1
etc/NEWS
1
etc/NEWS
|
@ -3038,7 +3038,6 @@ checkdoc will now check the format of 'yes-or-no-p'.
|
||||||
*** New command 'checkdoc-dired'.
|
*** New command 'checkdoc-dired'.
|
||||||
This can be used to run checkdoc on files from a Dired buffer.
|
This can be used to run checkdoc on files from a Dired buffer.
|
||||||
|
|
||||||
---
|
|
||||||
*** No longer checks for 'A-' modifiers.
|
*** No longer checks for 'A-' modifiers.
|
||||||
Checkdoc recommends usage of command substitutions ("\\[foo-command]")
|
Checkdoc recommends usage of command substitutions ("\\[foo-command]")
|
||||||
in favor of writing keybindings like 'C-c f'. It now no longer warns
|
in favor of writing keybindings like 'C-c f'. It now no longer warns
|
||||||
|
|
|
@ -162,30 +162,24 @@ Possibilities include `symbol', `list', `sexp', `defun',
|
||||||
When the optional argument NO-PROPERTIES is non-nil,
|
When the optional argument NO-PROPERTIES is non-nil,
|
||||||
strip text properties from the return value.
|
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
|
See the file `thingatpt.el' for documentation on how to define
|
||||||
a symbol as a valid THING."
|
a symbol as a valid THING."
|
||||||
(save-restriction
|
(let ((text
|
||||||
(narrow-to-region (field-beginning) (field-end))
|
(cond
|
||||||
(let ((text
|
((cl-loop for (pthing . function) in thing-at-point-provider-alist
|
||||||
(cond
|
when (eq pthing thing)
|
||||||
((cl-loop for (pthing . function) in thing-at-point-provider-alist
|
for result = (funcall function)
|
||||||
when (eq pthing thing)
|
when result
|
||||||
for result = (funcall function)
|
return result))
|
||||||
when result
|
((get thing 'thing-at-point)
|
||||||
return result))
|
(funcall (get thing 'thing-at-point)))
|
||||||
((get thing 'thing-at-point)
|
(t
|
||||||
(funcall (get thing 'thing-at-point)))
|
(let ((bounds (bounds-of-thing-at-point thing)))
|
||||||
(t
|
(when bounds
|
||||||
(let ((bounds (bounds-of-thing-at-point thing)))
|
(buffer-substring (car bounds) (cdr bounds))))))))
|
||||||
(when bounds
|
(when (and text no-properties (sequencep text))
|
||||||
(buffer-substring (car bounds) (cdr bounds))))))))
|
(set-text-properties 0 (length text) nil text))
|
||||||
(when (and text no-properties (sequencep text))
|
text))
|
||||||
(set-text-properties 0 (length text) nil text))
|
|
||||||
text)))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun bounds-of-thing-at-mouse (event thing)
|
(defun bounds-of-thing-at-mouse (event thing)
|
||||||
|
|
|
@ -223,12 +223,4 @@ position to retrieve THING.")
|
||||||
(should (equal (test--number "0xf00" 2) 3840))
|
(should (equal (test--number "0xf00" 2) 3840))
|
||||||
(should (equal (test--number "0xf00" 3) 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
|
;;; thingatpt-tests.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue