;; init.lsp - newLISP initialization file
;; gets loaded from either HOME/.init.lsp or NEWLISPDIR/init.lsp
;; NEWLISPDIR typically is /usr/share/newlisp on Mac OS X and other Unix
;; and c:/Program Files/newlisp on MS Windows
;;

;; newLISP v. 10.1.11 or later required

;; edits a function
;;
;; usage: (edit foo)
;;
;; this will open and edit window for editing
;; a functioon called "foo". After saving and 
;; exiting the editor newLISP will reload the
;; function, which is also available in a file 
;; with the same name. Only for unix like OSs
;;

(if (< (& 0xF (last (sys-info))) 5)
  (begin
    (define-macro (edit _func)
	(save (string "/tmp/" _func) _func)
	(! (string "/usr/bin/vi /tmp/" _func))
	(load (string "/tmp/" _func)))
    (global 'edit)))


;; this needs an installation of lynx, a character based web browser
;; loads very fast, quickly exit with Ctrl-C
;;

(define-macro (help func)
   (if (primitive? (eval func))
       (let (func-name (term func))
            (if (ends-with func-name "?") (replace "?" func-name "p")) 
       (!  (format "lynx /usr/share/doc/newlisp/newlisp_manual.html#%s" func-name)))
   (format "%s is not a built-in function" (term func))))

;;;; end of file ;;;;


