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

markdown mmm scala #6571

Closed
wookietreiber opened this issue Jul 13, 2016 · 11 comments
Closed

markdown mmm scala #6571

wookietreiber opened this issue Jul 13, 2016 · 11 comments
Projects

Comments

@wookietreiber
Copy link

wookietreiber commented Jul 13, 2016

Description

I am using the markdown layer and have a markdown file containing Scala code. I would like to have syntax highlighting for the Scala code blocks. I guess this can be done with mmm.

I checked the mmm-mode via SPC h SPC and Scala is missing from mmm-add-classes.

Also, I don't know and cannot find any documentation about how to enable mmm within the markdown layer.

Reproduction guide

  • Start Emacs
  • open a markdown file with Scala code blocks

Observed behavior:

  • Scala code blocks are colored uniformly

Expected behavior:

  • Scala code blocks are colored with Scala-specific syntax highlighting

System Info

  • OS: gnu/linux
  • Emacs: 24.5.1
  • Spacemacs: 0.105.21
  • Spacemacs branch: master (rev. 0283f64)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: hybrid
  • Completion: helm
  • Layers:
(auto-completion emacs-lisp git lua markdown scala)
@TheBB
Copy link
Collaborator

TheBB commented Jul 14, 2016

Also, I don't know and cannot find any documentation about how to enable mmm within the markdown layer.

It's enabled, you just need to add scala to the list.

https://github.com/syl20bnr/spacemacs/blob/develop/layers/+lang/markdown/packages.el#L159-L208

@wookietreiber
Copy link
Author

@TheBB Am I supposed to or not to edit this file as a user? I thought I was only supposed to edit the ~/.spacemacs file.

@cbrst
Copy link
Contributor

cbrst commented Jul 15, 2016

@wookietreiber No, you're not. But you can put mmm-add-class and mmm-add-mode-ext-class in your ~/.spacemacs, too.

To answer your second question, mmm is automatically activated. ,cs calls mmm-parse-buffer to make it pick up code blocks.

@TheBB
Copy link
Collaborator

TheBB commented Jul 15, 2016

@wookietreiber I was suggesting you make a pull request with this contribution, but @crshd beat you to it.

We're all users and developers here, if you can excuse my idealism. :-P

@wookietreiber
Copy link
Author

@crshd To which section? dotspacemacs/user-init?

@TheBB Yeah, sure :-) I would contribute, too, but I'm not that well versed yet with spacemacs to feel comfortable enough.

@TheBB
Copy link
Collaborator

TheBB commented Jul 15, 2016

You can't do it in user-init, mmm won't be available that soon. As a rule, the only thing you can do there is to set variables.

@cbrst
Copy link
Contributor

cbrst commented Jul 15, 2016

Nope, but in dotspacemacs/user-config.

@wookietreiber
Copy link
Author

wookietreiber commented Jul 15, 2016

Ok, I tested this: my dotspacemacs/user-config now looks like this:

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  (mmm-add-classes '((markdown-scala
                      :submode scala-mode
                      :face mmm-declaration-submode-face
                      :front "^```scala[\n\r]+"
                      :back "^```$")))
  (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-scala)
  )

This is the file I'm editing. I hit , c s and there is a message in the bottom status bar:

Symbols value as variable is void: ensime-mode-key-prefix.

The code is not highlighted. Apparently, this does not work for non-ensime projects (ensime is sort of an IDE for Scala in emacs which gets loaded with scala-mode).

Is there a way to disable ensime for the Scala mode only within mmm? Something like :submode scala-mode WITHOUT ENSIME?


I tested the same with a Python code block and syntax highlighting works there and the message in the status bar reads:

MMM-ifying buffer...done

@cbrst
Copy link
Contributor

cbrst commented Jul 15, 2016

Possibly related to #6578

I'm not sure about disabling ensime for mmm-mode, but as a temporary solution, (require 'ensime) in your dotspacemacs/user-config seems to also fix this problem.

Since I don't know Scala (or ensime, for that matter), I cannot say if this will break other things, but it does make the highlighting work.

@wookietreiber
Copy link
Author

I can confirm adding (require 'ensime) to dotspacemacs/user-config works.

syl20bnr pushed a commit that referenced this issue Apr 29, 2017
CodingSolo pushed a commit to CodingSolo/spacemacs that referenced this issue Oct 29, 2018
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
@lebensterben lebensterben moved this from Pending fix to To close in Bugs Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Bugs
To close
Development

No branches or pull requests

5 participants