Skip to content

Commit

Permalink
[Fix #2541] Hook properly CIDER's code completion machinery
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed May 12, 2019
1 parent 39dfb92 commit 7ff083e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* [#2593](https://github.com/clojure-emacs/cider/issues/2593): The REPL's initial namespace is now set correctly if configured in another tool (e.g. Leiningen's `:init-ns`).
* [#2607](https://github.com/clojure-emacs/cider/pull/2607): Use markers for specifying insertion point for `cider-eval-*-to-comment`commands. This fixes a bug where editing the buffer during a pending evaluation resulted in comments appearing in unintended locations.
* [#2308](https://github.com/clojure-emacs/cider/issues/2308): Don't rely on the classpath in `cider-library-present-p`. Now it does a `require` instead to check if some library is present or not.
* [#2541](https://github.com/clojure-emacs/cider/issues/2541): Hook properly CIDER's code completion machinery.

## 0.21.0 (2019-02-19)

Expand Down
8 changes: 4 additions & 4 deletions cider-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,7 @@ property."
(progn
(setq-local sesman-system 'CIDER)
(cider-eldoc-setup)
(make-local-variable 'completion-at-point-functions)
(add-to-list 'completion-at-point-functions
#'cider-complete-at-point)
(add-hook 'completion-at-point-functions #'cider-complete-at-point nil t)
(font-lock-add-keywords nil cider--static-font-lock-keywords)
(cider-refresh-dynamic-font-lock)
(font-lock-add-keywords nil cider--reader-conditionals-font-lock-keywords)
Expand All @@ -1050,6 +1048,7 @@ property."
(setq-local clojure-get-indent-function #'cider--get-symbol-indent))
(setq-local clojure-expected-ns-function #'cider-expected-ns)
(setq next-error-function #'cider-jump-to-compilation-error))
;; Mode cleanup
(mapc #'kill-local-variable '(completion-at-point-functions
next-error-function
x-gtk-use-system-tooltips
Expand All @@ -1059,7 +1058,8 @@ property."
(font-lock-add-keywords nil cider--reader-conditionals-font-lock-keywords)
(font-lock-remove-keywords nil cider--dynamic-font-lock-keywords)
(font-lock-remove-keywords nil cider--static-font-lock-keywords)
(cider--font-lock-flush)))
(cider--font-lock-flush)
(remove-hook 'completion-at-point-functions #'cider-complete-at-point t)))

(defun cider-set-buffer-ns (ns)
"Set this buffer's namespace to NS and refresh font-locking."
Expand Down
4 changes: 1 addition & 3 deletions cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -1676,9 +1676,6 @@ constructs."
(cider-repl-wrap-fontify-function font-lock-fontify-region-function))
(setq-local font-lock-unfontify-region-function
(cider-repl-wrap-fontify-function font-lock-unfontify-region-function))
(make-local-variable 'completion-at-point-functions)
(add-to-list 'completion-at-point-functions
#'cider-complete-at-point)
(set-syntax-table cider-repl-mode-syntax-table)
(cider-eldoc-setup)
;; At the REPL, we define beginning-of-defun and end-of-defun to be
Expand All @@ -1693,6 +1690,7 @@ constructs."
(cider-repl-history-load cider-repl-history-file)
(add-hook 'kill-buffer-hook #'cider-repl-history-just-save t t)
(add-hook 'kill-emacs-hook #'cider-repl-history-just-save))
(add-hook 'completion-at-point-functions #'cider-complete-at-point nil t)
(add-hook 'paredit-mode-hook (lambda () (clojure-paredit-setup cider-repl-mode-map))))

(provide 'cider-repl)
Expand Down

0 comments on commit 7ff083e

Please sign in to comment.