]> git.eshelyaron.com Git - emacs.git/commitdiff
Tweak solution to with a hint from fangrui song
authorJoão Távora <joaotavora@gmail.com>
Tue, 13 Nov 2018 09:46:47 +0000 (09:46 +0000)
committerJoão Távora <joaotavora@gmail.com>
Tue, 13 Nov 2018 09:46:47 +0000 (09:46 +0000)
* eglot.el (eglot-move-to-lsp-abiding-column): Simplify slightly.

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

lisp/progmodes/eglot.el

index 512e9a689fa7cc7227a0c35bfedfa81783511cdf..24f8c971f91acd3a5df1c23071c4656fac106363 100644 (file)
@@ -752,8 +752,7 @@ managed by those servers.")
                        2)
                     2))
    until (zerop diff)
-   for offset = (max 1 (abs (/ diff 2)))
-   do (if (> diff 0) (forward-char offset) (backward-char offset))))
+   do (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2))))
 
 (defun eglot--lsp-position-to-point (pos-plist &optional marker)
   "Convert LSP position POS-PLIST to Emacs point.