home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gwm18a.zip / contrib / command_menus / README
Internet Message Format  |  1995-07-03  |  3KB

  1. From: uwe@snoopy.niif.spb.su (Valeriy E. Ushakov)
  2. Message-Id: <9409301950.AA00492@snoopy.niif.spb.su>
  3. Subject: gwmsh etc...
  4. To: colas@mirsa.inria.fr
  5. Date: Fri, 30 Sep 1994 22:50:36 +0300 (MSK)
  6. In-Reply-To: <199409290958.AA22263@arthur.inria.fr> from "Colas Nahaboo" at Sep 29, 94 10:58:51 am
  7. Organization: Physics Institute of St.Petersburg State Universisty
  8. X-Operating-System: SunOS 4.1.3C 8
  9. X-Phone: +7 (812) 428-45-27
  10. X-Mailer: ELM [version 2.4 PL23]
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset=ISO-8859-8
  13. Content-Transfer-Encoding: 8bit
  14. Content-Length: 2854      
  15.  
  16. Hi, Colas!
  17.  
  18. Here is also a little package of command templates menu. A xterm with
  19. specified command is started.
  20.  
  21. ;;;;     --- from my-menus.gwm ---
  22. ;; List of templates with default values:
  23. ;;(cmd-type ((formal1 default1 ...) (strings that makes up a command )))
  24. (: command-template-list
  25.    '(Rlogin ((host "localhost" user ())
  26.          ("rlogin " host " -8"  (if user (+ " -l " user))))
  27.      Telnet ((host "localhost" port ())
  28.          ("telnet " host (if port (+ " " port))))
  29.      Mud    ((world ())
  30.          ("tf " (if world world)))))
  31.  
  32. ;; Sample commands to place in the menu.
  33. ;; Actual params for templates are given here.
  34. (: command-list
  35.    ;;  Title       Cmd     Actual params
  36.    '(("Doors"      Rlogin (host "doors"))
  37.      ("Dux"        Rlogin (host "dux.spb.su"))
  38.      ("Base"       Rlogin (host "base.dux.spb.su"))
  39.      ("Phim"       Telnet (host "phim1"))
  40.      ("Snark.Smtp" Telnet (host "snark" port "25"))
  41.      ("Unter"      Mud)
  42.      ("SunCircle"  Mud    (world "SunCircle"))))
  43.  
  44. ;; Place this menu to root pop-up
  45. (insert-at '(item-make "Commands..." (std-pop-menu cmd-pop))
  46.        root-pop-items 4)
  47.  
  48. ;;;; --- def-menus.gwm initialisation  ---
  49.   (for screen (list-of-screens)
  50.        .......
  51.        (setq cmd-items
  52.          '(menu-make (pop-label-make "Commands")))
  53.  
  54.        ;; uh-oh... Any simpler way to do this?
  55.        (for cmd command-list
  56.      (with (cmd-name (# 0 cmd)
  57.         cmd-type (# 1 cmd)
  58.         cmd-args (# 2 cmd))
  59.        (with (cmd-template (# cmd-type command-template-list))
  60.          (with (cmd-defaults (# 0 cmd-template)
  61.                     cmd-parts    (# 1 cmd-template))
  62.            (with-eval cmd-defaults
  63.              (with-eval cmd-args
  64.            (with-eval (list 'command (+ (list '+) cmd-parts))
  65.                      (: cmd-items
  66.             (+ cmd-items
  67.                (list (list 'item-make (+ cmd-type " " cmd-name)
  68.                        (list '! "/bin/sh" "-c"
  69.                          (+ "xterm +ls -T " cmd-name " -n " cmd-name
  70.                         " -e " command)))))))))))))
  71.  
  72.        (: cmd-pop (eval cmd-items))
  73.        .....
  74.    )
  75.  
  76. Best regards!
  77.  
  78. SY, Uwe.
  79. --------
  80. Valeriy E. Ushakov (aka Uwe)            |       Zu Grunde kommen
  81. uwe@niif.spb.su                         |       Ist zu Grunde gehen
  82.