3

I made an .sh script with the following code

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

But whenever I launch it I get the following error

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.

In this session agda's executable isn't on the PATH and PATH differs from what I have in ~/.bashrc

I have tried installing exec-path-from-shell but that didn't solve the problem.

Launching emacs from konsole manually works flawlessly for some reason.

Debug trace:

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

How do I launch emacs with agda-mode from an .sh script?

  • 1
    [emacs.se] would be a better place to ask this. – Barmar Mar 27 '22 at 09:14
  • There's now a dedicated StackExchange site for [proof assistants](https://proofassistants.stackexchange.com). Maybe that's even more suitable than Emacs. – Trebor Mar 27 '22 at 10:57

1 Answers1

3

suggesting to add environment context to your script.

#!/bin/sh
. ~/.profile
cd ~/Projects/Agda\ projects/
emacs
Dudi Boy
  • 4,551
  • 1
  • 15
  • 30