我正在尝试让emacs认识到一个脚本(应该是源代码)是用bash编写的。我把
# this is a -*- bash -*- script
在第一行,但它仍在sh
模式下打开。我可以通过将#!/usr/bin/env bash
放在第一行来使其工作,但我不愿意这样做,因为它使脚本看起来像它的可执行文件,而我希望它来源。为什么emacs没有识别我的提示?
答案 0 :(得分:1)
您可以使用以下内容:
# -*- mode: shell-script ; eval: (sh-set-shell "bash") -*-
但是Emacs会问你是否真的想要执行不安全的代码。