Use the completing-read
command. The function will look like
(defun app () (interactive) (let ((app-name (completing-read "Run application: " program-list))) (async-shell-command app-name)))
It might be more idiomatic to use interactive
instead of assigning a variable according to Emacs Lisp Idioms: user input request
(defun app (app-name) (interactive (list (completing-read "Run application: " app-list))) (async-shell-command app-name))
You can also use (start-process app-name nil app-name)
instead of (async-shell-command app-name)
if you do not need an output process according to Run the program from Emacs and do not wait for the exit .
See Minibuffer Termination for more ideas on termination in Emacs and Asynchronous Processes for invoking processes from Emacs, as in the GNU manual.
source share