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

No fontification when used on a narrowed buffer #86

Open
wasamasa opened this issue Jul 29, 2015 · 12 comments
Open

No fontification when used on a narrowed buffer #86

wasamasa opened this issue Jul 29, 2015 · 12 comments
Assignees

Comments

@wasamasa
Copy link

I have some ruby code in a notes file with org-mode on, so I've narrowed to a region and enabled enh-ruby-mode. This did result in no fontification at all. Any idea what's going wrong here?

@zenspider
Copy link
Owner

This is just a guess... but it relies on sending the code out to a ruby server to parse it and it probably sends the whole thing and gets confused.

@zenspider zenspider self-assigned this Aug 7, 2015
@zenspider
Copy link
Owner

When I try this with a bash script w/ embedded ruby I get this in *Messages*:

Not enabling jit-lock: it does not work in indirect buffer [2 times]

Not sure what jit-lock is.

@zenspider
Copy link
Owner

;;; jit-lock.el --- just-in-time fontification  -*- lexical-binding: t -*-

So... maybe not my fault? Should try with a different language too.

@zenspider
Copy link
Owner

Nope... doesn't seem to work with any language in an indirect buffer.

@zenspider
Copy link
Owner

@wasamasa any feedback? I think this is more of a problem with emacs.

@wasamasa
Copy link
Author

I think this is more of a problem with enh-ruby-mode as I cannot reproduce this with a shell script embedding Scheme code.

cat << END > ~/.csirc
(load-verbose #f)
(unless (get-environment-variable "INSIDE_EMACS")
  (use (prefix readline "rl-"))
  (current-input-port (rl-make-readline-port))
  (rl-install-history-file
   #f (format "/.csi_history" (get-environment-variable "HOME"))))
END
echo 123

@zenspider
Copy link
Owner

I can't repro with your file.

  1. Create file "bug086.sh" and paste in your output.
  2. Select inner scheme code
  3. Run narrow-to-region-indirect
  4. In new narrowed buffer, try to activate scheme-mode

I get an error and the following in *Messages*:

Indentation setup for shell type bash
Mark set
Not enabling jit-lock: it does not work in indirect buffer [2 times]

@wasamasa
Copy link
Author

Why narrow-to-region-indirect (I don't have it as command here)? I'm speaking of regular narrow-to-region. If I replace step 3 with "Run M-x narrow-to-region", syntax highlighting works fine.

Here are the contents of an Org file for the Ruby case:

Foo

#+BEGIN_SRC
(0..10).each do |i|
  puts i
end
#+END_SRC

Bar

@Silex
Copy link

Silex commented Jun 18, 2019

narrow-to-region-indirect probably comes from here: https://demonastery.org/2013/04/emacs-narrow-to-region-indirect/

@zenspider
Copy link
Owner

Correct. And it uses narrow-to-region underneath so it should be roughly equivalent. Since I have the problem there too, I think the difference is probably fine.

@gcentauri
Copy link

gcentauri commented Jun 1, 2021

i'm experiencing something similar without explicitly using narrowing. source blocks in an org file do not get fontified properly with enh-ruby-mode. to recreate:

  • disable enh-ruby-mode from taking ruby buffers
  • org-src-lang-modes should either not have an entry for ruby or have ("ruby" . ruby)
  • create an org file and insert a ruby source block with some code
  • you should see fontified source
  • push or (add-to-list 'org-src-lang-modes '("ruby" . enh-ruby))
  • toggle org mode / reopen file / or rewrite the src lang (delete the y from ruby and put it back)
  • you should see improper fontification

I've tried to trace down what is going wrong, but I haven't made much progress. I have a guess that its related to the font lock keywords in enh-ruby-mode. I do see some keywords being highlighted and right now I have a string highlighted properly, but things like class def etc do not. They end up with the default org-block face. Running with plain ruby-mode they get the expected font lock faces.

Hopefully this is helpful! Thanks for the work on the package!

This potentially could be a separate issue, but seemed similar.

EDIT

you can recreate without pushing things to the org-src-lang-modes by changing the source block to use enh-ruby rather than ruby

@Andsbf
Copy link

Andsbf commented Dec 24, 2021

@gcentauri I have the same problem.

GNU Emacs 27.2
macos monterey 12.0.1
enh-ruby-mode 20210120.201

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

5 participants