aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorJoão Távora2026-01-11 12:42:47 +0000
committerJoão Távora2026-01-11 13:15:27 +0000
commita59fafde755acc8fe29b3ec8464f8200a9be4591 (patch)
treead06b6b63d4c853d1585f99dc7e7f0d1db5edffa /lisp/progmodes
parent4484a9f87536ee0caff4b1f53fde8f4f3ac4adbe (diff)
downloademacs-a59fafde755acc8fe29b3ec8464f8200a9be4591.tar.gz
emacs-a59fafde755acc8fe29b3ec8464f8200a9be4591.zip
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.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/eglot.el35
1 files changed, 18 insertions, 17 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index f75a512e18a..05075bffc87 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2172,21 +2172,22 @@ MARKUP is either an LSP MarkedString or MarkupContent object."
2172 (setq-local markdown-fontify-code-blocks-natively t) 2172 (setq-local markdown-fontify-code-blocks-natively t)
2173 (insert string) 2173 (insert string)
2174 (let ((inhibit-message t) 2174 (let ((inhibit-message t)
2175 (message-log-max nil) 2175 (message-log-max nil))
2176 match)
2177 (ignore-errors (delay-mode-hooks (funcall render-mode))) 2176 (ignore-errors (delay-mode-hooks (funcall render-mode)))
2178 (font-lock-ensure) 2177 (font-lock-ensure)
2179 (goto-char (point-min)) 2178 (goto-char (point-min))
2180 (let ((inhibit-read-only t)) 2179 (let ((inhibit-read-only t))
2181 (when (fboundp 'text-property-search-forward) 2180 ;; If `render-mode' is `gfm-view-mode', the `invisible'
2182 ;; If `render-mode' is `gfm-view-mode', the `invisible' 2181 ;; regions are set to `markdown-markup'. Set them to 't'
2183 ;; regions are set to `markdown-markup'. Set them to 't' 2182 ;; instead, since this has actual meaning in the "*eldoc*"
2184 ;; instead, since this has actual meaning in the "*eldoc*" 2183 ;; buffer where we're taking this string (#bug79552).
2185 ;; buffer where we're taking this string (#bug79552). 2184 (cl-loop for from = (point) then to
2186 (while (setq match (text-property-search-forward 'invisible)) 2185 while (< from (point-max))
2187 (put-text-property (prop-match-beginning match) 2186 for inv = (get-text-property from 'invisible)
2188 (prop-match-end match) 2187 for to = (or (next-single-property-change from 'invisible)
2189 'invisible t)))) 2188 (point-max))
2189 when inv
2190 do (put-text-property from to 'invisible t)))
2190 (string-trim (buffer-string)))))) 2191 (string-trim (buffer-string))))))
2191 2192
2192(defun eglot--read-server (prompt &optional dont-if-just-the-one) 2193(defun eglot--read-server (prompt &optional dont-if-just-the-one)
@@ -5125,12 +5126,12 @@ lock machinery calls us again."
5125 (with-silent-modifications 5126 (with-silent-modifications
5126 (save-excursion 5127 (save-excursion
5127 (cl-loop 5128 (cl-loop
5128 initially (goto-char beg) 5129 for from = beg then to
5129 for match = (text-property-search-forward 'eglot--semtok-faces) 5130 while (< from end)
5130 while (and match (< (point) end)) 5131 for faces = (get-text-property from 'eglot--semtok-faces)
5131 do (dolist (f (prop-match-value match)) 5132 for to = (or (next-single-property-change from 'eglot--semtok-faces nil end) end)
5132 (add-face-text-property 5133 when faces
5133 (prop-match-beginning match) (prop-match-end match) f))))))) 5134 do (dolist (f faces) (add-face-text-property from to f)))))))
5134 5135
5135 5136
5136;;; Call and type hierarchies 5137;;; Call and type hierarchies