]> git.eshelyaron.com Git - emacs.git/commitdiff
Use filter-buffer-substring to get buffer text
authorAndrii Kolomoiets <andreyk.mad@gmail.com>
Tue, 26 May 2020 20:03:39 +0000 (23:03 +0300)
committerGitHub <noreply@github.com>
Tue, 26 May 2020 20:03:39 +0000 (21:03 +0100)
This way modes used to represent hover info text, such as
gfm-view-mode can e.g. filter out invisible text by providing own
`filter-buffer-substring-function'.

* eglot.el (eglot--format-markup): Use `filter-buffer-substring'.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/482

lisp/progmodes/eglot.el

index dc0200d617f1ab4a432794d34a62e29d3f902c15..8bb610bb4edd76dace0dce1df8905aec0a8dca54 100644 (file)
@@ -1165,10 +1165,10 @@ Doubles as an indicator of snippet support."
                          (_ major-mode))))))
     (with-temp-buffer
       (setq-local markdown-fontify-code-blocks-natively t)
-      (insert (string-trim string))
+      (insert string)
       (ignore-errors (delay-mode-hooks (funcall mode)))
       (font-lock-ensure)
-      (buffer-string))))
+      (string-trim (filter-buffer-substring (point-min) (point-max))))))
 
 (defcustom eglot-ignored-server-capabilites (list)
   "LSP server capabilities that Eglot could use, but won't.