简体   繁体   中英

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

We have a server which has AUCTeX installed for writing latex in 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? 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

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

Currently it is showing the error 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'

(unload-feature 'tex-site)

This will actually work for any emacs package.

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

You can wrap it in eval-after-load so that the keybinding is set only on when the file is loaded. I do not use auctex, I am assuming that tex-site is the name of the file that loads 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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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