(defun my-shell-mode ()
    (interactive)
;   (load-file "~/emacs/lib/kshell.el")
;   (load "kshell.el")
    (shell)
    (my-shell-bindings)
    (message "DID BINDINGS")
    (setq comint-output-filter-functions
	  (append comint-output-filter-functions (list 'shell-strip-ctrl-m)))
    (setq comint-process-echoes t)
    (require 'shellext)
;   (local-set-key "	" 'shell-filename-expand)
;Looks like something funky might be hapening when a file is
; inserted to a shell buffer -- like it tries to execute the
; who thing as a shell command.  Not quite sure about this,
; but we'll not take any chances right now till things are
; figured out.
;    (switch-to-buffer "*shell*")
;    (if (file-exists-p "shell")
;      (insert-file "shell"))
;    (end-of-buffer)
;    (set-mark (point))
;    (write-file "shell")
;    (load-file "~/emacs/lib/shellext.el")
    (process-kill-without-query (get-process "shell"))
)

(defun my-shell-bindings ()
    (interactive)
    (message "in my-shell-bindings")
    (message (concat "buffer name =" (buffer-name)))
    (local-unset-key "n")
    (local-unset-key "p")
    (local-set-key "" 'comint-next-input)
    (local-set-key "" 'comint-previous-input)
)

(defun my-shell-mode-file ()
    (interactive)
    (switch-to-buffer "*shell*")
    (insert-file "shell")
    (kill-buffer "shell")
    (write-file "shell")
    (end-of-buffer)
    (shell)
    (set-mark (point))
)