From a88cc9210bf9ca31003954a6af043a08c462fc1c Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Wed, 29 Apr 2020 10:09:24 +0200 Subject: [PATCH] Always string-trim markup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Co-authored-by: João Távora * eglot.el: (eglot--format-markup): Factor string trim out so we string-trim for all cases GitHub-reference: close https://github.com/joaotavora/eglot/issues/450 --- lisp/progmodes/eglot.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 436e5bfe445..bdc4cd0aaab 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1139,15 +1139,14 @@ Doubles as an indicator of snippet support." (defun eglot--format-markup (markup) "Format MARKUP according to LSP's spec." (pcase-let ((`(,string ,mode) - (if (stringp markup) (list (string-trim markup) - (intern "gfm-view-mode")) + (if (stringp markup) (list markup 'gfm-view-mode) (list (plist-get markup :value) (pcase (plist-get markup :kind) ("markdown" 'gfm-view-mode) ("plaintext" 'text-mode) (_ major-mode)))))) (with-temp-buffer - (insert string) + (insert (string-trim string)) (ignore-errors (delay-mode-hooks (funcall mode))) (font-lock-ensure) (buffer-string)))) -- 2.39.2