]> git.eshelyaron.com Git - emacs.git/commitdiff
Always string-trim markup
authorTheodor Thornhill <theo@thornhill.no>
Wed, 29 Apr 2020 08:09:24 +0000 (10:09 +0200)
committerJoão Távora <joaotavora@gmail.com>
Sat, 2 May 2020 23:48:45 +0000 (00:48 +0100)
Co-authored-by: João Távora <joaotavora@gmail.com>
* 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

index 436e5bfe445bc0874ef7d09beca9a64bf72ee097..bdc4cd0aaab265e1efade37941b489aec4a523a5 100644 (file)
@@ -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))))