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 does not show proper font face #749

Closed
johnbendi opened this issue Aug 25, 2014 · 42 comments
Closed

cider does not show proper font face #749

johnbendi opened this issue Aug 25, 2014 · 42 comments

Comments

@johnbendi
Copy link

The font face after upgrading to cider 0.8.0-snapshot does not display properly. I only get white text.
Also cider reports that cider-nrepl is not 0.8.0-snapshot when I already have 0.8.0-SNAPSHOT in project.clj.

@bbatsov
Copy link
Member

bbatsov commented Aug 25, 2014

I can't understand what you mean. Please, provide more details, examples, etc.

@johnbendi
Copy link
Author

Usually repl output is displayed with a color, now it doesn't. Is there anything I can check. Everything was just fine for me before the upgrade. Now I have to start tracking where the colorless output is coming from.

Also when I jack in to a headless connection I get the message:

; CIDER 0.8.0snapshot (package: 20140824.212) (Java nil, Clojure 1.6.0, nREPL 0.2.3)
WARNING: The following required nREPL ops are not supported: 
macroexpand macroexpand-1 macroexpand-all resource undef
Please, install (or update) cider-nrepl 0.8.0-snapshot and restart CIDER

when I can confirm that I have cider-nrepl 0.8.0-SNAPSHOT on my path.

Hope that's clear enough? I wish I can explain it any better. Maybe you can give suggestion of what you'll like me to report back.

@bbatsov
Copy link
Member

bbatsov commented Aug 26, 2014

How are you using cider-nrepl? Are you enabling middleware individually in project.clj?

@johnbendi
Copy link
Author

I have something like this in my project.clj. Is that what you mean?:

:dependencies [[cider/cider-nrepl "0.8.0-SNAPSHOT"]]
:repl-options {:nrepl-middleware
                      [cemerick.piggieback/wrap-cljs-repl
                       ;;bizlogic.nrepl.middleware.debug-nrepl/wrap-debug-nrepl
                       cider.nrepl.middleware.classpath/wrap-classpath
                       cider.nrepl.middleware.complete/wrap-complete
                       cider.nrepl.middleware.info/wrap-info
                       cider.nrepl.middleware.inspect/wrap-inspect
                       cider.nrepl.middleware.stacktrace/wrap-stacktrace
                       cider.nrepl.middleware.trace/wrap-trace]}

@bbatsov
Copy link
Member

bbatsov commented Aug 27, 2014

The reason you get a warning is that you haven't enabled all the middleware (see cider-nrepl's readme). Using the cider-nrepl plugin is more convenient because t spares you from having to update this list manually.

@bbatsov
Copy link
Member

bbatsov commented Aug 28, 2014

I can confirm the missing colours issue, but I haven't located the problem yet. It was probably introduced by 09dcec9 as this is the only significant change we've done recently. //cc @Vitoshka

@bbatsov
Copy link
Member

bbatsov commented Aug 28, 2014

Investigated and debugged this a bit - everything seems to be executing fine, but no text properties get applied in cider-propertize-region. Guess figuring this out might take a while...

@vspinu
Copy link
Contributor

vspinu commented Aug 28, 2014

I don't see any color problem. All colors are in place for me. Which emacs is this?

@bbatsov
Copy link
Member

bbatsov commented Aug 28, 2014

GNU Emacs 24.4.50.1 (x86_64-apple-darwin13.2.0, NS appkit-1265.20 Version 10.9.3 (Build 13D65))

The font faces were applied properly in the REPL before the nrepl-client refactoring, so the two must be related somehow, although I cannot see how.

@vspinu
Copy link
Contributor

vspinu commented Aug 28, 2014

