Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure text property keys are symbols. #918

Merged
merged 1 commit into from
Dec 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* [#824](https://github.com/clojure-emacs/cider/issues/824): Fix REPL font-locking.
* [#888](https://github.com/clojure-emacs/cider/issues/888): Handle comments in `cider-repl-mode`.
* [#830](https://github.com/clojure-emacs/cider/issues/830): Stop using `load-file` for most interactive evaluation commands.
* [#885](https://github.com/clojure-emacs/cider/issues/885): Translate nREPL-delivered map keys to symbols before adding as text properties.

## 0.8.1 / 2014-11-20

Expand Down
2 changes: 1 addition & 1 deletion cider-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
"Emit into BUFFER report detail for the TEST assertion."
(with-current-buffer buffer
(nrepl-dbind-response test (var context type message expected actual error)
(cider-propertize-region (cdr test)
(cider-propertize-region (cider-intern-keys (cdr test))
(cider-insert (capitalize type) (cider-test-type-face type) nil " in ")
(cider-insert var 'font-lock-function-name-face t)
(when context (cider-insert context 'font-lock-doc-face t))
Expand Down
8 changes: 8 additions & 0 deletions cider-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ buffer-local wherever it is set."

;;; Text properties

(defun cider-maybe-intern (name)
"If NAME is a symbol, return it; otherwise, intern it."
(if (symbolp name) name (intern name)))

(defun cider-intern-keys (props)
"Copy plist-style PROPS with any non-symbol keys replaced with symbols."
(-map-indexed (lambda (i x) (if (oddp i) x (cider-maybe-intern x))) props))

(defmacro cider-propertize-region (props &rest body)
"Execute BODY and add PROPS to all the text it inserts.
More precisely, PROPS are added to the region between the point's
Expand Down