; For printing log-messages use emacs' builtin message command: echo minibuffer
(defvar my-log (function message))

; Applications that can be started from this init file
; Format of each entry: (NAME . CMD)
(defvar my-invoke-cmds
  '((test . my-startup-test)         ; for testing startup procedure only
    (w3 . w3)                         ; www browser
    (mh-e . mh-rmail)     	      ; mh mail reader
    (vm . vm)     	              ; vm mail reader
    (rmail . rmail)       	      ; rmail mail reader
    (gnus . gnus)         	      ; news reader
    (tshell . tshell)     	      ; shell under emacs
    (gdb . gud)           	      ; GNU C debugger
    (edebug . edebug)     	      ; elisp debugger
    (calc . calc)     	      ; GNU calc desktop calculator
    (to-do . todo-show)     	      ; GNU calc desktop calculator
    (calendar . calendar)
    (diary . diary)
    ; games
    (gomoku . gomoku)
    (hanoi . hanoi)
    (get-comic . (lambda () 
		   (interactive)
		   (load-file "/u1/staff/hwloidl/Elisp/getcomics.el")
		   (get-daily-comic "dilbert")))
    (escreen . (lambda () 
		 (interactive) 
		 (load-file "/u1/staff/hwloidl/.emacs-elisp")
		 (mapcar (lambda (n) (escreen-create-screen))
			 (fromTo 2 (- escreen-max-screens escreen-current-screen-number)))))
    (multi-term . (lambda () 
		     (interactive) 
		     (multi-term ?x t)))
   ))

; define the commands to execute
(defvar my-invoke-list '(to-do calendar gomoku))

;; Now actually do the computations defined above
;; mapcar traverses the list my-invoke-list; for each list elementit executes
;; the corresponding command

(mapcar (function (lambda (x)
          (let ( (oldbuf (current-buffer))
                 (y (assoc x my-invoke-cmds)) )
           (if (null y)
              (funcall my-log (format "\nError: No cmd found for package %s" x))
            (if (not (commandp (cdr y)))
              (funcall my-log (format "\nError: %s is not an interactive fct" (cdr y)))
              (funcall my-log (format "= Starting package %s (cmd: %s)" (car y) (cdr y)))
             (funcall (cdr y)))))))
        my-invoke-list
)
