unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Better way to make sure external command exists in the system?
@ 2021-03-18 12:13 Jean Louis
  2021-03-19 13:57 ` Daniel Martín
  0 siblings, 1 reply; 15+ messages in thread
From: Jean Louis @ 2021-03-18 12:13 UTC (permalink / raw)
  To: Help GNU Emacs

I have changed the OS on one computer and noticed that my Emacs Lisp
programs use external commands like: mailutils, mail, pandoc,
markdown, and others. Sometimes I was hard coding the path names like
/usr/local/bin and now some commands changed to /usr/bin

And some functions should not even run if external command does not
exist. I would even like to stop loading the .el program if necessary
external programs do not exist in the system.

For that reason I would do some changes:

- instead of hard coding the program name within quotes, I will use
  variable. Instead of (shell-command "mogrify ...") I will rather use
  something like (shell-command (format "%s ..." mogrify-command))

- variables for commands I would place at beginning of programs

- before variables get defined, I would use `executable-find' but I
  would like for the program loading to fail if those external
  programs cannot be found.

Is it then recommended to use something like:

(defun check-my-executables ()
  ...)

(check-my-executables)

during the loading time?

Jean










^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-03-25 21:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-18 12:13 Better way to make sure external command exists in the system? Jean Louis
2021-03-19 13:57 ` Daniel Martín
2021-03-19 14:16   ` 2QdxY4RzWzUUiLuE
2021-03-21 14:10     ` Jean Louis
2021-03-21 17:17       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-21 14:07   ` Jean Louis
2021-03-21 17:16     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-23  8:02       ` Jean Louis
2021-03-23  9:56         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-23 10:13           ` Jean Louis
2021-03-25 15:01             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-25 15:17               ` Jean Louis
2021-03-25 20:47                 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-25 20:56                   ` Jean Louis
2021-03-25 21:10                     ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).