unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Better way to make sure external command exists in the system?
Date: Thu, 18 Mar 2021 15:13:02 +0300	[thread overview]
Message-ID: <courier.00000000605343D7.0000202D@stw1.rcdrun.com> (raw)

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










             reply	other threads:[~2021-03-18 12:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 12:13 Jean Louis [this message]
2021-03-19 13:57 ` Better way to make sure external command exists in the system? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=courier.00000000605343D7.0000202D@stw1.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).