From: João Távora Date: Fri, 7 Apr 2023 18:45:28 +0000 (+0100) Subject: Eglot: require optional text-property-search.el X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6cc5fe77244b76f00ec680873087b17ca38f776f;p=emacs.git Eglot: require optional text-property-search.el Originally reported in https://github.com/joaotavora/eglot/discussions/1201. Also check for text-property-search-forward before using it, so we won't break on Emacs 26.3. At this point, better start relying on compat.el, I guess. * lisp/progmodes/eglot.el (eglot--format-markup): Check for text-property-search-forward. --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index da7e53730e7..8e665e28a53 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -107,6 +107,7 @@ (require 'subr-x)) (require 'filenotify) (require 'ert) +(require 'text-property-search nil t) ;; These dependencies are also GNU ELPA core packages. Because of ;; bug#62576, since there is a risk that M-x package-install, despite @@ -1673,9 +1674,10 @@ Doubles as an indicator of snippet support." (font-lock-ensure) (goto-char (point-min)) (let ((inhibit-read-only t)) - (while (setq match (text-property-search-forward 'invisible)) - (delete-region (prop-match-beginning match) - (prop-match-end match)))) + (when (fboundp 'text-property-search-forward) ;; FIXME: use compat + (while (setq match (text-property-search-forward 'invisible)) + (delete-region (prop-match-beginning match) + (prop-match-end match))))) (string-trim (buffer-string)))))) (define-obsolete-variable-alias 'eglot-ignored-server-capabilites