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

Documentation pop up text shows "^M" on Windows #5

Closed
wrn opened this issue Aug 23, 2012 · 4 comments
Closed

Documentation pop up text shows "^M" on Windows #5

wrn opened this issue Aug 23, 2012 · 4 comments

Comments

@wrn
Copy link

wrn commented Aug 23, 2012

Now the text will show fully in the pop up, but the end of line "^M" are still there. Can be fixed with an extra replace-regexp-in-string "\r" "".

(defun ac-nrepl-documentation (symbol)
"Return documentation for the given SYMBOL, if available."
(substring-no-properties
(replace-regexp-in-string "\r" "" ;; remove "^M" on Windows
(replace-regexp-in-string
"^( |-------------------------\r?\n)" ""
(plist-get (nrepl-send-string-sync
(format "(clojure.repl/doc %s)" symbol)
(nrepl-current-ns))
:stdout)))))

@purcell
Copy link
Member

purcell commented Aug 24, 2012

Hmm, okay, I see what you mean; I think it's probably due to having unix line endings in your source code files, but windows line endings for the backend. I'm not sure that your fix is safe in all configurations, but let's try it and see what happens.

@wrn
Copy link
Author

wrn commented Aug 24, 2012

Thanks for taking the fix. I did not test it on Linux so maybe other people can verify it works there.

I don't think the cause is related to my source code file. This happens in a nREPL client buffer. I think it is due to Clojure "doc" function or/and its internal doc string storage. Given Java (and hence Clojure) is supposed to be cross-platform yet the line-endings cannot adapt to the local OS, that does not give a good first impression for people using Windows. I hope someone can fix the issue in Clojure.

@purcell
Copy link
Member

purcell commented Aug 24, 2012

Consider also the possibility that popup.el (used by auto-complete) is not handling the native line endings correctly. I'm not convinced that there's anything wrong with Java or Clojure's behaviour here.

@wrn
Copy link
Author

wrn commented Aug 25, 2012

That's possible but does not seem like the case, because even the string displayed with "(doc list)" in a nREPL buffer, or with M-x nrepl-doc has the extra "^M". I even looked at the hex bytes of the doc string and clearly there is an extra "\r" character at every line ending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants