Skip to content

syohex/choice-program

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Invoke Programs With Choice Options

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 93.5%
  • Makefile 4.7%
  • Shell 1.8%