mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
Eglot: don't use text-property-search-forward unavailable on 26.3
* lisp/progmodes/eglot.el (eglot--format-markup) (eglot--semtok-font-lock-2): Rewrite. * test/lisp/progmodes/eglot-tests.el (eglot--semtok-wait): Rewrite.
This commit is contained in:
parent
4484a9f875
commit
a59fafde75
2 changed files with 26 additions and 18 deletions
|
|
@ -2172,21 +2172,22 @@ MARKUP is either an LSP MarkedString or MarkupContent object."
|
||||||
(setq-local markdown-fontify-code-blocks-natively t)
|
(setq-local markdown-fontify-code-blocks-natively t)
|
||||||
(insert string)
|
(insert string)
|
||||||
(let ((inhibit-message t)
|
(let ((inhibit-message t)
|
||||||
(message-log-max nil)
|
(message-log-max nil))
|
||||||
match)
|
|
||||||
(ignore-errors (delay-mode-hooks (funcall render-mode)))
|
(ignore-errors (delay-mode-hooks (funcall render-mode)))
|
||||||
(font-lock-ensure)
|
(font-lock-ensure)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(when (fboundp 'text-property-search-forward)
|
;; If `render-mode' is `gfm-view-mode', the `invisible'
|
||||||
;; If `render-mode' is `gfm-view-mode', the `invisible'
|
;; regions are set to `markdown-markup'. Set them to 't'
|
||||||
;; regions are set to `markdown-markup'. Set them to 't'
|
;; instead, since this has actual meaning in the "*eldoc*"
|
||||||
;; instead, since this has actual meaning in the "*eldoc*"
|
;; buffer where we're taking this string (#bug79552).
|
||||||
;; buffer where we're taking this string (#bug79552).
|
(cl-loop for from = (point) then to
|
||||||
(while (setq match (text-property-search-forward 'invisible))
|
while (< from (point-max))
|
||||||
(put-text-property (prop-match-beginning match)
|
for inv = (get-text-property from 'invisible)
|
||||||
(prop-match-end match)
|
for to = (or (next-single-property-change from 'invisible)
|
||||||
'invisible t))))
|
(point-max))
|
||||||
|
when inv
|
||||||
|
do (put-text-property from to 'invisible t)))
|
||||||
(string-trim (buffer-string))))))
|
(string-trim (buffer-string))))))
|
||||||
|
|
||||||
(defun eglot--read-server (prompt &optional dont-if-just-the-one)
|
(defun eglot--read-server (prompt &optional dont-if-just-the-one)
|
||||||
|
|
@ -5125,12 +5126,12 @@ lock machinery calls us again."
|
||||||
(with-silent-modifications
|
(with-silent-modifications
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(cl-loop
|
(cl-loop
|
||||||
initially (goto-char beg)
|
for from = beg then to
|
||||||
for match = (text-property-search-forward 'eglot--semtok-faces)
|
while (< from end)
|
||||||
while (and match (< (point) end))
|
for faces = (get-text-property from 'eglot--semtok-faces)
|
||||||
do (dolist (f (prop-match-value match))
|
for to = (or (next-single-property-change from 'eglot--semtok-faces nil end) end)
|
||||||
(add-face-text-property
|
when faces
|
||||||
(prop-match-beginning match) (prop-match-end match) f)))))))
|
do (dolist (f faces) (add-face-text-property from to f)))))))
|
||||||
|
|
||||||
|
|
||||||
;;; Call and type hierarchies
|
;;; Call and type hierarchies
|
||||||
|
|
|
||||||
|
|
@ -1576,7 +1576,14 @@ GUESSED-MAJOR-MODES-SYM are bound to the useful return values of
|
||||||
'(3 "Timeout waiting for semantic tokens")
|
'(3 "Timeout waiting for semantic tokens")
|
||||||
(while (not (save-excursion
|
(while (not (save-excursion
|
||||||
(goto-char pos)
|
(goto-char pos)
|
||||||
(text-property-search-forward 'eglot--semtok-faces)))
|
(cl-loop
|
||||||
|
for from = (point) then to
|
||||||
|
while (< from (point-max))
|
||||||
|
for faces = (get-text-property from 'eglot--semtok-faces)
|
||||||
|
for to = (or (next-single-property-change
|
||||||
|
from 'eglot--semtok-faces)
|
||||||
|
(point-max))
|
||||||
|
when faces return t)))
|
||||||
(accept-process-output nil 0.1)
|
(accept-process-output nil 0.1)
|
||||||
(font-lock-ensure))))
|
(font-lock-ensure))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue