From: Andrii Kolomoiets Date: Tue, 26 May 2020 20:03:39 +0000 (+0300) Subject: Use filter-buffer-substring to get buffer text X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~213 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5e0cd484ecd9abc9b1a9e1b14468620b9de9c9cc;p=emacs.git Use filter-buffer-substring to get buffer text 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 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index dc0200d617f..8bb610bb4ed 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -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.