
;; Assumes SETENV EMACSLIBRARY

(load "term/x-win.el")
(load "x-mouse.el")
(load "x-menu.el")

(define-key mouse-map x-button-middle 'x-mouse-set-mark)

(setq fill-column 75)
(setq text-mode-hook
	'(lambda () (auto-fill-mode 1)))
(setq mail-archive-file-name "~/mail-folders/outgoing")

(fset 'my-indent-region
  "4indent-reg
")
(global-set-key "\C-x*lt" 'my-indent-region)

;;				-[Fri Sep 14 00:17:21 1990 by layer]-
;; Sample .emacs file
;;
;; $Header: dot.emacs,v 1.4 90/10/09 10:48:25 layer Exp $

(load "fi/site-init.el")

;; the following causes fi:common-lisp to give the inferior Common
;; Lisp, by default, a command line argument of `+ipc-unix' or `+ipc-internet':
;;
(setq fi:common-lisp-image-arguments
  (if fi:unix-domain '("+ipc-unix") '("+ipc-internet")))

;; turn on superkeys in subprocess modes
;;
(setq-default fi:subprocess-enable-superkeys t)

;; the following causes fi:common-lisp to invoke the image `cl', but
;; to ask for an image name when given a prefix argument:
;;
(setq fi:common-lisp-image-name
  '(lambda ()
    (let ((image "cl"))
      (if current-prefix-arg
	  (setq image
	    (read-file-name (format "cl image (default: %s): " image)
			    default-directory image nil)))
      (setq mode-line-buffer-identification
	(format "%s (%s)" (buffer-name) (file-name-nondirectory image)))
      image)))

;; This redefines `kill-emacs' so that transaction files in /tmp are
;; removed emacs is killed:
;;
(fset 'old-kill-emacs (symbol-function 'kill-emacs))
(defun kill-emacs (&optional arg)
  (interactive "P")
  (fi:remove-all-temporary-lisp-transaction-files)
  (old-kill-emacs arg))


;; Some fancy things you can do in your subprocess mode hook
;;
(setq fi:subprocess-mode-hook
  '(lambda ()
    (interactive)
    (setq mode-line-process '(": %s"))
    (define-key (current-local-map) "\C-i" 'fi:shell-do-completion)
    (define-key (current-local-map) "\C-z" nil)
    
    (setq mode-line-buffer-identification
      (list (buffer-name)
	    (let* ((proc (get-buffer-process (current-buffer)))
		   (name (and proc (calculate-process-name proc))))
	      (if name
		  (format " (%s)" (file-name-nondirectory name))))
	    'package-mode-info))
    (setq fi:shell-popd-regexp (default-value 'fi:shell-popd-regexp))
    (setq fi:shell-pushd-regexp (default-value 'fi:shell-pushd-regexp))
    (setq fi:shell-cd-regexp (default-value 'fi:shell-cd-regexp))))

(defun calculate-process-name (process)
  (let ((arglist (process-command process))
	(res nil)
	el)
    (cond ((or (string= "env" (car arglist))
	       (string= (concat exec-directory "env") (car arglist)))
	   (while (and (not res) (setq arglist (cdr arglist)))
	     (setq el (car arglist))
	     (cond 
	       ((or (string= "-s" el) (string= "-set" el))
		(setq arglist (cdr (cdr arglist))))
	       ((or (string= "-u" el) (string= "-unset" el))
		(setq arglist (cdr arglist)))
	       ((string-match "=" el))
	       ((or (string= "-" el) (string= "--" el)))
	       (t 
		(if (not
		     (or (string= "env" el)
			 (string= (concat exec-directory "env") el)))
		    (if (string= "rsh" el)
			(setq res (car (cdr arglist)))
		      (setq res el))))))
	   res)
	  (t (car arglist)))))

;; From older (23 Jan 90) Allegro .emacs

(defvar fi:common-lisp-file-types '(".cl" ".lisp" ".lsp"))

(define-key ctl-x-map "l" 'fi:common-lisp)
(setq auto-mode-alist
  (cons '("\\.cl$" . fi:common-lisp-mode) auto-mode-alist))
