问题描述
我正在更新一些fortran 77代码以使用fortran 90结构,而emacs是我的主编。目前来源是固定的格式,不久以后就会改变(由于外部限制)。我可以选择的两个emacs主要模式是 fortran-mode
,它只突出显示fortran 77结构的语法(它不明白 module
或包含
等作为关键字,我觉得很讨厌,但它确实理解固定格式 - 必要时正确缩进代码)。我可以使用的另一个主要模式是 f90-mode
,但是,这样做的缩进都是错误的,这也是很烦人的。有没有办法从 f90-mode
中获取语法突出显示,但在 fortran-mode
中使用的缩进结构? 看起来这是真的可能。尝试将以下内容添加到您的配置文件中:
(require'f90)
(add-hook'fortran-mode -hook'f90-font-lock-2)
这只是按照,所以感谢应该流给用户!
I'm updating some fortran 77 code to use fortran 90 constructs and emacs is my editor of choice. Currently, the source is in fixed format and that isn't going to change any time soon (due to external constraints). The two emacs major modes that I can choose from are fortran-mode
which only highlights the syntax for fortran 77 constructs (It doesn't understand module
or contains
, etc. as keywords which I find pretty annoying, but it does understand fixed format -- correctly indenting the code where necessary). The other major mode I could use is f90-mode
, however, that gets the indentation all wrong which is also slightly annoying. Is there any way to get the syntax highlighting from f90-mode
, but the indentation structure used in fortran-mode
?
It looks like this is indeed possible. Try adding the following to your config file:
(require 'f90)
(add-hook 'fortran-mode-hook 'f90-font-lock-2)
This is just following the solution provided on emacs.stackexchange.com, so thanks should flow to user deprecated!
这篇关于可以使用固定格式的emacs f90-mode吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!