From 1f3499320cca1f3c3ea2722bec5a8c2df003e2b7 Mon Sep 17 00:00:00 2001 From: Michal Krzywkowski Date: Tue, 27 Nov 2018 23:28:11 +0100 Subject: [PATCH] * eglot.el (eglot--current-column): new helper. (eglot-current-column-function): Set to eglot--current-column. (eglot--pos-to-lsp-position): Don't bind tab-width anymore. (eglot--xref-make): Use eglot--current-column. --- lisp/progmodes/eglot.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 15229352816..94de8d1bc48 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -811,7 +811,9 @@ CONNECT-ARGS are passed as additional arguments to (let ((warning-minimum-level :error)) (display-warning 'eglot (apply #'format format args) :warning))) -(defvar eglot-current-column-function #'current-column +(defun eglot--current-column () (- (point) (point-at-bol))) + +(defvar eglot-current-column-function #'eglot--current-column "Function to calculate the current column. This is the inverse operation of @@ -833,8 +835,7 @@ for all others.") (eglot--widening (list :line (1- (line-number-at-pos pos t)) ; F!@&#$CKING OFF-BY-ONE :character (progn (when pos (goto-char pos)) - (let ((tab-width 1)) - (funcall eglot-current-column-function)))))) + (funcall eglot-current-column-function))))) (defvar eglot-move-to-column-function #'move-to-column "Function to move to a column reported by the LSP server. @@ -1502,11 +1503,10 @@ Try to visit the target file for a richer summary line." (eglot--widening (pcase-let* ((`(,beg . ,end) (eglot--range-region range)) (bol (progn (goto-char beg) (point-at-bol))) - (substring (buffer-substring bol (point-at-eol))) - (tab-width 1)) + (substring (buffer-substring bol (point-at-eol)))) (add-face-text-property (- beg bol) (- end bol) 'highlight t substring) - (list substring (1+ (current-line)) (current-column)))))) + (list substring (1+ (current-line)) (eglot--current-column)))))) (`(,summary ,line ,column) (cond (visiting (with-current-buffer visiting (funcall collect))) -- 2.39.2