Skip to main content
deleted 22 characters in body
Source Link
phils
  • 53.1k
  • 3
  • 84
  • 127

The cwd for that shell command will be based on the default-directory for the active buffer at the time your file is loaded; not the directory in which the loaded file resides.

You need to utilise the load-file-name variable.

(let ((default-directory (file-name-directory
                          (expand-file-name load-file-name))))
  (shell-command-to-string ...))
(let ((default-directory (file-name-directory load-file-name)))
  (shell-command-to-string ...))

The cwd for that shell command will be based on the default-directory for the active buffer at the time your file is loaded; not the directory in which the loaded file resides.

You need to utilise the load-file-name variable.

(let ((default-directory (file-name-directory
                          (expand-file-name load-file-name))))
  (shell-command-to-string ...))

The cwd for that shell command will be based on the default-directory for the active buffer at the time your file is loaded; not the directory in which the loaded file resides.

You need to utilise the load-file-name variable.

(let ((default-directory (file-name-directory load-file-name)))
  (shell-command-to-string ...))
Source Link
phils
  • 53.1k
  • 3
  • 84
  • 127

The cwd for that shell command will be based on the default-directory for the active buffer at the time your file is loaded; not the directory in which the loaded file resides.

You need to utilise the load-file-name variable.

(let ((default-directory (file-name-directory
                          (expand-file-name load-file-name))))
  (shell-command-to-string ...))