What is a simple way to combine two Emacs major modes, or to change an existing mode?

孤者浪人 提交于 2019-12-23 08:50:08

问题


In Emacs, I'm working with a file that is a hybrid of two languages.

Question 1: Is there a simple way to write a major mode file that combines two major modes?

Details:

  • The language is called "brew" (not the "BREW" of "Binary Runtime Environment for Wireless").

  • brew is made up of the languages R and Latex, whose modes are R-mode and latex-mode.

  • The R code appears between the tags <% and %>. Everything else is Latex.

  • How can I write a brew-mode.el file? (Or is one already available?)

One idea, which I got from this posting, is to use Latex mode, and treat the code of the form <% ... %> as a comment.


回答1:


A number of folks have written solutions enabling you to use multiple major modes at once. See the Emacs Wiki for Multiple Modes. I personally have no experience with them and cannot recommend one over another.



来源:https://stackoverflow.com/questions/2738322/what-is-a-simple-way-to-combine-two-emacs-major-modes-or-to-change-an-existing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!