简体   繁体   中英

start C-x e editor in sh-mode

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. 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 -*- )?

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-*. You can set a file association to match this filename:

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

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