From: Theodor Thornhill Date: Wed, 29 Apr 2020 08:09:24 +0000 (+0200) Subject: Always string-trim markup X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~231 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a88cc9210bf9ca31003954a6af043a08c462fc1c;p=emacs.git Always string-trim markup 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 --- 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))))