简体   繁体   English

安装AUCTeX时,将乳胶模式设置为.emacs中的默认模式

[英]Set latex mode to default in .emacs when AUCTeX is installed

We have a server which has AUCTeX installed for writing latex in emacs. 我们有一台安装了AUCTeX的服务器,用于在emacs中编写乳胶。 Currently it is set as the major mode. 当前将其设置为主模式。 Is it possible to change the latex mode to the default one in .emacs so that users who don't want to use AUCTeX can use the default mode? 是否可以将.emacs中的乳胶模式更改为默认模式,以便不想使用AUCTeX的用户可以使用默认模式? Also, will it be possible to set keys for default latex commands after that? 另外,之后是否可以为默认的乳胶命令设置键? For example, one user has following line in his .emacs file 例如,一个用户的.emacs文件中包含以下行

(global-set-key "\\M-]" 'tex-close-latex-block)

Currently it is showing the error Symbol's function definition is void: tex-close-latex-block . 当前,它显示错误Symbol's function definition is void: tex-close-latex-block

The following should unload the system installed auctex, it is mentioned in the manual here , try to have it early in your init file so that it is executed 'before any of its modes have been used' 应卸载系统安装auctex下,它的说明书中提及这里 ,试着在你的init文件早期有它让“之前任何一种模式已被用于”这是执行

(unload-feature 'tex-site)

This will actually work for any emacs package. 这实际上适用于任何emacs软件包。

Also, will it be possible to set keys for default latex commands after that? 另外,之后是否可以为默认的乳胶命令设置键? For example, one user has following line in his .emacs file 例如,一个用户的.emacs文件中包含以下行

You can wrap it in eval-after-load so that the keybinding is set only on when the file is loaded. 您可以将其包装在eval-after-load以便仅在文件加载时设置键绑定。 I do not use auctex, I am assuming that tex-site is the name of the file that loads auctex 我不使用auctex,我假设tex-site是加载auctex的文件的名称

(eval-after-load 'tex-site
    '(global-set-key "\M-]" 'tex-close-latex-block))

这是一个常见的请求,因此AUCTeX为此创建了一种机制:将TeX-modes自定义为要使用的模式列表。

Whenever there are more than two modes for one thing and I prefer only one, I hook the modes I don't like so that they start the mode I like. 每当一件事情有两种以上的模式,而我只喜欢一种时,我会钩住我不喜欢的模式,以便它们启动我喜欢的模式。 That works even if the mode line explicitly requests the mode I don't like. 即使模式行明确请求我不喜欢的模式,该方法也有效。 Here's an example where I tell emacs to prefer perl mode over cperl mode: 这是一个示例,我告诉emacs比cperl模式更喜欢perl模式:

(add-hook 'cperl-mode-hook 'perl-mode)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM