home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / functions / bg-shell.el < prev    next >
Encoding:
Text File  |  1990-07-22  |  1.8 KB  |  46 lines

  1. ;From utkcs2!emory!samsung!uunet!mcsun!hp4nl!mhres!jv Wed Jun 13 10:56:29 EDT 1990
  2. ;Article 4437 of comp.emacs:
  3. ;Xref: utkcs2 comp.emacs:4437 gnu.emacs:2964
  4. ;Path: utkcs2!emory!samsung!uunet!mcsun!hp4nl!mhres!jv
  5. ;>From: jv@mh.nl (Johan Vromans)
  6. ;Newsgroups: comp.emacs,gnu.emacs
  7. ;Subject: Re: Release two of CMU process modes  (background.el)
  8. ;Message-ID: <JV.90Jun13143702@squirrel.mh.nl>
  9. ;Date: 13 Jun 90 20:37:02 GMT
  10. ;References: <9601@pt.cs.cmu.edu>
  11. ;Sender: news@mhres.mh.nl
  12. ;Reply-To: Johan Vromans <jv@mh.nl>
  13. ;Organization: Multihouse Automation, the Netherlands
  14. ;Lines: 27
  15. ;In-reply-to: shivers@a.gp.cs.cmu.edu's message of 12 Jun 90 06:20:17 GMT
  16. ;
  17. ;In article <9601@pt.cs.cmu.edu> shivers@a.gp.cs.cmu.edu (Olin Shivers) writes:
  18. ;> This message contains:
  19. ;> 2. A shar file for background.el and cmutex.el
  20. ;
  21. ;Since I have been working with a background-type function for some
  22. ;time, I want to share the following function. Its main function is to
  23. ;background a shell command if it terminates with '&'; bind it to your
  24. ;favourite 'execute-shell-command' key (e.g. "\e!") and enjoy.
  25. ;
  26. ;; ================ (a)synch shell command execution ================
  27. ;;
  28. (defvar my-last-scommand nil)
  29.  
  30. (defun my-scommand (command &optional flag)
  31.   "Runs shell command asynchrounous, or synchrounous if terminated
  32. with \"&\""
  33.   (interactive (list (read-string "Shell command: " my-last-scommand)
  34.              current-prefix-arg))
  35.   (setq my-last-scommand command)
  36.   (if (string-match "&$" command)
  37.       (background (substring command 0 -1))
  38.     (shell-command command flag)))
  39. ;--
  40. ;Johan Vromans                       jv@mh.nl via internet backbones
  41. ;Multihouse Automatisering bv               uucp: ..!{uunet,hp4nl}!mh.nl!jv
  42. ;Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62944/62500
  43. ;------------------------ "Arms are made for hugging" -------------------------
  44. ;
  45.  
  46.