See here for unformatted version.
;;If already making use of a desktop (through xemacs -f desktop-read), save it when buffers are updated.
(defun save-desktop ()
  (if desktop-dirname
;;      (ding t)))
      (desktop-save "/home/office/tconnors/")
    'true));;last line is to make sure it succeeds so we can go further!


(add-hook 'after-set-visited-file-name-hooks 'save-desktop)
;(add-hook 'find-file-hooks 'save-desktop)
;(add-hook 'kill-buffer-hook 'save-desktop)

;;(defun do-you-really-want-to-save-buffers-kill-emacs ()
;;  "avoids premature ejection"
;;  (interactive)
;;  (if (yes-or-no-p "Really? ")
;;      (save-buffers-kill-emacs)
;;    (message "stop jerking me around")))
;;(global-set-key "\C-x\C-c"
;;'do-you-really-want-to-save-buffers-kill-emacs)

(defun yes-or-no-p (prompt)
  "replace tedious yes/no+enter with y/n keypress"
  (ding t)
  (y-or-n-p prompt))



(defun check-vc-checkin ()
  "checks whether the file is registered with VC, every time it is saved"
  (message "Checking whther file is registered for VC")
  (if (vc-registered (buffer-file-name))
      (auto-vc-checkin)
    (message "Not registered with VC. Not checking in and out.")))

(defun auto-vc-checkin ()
  "checks in the file if it is registered"
  (message "Is registered. Checking in.")
  (vc-checkin (buffer-file-name) (vc-workfile-version (buffer-file-name)) "autocheckin");;dont increment the version number when utomatically checking in.
;;  (vc-next-action t)
  (message "Checked in. Checking out again.")
;;  (vc-next-action t))
  (vc-checkout-writable-buffer))

;;(add-hook 'after-save-hook 'check-vc-checkin)