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

Cider 0.23.0 fails on Emacs 25 #2733

Closed
mat5n opened this issue Oct 18, 2019 · 2 comments
Closed

Cider 0.23.0 fails on Emacs 25 #2733

mat5n opened this issue Oct 18, 2019 · 2 comments
Labels
bug good first issue A simple tasks suitable for first-time contributors

Comments

@mat5n
Copy link

mat5n commented Oct 18, 2019

Expected behavior

Cider should support Emacs 25.1+.

The most recent version of Aquamacs is based on version 25.3 of Emacs so support for this version would be highly appreciated.

Actual behavior

Typing a symbol in the REPL results in the following error:

Debugger entered--Lisp error: (wrong-number-of-arguments (lambda (string) "Remove trailing whitespace from STRING." ...
  cider-symbol-at-point()
  cider-eldoc-info-at-point()
  cider-eldoc-info-in-current-sexp()
  cider-eldoc()
  eldoc-print-current-symbol-info()
  ...

The problem seems to be cider-symbol-at-point which calls string-trim-right in subr-x.el with an additional regexp argument. However, this signature does not exist in version 25 of Emacs.

My temporary workaround was to add cider-string-trim-right to cider-util.el with the definition of string-trim-right from Emacs 26.

Environment & Version information

CIDER version information

;; CIDER 0.23.0 (Lima), nREPL 0.6.0
;; Clojure 1.10.0, Java 1.8.0_222

Lein/Boot version

Leiningen 2.9.1 on Java 1.8.0_222 OpenJDK 64-Bit Server VM

Emacs version

Aquamacs 3.5 based on GNU Emacs 25.3.50.1

Operating system

macOS Mojave

@bbatsov
Copy link
Member

bbatsov commented Oct 20, 2019

Hmm, my bad. I didn't notice this signature was something new. I'll figure out some alternative that's compatible with Emacs 25.

@bbatsov bbatsov added bug good first issue A simple tasks suitable for first-time contributors labels Oct 20, 2019
@mat5n
Copy link
Author

mat5n commented Oct 21, 2019

What's interesting is that the unit tests have passed in spite of the wrong call signature. I think this is due to a couple of issues working in tandem.

First, the byte compiler is happy to inline a function even though it's invoked with too many arguments. It does print an error about this (see Circle CI logs) but it isn't a fatal one. Whether an error results at call time seems to depend. It's not simply a version issue. Even on Aquamacs 3.5 I've managed to call inlined functions with too many arguments without errors. The extra arguments are simply dropped which also seems to be the case here when the tests are run.

Second, it appears to me, if I understand the test code correctly, that some of the assertions are made in a temporary buffer that's not in Clojure mode. This means that thing-at-point behaves not as intended (it sees periods as boundaries etc.). Consequently, the two assertions below succeed although they shouldn't.

(with-temp-buffer
  (insert "SomeRecord.")
  (expect (cider-symbol-at-point) :not :to-be-truthy)
  (expect (cider-symbol-at-point 'look-back) :to-equal "SomeRecord"))

I don't think the first assertion should succeed in any circumstances. If I place the cursor right after Foo. and eval (cider-symbol-at-point) the result is "Foo" (with the correct code).

All in all, it's regrettable that Emacs behaves so insidiously here. Calling a function with too many arguments should never just silently succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue A simple tasks suitable for first-time contributors
Projects
None yet
Development

No branches or pull requests

2 participants