bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33984: 26.1; fortune-compile does not search exec-path for strfile p


From: Benjamin Ragheb
Subject: bug#33984: 26.1; fortune-compile does not search exec-path for strfile program
Date: Fri, 04 Jan 2019 21:54:28 -0500
User-agent: Cyrus-JMAP/3.1.5-739-g7452a1e-fmstable-20190103v1

I am using Emacs 26.1 on macOS 10.14.2 Mojave. macOS does not include the 
fortune or strfile programs, so I install them using MacPorts, which places 
them in /opt/local/bin. By default, that directory is not on the PATH, so I 
have the following line in init.el:

    (add-to-list 'exec-path "/opt/local/bin")

With this setup, running M-x fortune works as expected (because the fortune 
command uses call-process to invoke the fortune program).

However, M-x fortune-compile fails with this error:

    /bin/bash: strfile: command not found

I have determined this is because fortune-compile passes the value of the 
fortune-strfile variable directly to shell-command, which does not consult 
exec-path.

I have attached a patch which corrects this problem by using executable-find 
before calling shell-command. If strfile cannot be found, it signals an error.

I tried to keep the patch as small as possible, and resisted the temptation to 
replace the call to shell-command with call-process. Doing so would have broken 
compatibility with the fortune-quiet-strfile-options variable, which people may 
have customized.

Attachment: fortune.el.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]