emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Can I use a custom mode for org-src-lang-modes and still get syntax highlighting?
@ 2017-10-07 12:57 david wen riccardi-zhu
  2017-10-07 15:02 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: david wen riccardi-zhu @ 2017-10-07 12:57 UTC (permalink / raw)
  To: emacs-orgmode

I'm trying to get syntax highlighting with org-mode source blocks 
using a custom language mode for editing JavaScript. I use 
js2-mode with a bunch of minor modes, rather than js-mode, which 
is what org-mode uses by default.

I was able to get org-mode to use js2-mode for editing code by 
customizing org-src-lang-modes, where I set the Cons-cell for 
javacript to js2.

However, syntax highlighting has stopped working in the org buffer 
(it works fine in the source buffer). This is with 
org-src-fontify-natively set to true, which the documentation 
suggests is the only requirement.

Is there anything I'm missing?

Thank you,
David

-- 
dwrz|朱为文

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Can I use a custom mode for org-src-lang-modes and still get syntax highlighting?
  2017-10-07 12:57 Can I use a custom mode for org-src-lang-modes and still get syntax highlighting? david wen riccardi-zhu
@ 2017-10-07 15:02 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2017-10-07 15:02 UTC (permalink / raw)
  To: david wen riccardi-zhu; +Cc: emacs-orgmode

Hello,

david wen riccardi-zhu <dwrz@dwrz.net> writes:

> I'm trying to get syntax highlighting with org-mode source blocks
> using a custom language mode for editing JavaScript. I use js2-mode
> with a bunch of minor modes, rather than js-mode, which is what
> org-mode uses by default.
>
> I was able to get org-mode to use js2-mode for editing code by
> customizing org-src-lang-modes, where I set the Cons-cell for
> javacript to js2.
>
> However, syntax highlighting has stopped working in the org buffer (it
> works fine in the source buffer). This is with
> org-src-fontify-natively set to true, which the documentation suggests
> is the only requirement.
>
> Is there anything I'm missing?

`org-src-font-lock-fontify-block' uses the same mechanism as
`org-edit-src-code' to determine what major mode to load. IOW, it should
work out of the box.

Could you provide an ECM?

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-07 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-07 12:57 Can I use a custom mode for org-src-lang-modes and still get syntax highlighting? david wen riccardi-zhu
2017-10-07 15:02 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).