Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.6 KB

README.md

File metadata and controls

50 lines (39 loc) · 1.6 KB

Invoke Programs With Choice Options

This is an Emacs module that invokes a command line program that requires an a string of enumerations as input. An example is the mnemonic option of the synconf program. The enumeration of choices offered by the command line program are then read as a completing user input in Emacs.

Usage

You must create an instance of the choice-prog class and specify the program with options. For the synconf program you'd add the following to your ~/.emacs init file:

(defvar synconf-the-instance
  (choice-prog nil
	       :program "synconf"
	       :interpreter "perl"
	       :buffer-name "*Synchronized Output*"
	       :choice-prompt "Mnemonic"
	       :choice-switch-name "-m"
	       :selection-args '("-a" "listmnemonics")
	       :documentation
"Run a synchronize command.  The command is issued with the `synconf'
perl script.")
  "The synconf object instance.")

(choice-prog-create-exec-function 'synconf-the-instance)

If you'd like add the configuration in another config file you can use add the following:

;;;###autoload
(defun synconf (&optional rest) (interactive))
(choice-prog-create-exec-function 'synconf-the-instance)

This adds the configuration file to autoloads (pattern matching on the interactive function synconf). Then the subsequent call to choice-prog-create-exec-function clobbers the empty interactive definition with that which invokes the command line program.

License

Copyright © 2017 Paul Landes

GNU Lesser General Public License, Version 2.0