简体   繁体   English

在sh模式下启动Cx e编辑器

[英]start C-x e editor in sh-mode

emacs: 23.3.1, zsh: 4.3.17, gnome-terminal: 3.4.1.1 emacs:23.3.1,zsh:4.3.17,gnome-terminal:3.4.1.1

My default major mode is text-mode. 我的默认主要模式是文本模式。

When invoking Cx e in gnome-terminal I would like to set emacs to use sh-mode because it's very likely the mode I would set manually anyways. 在gnome-terminal中调用Cx e ,我想将emacs设置为使用sh-mode,因为无论如何我很可能会手动设置该模式。 How to do so? 怎么做?

Possible solution - Is there a way to create a template file for the Cx e cmd (to add a heading: # -*- mode: sh -*- )? 可能的解决方案-有没有办法为Cx e cmd创建模板文件(添加标题: # -*- mode: sh -*- )?

Solution: 解:

;; open C-x e editor in sh-mode                                                                      
(setq auto-mode-alist (cons '("\\(^\\|/\\)zshec[^/]*$" . sh-mode) auto-mode-alist))

The files opened with Cx e are always with the filename bash-fc-*. 用Cx e打开的文件始终使用文件名bash-fc- *。 You can set a file association to match this filename: 您可以设置文件关联以匹配此文件名:

(setq auto-mode-alist (cons '("bash-fc-*" . sh-mode) auto-mode-alist))

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

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