Skip to content

Commit 92d5ffd

Browse files
author
Marshall Bockrath-Vandegrift
committed
[Fix #885] Ensure text property keys are symbols.
Maps received via nREPL have string keys. The Emacs Lisp text property functions expect all property keys to be symbols. Thus we must first intern any non-symbol property keys prior to applying them as text properties.
1 parent 797d473 commit 92d5ffd

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [#824](https://github.com/clojure-emacs/cider/issues/824): Fix REPL font-locking.
1010
* [#888](https://github.com/clojure-emacs/cider/issues/888): Handle comments in `cider-repl-mode`.
1111
* [#830](https://github.com/clojure-emacs/cider/issues/830): Stop using `load-file` for most interactive evaluation commands.
12+
* [#885](https://github.com/clojure-emacs/cider/issues/885): Translate nREPL-delivered map keys to symbols before adding as text properties.
1213

1314
## 0.8.1 / 2014-11-20
1415

cider-test.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
270270
"Emit into BUFFER report detail for the TEST assertion."
271271
(with-current-buffer buffer
272272
(nrepl-dbind-response test (var context type message expected actual error)
273-
(cider-propertize-region (cdr test)
273+
(cider-propertize-region (cider-intern-keys (cdr test))
274274
(cider-insert (capitalize type) (cider-test-type-face type) nil " in ")
275275
(cider-insert var 'font-lock-function-name-face t)
276276
(when context (cider-insert context 'font-lock-doc-face t))

cider-util.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ buffer-local wherever it is set."
6767

6868
;;; Text properties
6969

70+
(defun cider-maybe-intern (name)
71+
"If NAME is a symbol, return it; otherwise, intern it."
72+
(if (symbolp name) name (intern name)))
73+
74+
(defun cider-intern-keys (props)
75+
"Copy plist-style PROPS with any non-symbol keys replaced with symbols."
76+
(-map-indexed (lambda (i x) (if (oddp i) x (cider-maybe-intern x))) props))
77+
7078
(defmacro cider-propertize-region (props &rest body)
7179
"Execute BODY and add PROPS to all the text it inserts.
7280
More precisely, PROPS are added to the region between the point's

0 commit comments

Comments
 (0)