从.sh脚本启动Emacs时,Emacs无法看到Agda

3

我用以下代码编写了一个名为.sh的脚本:

#!/bin/sh
cd ~/Projects/Agda\ projects/
emacs

但是每次我启动它时,都会出现以下错误。

File is missing: Cannot open load file, no such file or directory, /bin/bash: agda-mode: command not found


To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

在这个会话中,agda的可执行文件不在PATH上,并且PATH与我在~/.bashrc中设置的不同。
我尝试过安装exec-path-from-shell,但这并没有解决问题。
手动从konsole启动emacs却能完美运行(原因不明)。
调试跟踪:
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "/bin/bash: agda-mode: command not found\n")
  load("/bin/bash: agda-mode: command not found\n" nil nil t)
  load-file("/bin/bash: agda-mode: command not found\n")
  eval-buffer(#<buffer  *load*> nil "/home/bratjuuc/.emacs" nil t)  ; Reading at buffer position 470
  load-with-code-conversion("/home/bratjuuc/.emacs" "/home/bratjuuc/.emacs" t t)
  load("~/.emacs" t t)
  #f(compiled-function () #<bytecode 0x1e0f4d>)()
  command-line()
  normal-top-level()

我该如何从 .sh 脚本中启动带有 agda-mode 的 emacs?

1
[emacs.se] 是一个更好的地方来询问这个问题。 - Barmar
现在有一个专门的StackExchange网站,专门针对证明助手。也许这比Emacs更合适。 - Trebor
1个回答

3
建议将环境上下文添加到您的脚本中。
#!/bin/sh
. ~/.profile
cd ~/Projects/Agda\ projects/
emacs

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接