質問

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))

他のヒント

This is a common request, so AUCTeX has created a mechanism for that: customize TeX-modes to the list of modes for which you want to use.

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)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top