Here is GNU Emacs 24.4.50.5 (i686-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2014-05-23

I also find it hard to understand why nrepl refactoring would impact fontification; cider-repl was barely touched. This is what I see:

cider

Is this normal?

When cider-pretty-printing is on then no colors are there, but that always was the case:

cider1

@bbatsov
Copy link
Member

bbatsov commented Aug 28, 2014

@Vitoshka Are you sure you're running the latest code? On two separate computers I get this:

screen shot 2014-08-28 at 23 52 37

@johnbendi
Copy link
Author

@bbatsov that's exactly the output I get. Also notice how the Java version is not recognized. But If you upgrade to nREPL 0.2.4 the Java version appears but you loose your println. Some rought edges to tidy up there. Well done guys, you are doing a great job!

@vspinu
Copy link
Contributor

vspinu commented Aug 29, 2014

Are you sure you're running the latest code?

I am pretty sure, admitedly with a slight confusion. I have a disabled MELPA version and I still see (package: 20140424.1313) in the header. From your screenshot I see that you are probably doing the same. I will check tomorrow again.

@bbatsov
Copy link
Member

bbatsov commented Aug 29, 2014

From your screenshot I see that you are probably doing the same.

I always install the latest MELPA package to check if I didn't break it accidentally.

@vspinu
Copy link
Contributor

vspinu commented Aug 29, 2014

I have just tried the MELPA version and I could reproduce your problem -- no color. Then I have completely removed my MELPA and used the git master and the color came back:

cider2

@bbatsov
Copy link
Member

bbatsov commented Aug 29, 2014

Might be some byte-compilation issue. Those are often very hard to track down.

@vspinu
Copy link
Contributor

vspinu commented Aug 29, 2014

For some reason when CIDER is loaded from MELPA my customization doesn't get into effect. So cider-repl-use-clojure-font-lock where still the default nil. All my cider versions are now highlighting as expected. Check out that var.

@johnbendi
Copy link
Author

What to do is not clear.

@johnbendi
Copy link
Author

I've just set that variable to t, restarted emacs and yet no sign of color. I can also confirm from ielm buffer that cider-repl-use-clojure-font-lock is still true after restarting. Maybe you should look at all the defaults in the cider-repl custom group cos I can see some settings talking about prompt face, input face, output face to be sure something is not clashing withthe other.

@bbatsov
Copy link
Member

bbatsov commented Aug 29, 2014

For some reason when CIDER is loaded from MELPA my customization doesn't get into effect. So cider-repl-use-clojure-font-lock where still the default nil. All my cider versions are now highlighting as expected. Check out that var.

This var is not related to the prompt font-locking at all. Whatever the problem is - it's not config related.

@bbatsov
Copy link
Member

bbatsov commented Aug 29, 2014

People interested to help debug this should look into functions like cider-repl-emit-prompt (https://github.com/clojure-emacs/cider/blob/master/cider-repl.el#L433) and cider-repl-emit-result (https://github.com/clojure-emacs/cider/blob/master/cider-repl.el#L442). For some reason cider-propertize-region doesn't seem to work anymore, which is extremely odd.

@johnbendi
Copy link
Author

It's worth noting that this issue does not only affect output values. Font lock when typing input is really not like that for clojure-mode except for the string. That said I examined buffer local variables for a clojure-mode buffer and a cider-repl-mode buffer and there are some significant differences between their font-lock-keywords. It might be worth taking a look to see if this is normal.

@vspinu
Copy link
Contributor

vspinu commented Aug 29, 2014

I am afraid I cannot help with the issue. It works for me whatever I do. Both with cider-repl-use-clojure-font-lock set or not I get the expected output.

I think this entire fontification in repl part must be rewritten anyways to use standard emacs jit-lock engine. It's faster, works at idle time and you won't have to type without color anymore. I will do that once I figured out the comint part.

@bbatsov
Copy link
Member

bbatsov commented Aug 29, 2014

I am afraid I cannot help with the issue. It works for me whatever I do. Both with cider-repl-use-clojure-font-lock set or not I get the expected output.

In my tests even the REPL prompt and the results are not properly font-locked. Guess I'll continue investigating this.

I think this entire fontification in repl part must be rewritten anyways to use standard emacs jit-lock engine. It's faster, works at idle time and you won't have to type without color anymore. I will do that once I figured out the comint part.

No comint mode I've used does this, so I'm guessing it's not easy.

@johnbendi
Copy link
Author

I'm currently using (add-hook 'cider-repl-mode-hook 'clojure-font-lock-setup) to solve my input font lock problems. Still looking hard at the source. I just hope there's no quarrel between clojure-mode and cider-repl-mode because of all the divergence I see in there.

Especially the propertize and cider-propertize-region that has refused to play ball

@johnbendi
Copy link
Author

Possible suspect: PARENFACE!

The guys over at parenface love us and have helped us include their wonderful parenface font lock keywords to the cider-repl-mode-hook without further consideration.

Two possible solutions:

  1. Remove parenface and enjoy original desired behavior as per cider-repl-mode.
  2. Use clojure-font-lock-setup the way I pasted above while parenface is uninstalled. Or modify parenface to call clojure-font-lock-setup.

I prefer the former of the 2nd choice because fontification is on while I type whereas with cider-propertize-region the fontification is done when I return.

Cheers!

@johnbendi
Copy link
Author

The only issue I have now is how to customize my prompt when going the clojure-font-lock-setup way. Please I'll appreciate the shortest way to go about this and other customization with clojure-font-lock-setup.

@bbatsov
Copy link
Member

bbatsov commented Aug 30, 2014

Possible suspect: PARENFACE!

I don't use it, so this can't be the root of the problem.

@johnbendi
Copy link
Author

Make sure there are no surprises from other packages by checking your cider-repl-mode-hook. That's was where I tracked down my own problem. cider-propertize-region is now working well including my custom golden prompt! But it remains a challenge to do in clojure-font-lock.

@bbatsov
Copy link
Member

bbatsov commented Sep 13, 2014

Seems to me the problem is caused by rainbow-delimiters - when I disabled it the REPL colours came back. I've been using this package for a long while, so I'm assuming they recently changed something.

@vspinu
Copy link
Contributor

vspinu commented Sep 13, 2014

Seems to me the problem is caused by rainbow-delimiters - when I disabled it the
REPL colours came back. I've been using this package for a long while, so I'm
assuming they recently changed something.

I am also using it but haven't updated for months. This is probably why
I haven't seen the problem.

@bbatsov
Copy link
Member

bbatsov commented Sep 14, 2014

We should probably report this on rainbow-delimiters issue tracker.

@ghost
Copy link

ghost commented Sep 14, 2014

I haven't got rainbow-delimiters installed and this issue exists.

@bbatsov
Copy link
Member

bbatsov commented Sep 14, 2014

@Zebrah Other minor-mode might interfere as well. @johnbendi suggested that parenface was causing problems as well. Try running cider without anything in cider-repl-mode-hook.

@ghost
Copy link

ghost commented Sep 14, 2014

@bbatsov The only thing I have is paredit-mode (I evalled cider-repl-mode-hook in a scratch buffer). When I remove paredit-mode from cider-repl-mode-hook, the bug still exists.

@bbatsov
Copy link
Member

bbatsov commented Sep 14, 2014

Can't imagine how you can have the same problem then. Can you post a screenshot of your REPL buffer?

@ghost
Copy link

ghost commented Sep 14, 2014

Sure:
image

@bbatsov
Copy link
Member

bbatsov commented Sep 14, 2014

Do a C-h m in the REPL and post here the enabled minor modes. I'm pretty sure that if you try running only cider with a clean Emacs config the problem will not be present, so it has to be some global minor mode.

@ghost
Copy link

ghost commented Sep 14, 2014

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption Blink-Cursor Eldoc File-Name-Shadow Font-Lock Global-Font-Lock Global-Pretty Iswitchb Line-Number Menu-Bar Mouse-Wheel Pretty Recentf Shell-Dirtrack Show-Paren Tooltip Transient-Mark

edit. So I disabled pretty-mode and it is now showing font-locked repl output after I hit enter:
image

@bbatsov
Copy link
Member

bbatsov commented Sep 14, 2014

Only pretty-mode seems like a potential culprit to me, but I can't be certain.

@ghost
Copy link

ghost commented Sep 14, 2014

That's correct, check my edit :)

@bbatsov
Copy link
Member

bbatsov commented Sep 14, 2014

Glad to hear that. Now we have to understand why those modes interfere with the our font-locking technique... (which will probably take a while)

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

3 participants