summaryrefslogtreecommitdiff
path: root/cider-util.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2016-10-08 16:09:30 +0300
committerBozhidar Batsov <bozhidar@batsov.com>2016-10-08 16:09:30 +0300
commit5a9b3ced54f52abfa3632a9e8d382be49cd4faff (patch)
treecce4a915717ddb00e5918a229115a1a508838b92 /cider-util.el
parent3a83d58dfc546b79c3e5284e1d59b83969bc4a88 (diff)
[Fix #1823] Properly set the column metadata on interactive evaluation
Basically the issue was coming from the fact that Clojure counts columns from 1 and Emacs from 0. Somewhat amusing Emacs counts lines from 1, not 0.
Diffstat (limited to 'cider-util.el')
-rw-r--r--cider-util.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/cider-util.el b/cider-util.el
index 59cb3d61..bc1658ca 100644
--- a/cider-util.el
+++ b/cider-util.el
@@ -662,7 +662,11 @@ through a stack of help buffers. Variables `help-back-label' and
(defun cider-column-number-at-pos (pos)
"Analog to `line-number-at-pos'.
Return buffer column number at position POS."
- (save-excursion (goto-char pos) (current-column)))
+ (save-excursion
+ (goto-char pos)
+ ;; we have to adjust the column number by 1 to account for the fact
+ ;; that Emacs starts counting columns from 0 and Clojure from 1
+ (1+ (current-column))))
(defun cider-propertize (text kind)
"Propertize TEXT as KIND.