0

This question already has an answer here:

I'm new to emacs, does anybody know is there a way to combine xml-mode and sql-mode so SQL code inside tags can be highlighted and proper indent?

example

<FnTable ID="MyCode">

  declare @ID bigint = @p0

  select * from Company.Table where ID = @ID 

</FnTable>

marked as duplicate by Tobias, Drew, DoMiNeLa10 Apr 10 at 15:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Your question qualifies as duplicate of that question about "Multiple major modes in one buffer". Therefore it should be closed.

Nevertheless, since you are new to Emacs I give you below a modified version of the code block from the accepted answer of the duplicate that should solve your problem. Copy that code block into your init file, which is most often one of ~/.emacs or ~/.emacs.d/init.el.

If you use that code block make sure that you have installed mmm-mode. You can check or run the installation of mmm-mode with the menu item Options->Manage Emacs Packages. See the manual page about Emacs packages for other ways of managing packages.

(require 'mmm-auto)
(mmm-add-classes
 '((nxml-sql
    :submode sql-mode
    :face mmm-default-submode-face
    :front "<FnTable\\( ID=\".*\"\\)?>\n"
    :back "</FnTable>\n")))

(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class 'nxml-mode nil 'nxml-sql)

Not the answer you're looking for? Browse other questions tagged or ask your own question.