Skip to content

Commit 5a9b3ce

Browse files
committed
[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.
1 parent 3a83d58 commit 5a9b3ce

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ within the scope of your current Emacs session.
2222
* [#1819](https://github.com/clojure-emacs/cider/issues/1819): Handle properly missing commands on `cider-jack-in`.
2323
* Add option to define exclusions for injected dependecies. Fixes [#1824](https://github.com/clojure-emacs/cider/issues/1824): Can no longer jack-in to an inherited clojure version.
2424
* [#1820](https://github.com/clojure-emacs/cider/issues/1820): Don't try to display eldoc in EDN buffers.
25+
* [#1823](https://github.com/clojure-emacs/cider/issues/1823): Fix column location metadata set by interactive evaluation.
2526

2627
## 0.13.0 (2016-07-25)
2728

cider-util.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,11 @@ through a stack of help buffers. Variables `help-back-label' and
662662
(defun cider-column-number-at-pos (pos)
663663
"Analog to `line-number-at-pos'.
664664
Return buffer column number at position POS."
665-
(save-excursion (goto-char pos) (current-column)))
665+
(save-excursion
666+
(goto-char pos)
667+
;; we have to adjust the column number by 1 to account for the fact
668+
;; that Emacs starts counting columns from 0 and Clojure from 1
669+
(1+ (current-column))))
666670

667671
(defun cider-propertize (text kind)
668672
"Propertize TEXT as KIND.

0 commit comments

Comments
 (0)