   (let ((name (buffer-name buf)))
     (cond
      ((eq nil (buffer-file-name buf)) nil)
+     ;; TODO: figure out why we added these. buffer-file-name should be nil.
      ((string= name floobits-message-buffer-name) nil)
      ((string= name "*Messages*") nil)
      (t t))))

(defun floobits-add-hooks ()
  (add-hook 'after-change-functions 'floobits-after-change nil nil)
  (add-hook 'after-revert-hook 'floobits-after-revert nil nil)
  (if (> emacs-major-version 23)
      (progn
        (add-hook 'post-command-hook 'floobits-send-highlight nil nil)
        (add-hook 'buffer-list-update-hook 'floobits-buffer-list-change nil nil))
    (add-hook 'post-command-hook 'floobits-post-command-func nil nil))
  (add-hook 'after-save-hook 'floobits-after-save-hook nil nil)
  (add-hook 'minibuffer-exit-hook 'floobits-minibuffer-exit-hook nil nil)
  ;; (add-hook 'buffer-list-update-hook 'floobits-buffer-list-change nil nil)
  (ad-enable-advice 'delete-file 'before 'floobits-delete-file)
  (ad-enable-advice 'rename-file 'before 'floobits-rename-file)
  (ad-activate 'delete-file)
  (ad-activate 'rename-file))

(defun floobits-remove-hooks ()
  (remove-hook 'after-change-functions 'floobits-after-change)
  (remove-hook 'after-revert-hook 'floobits-after-revert)
  (if (> emacs-major-version 23)
      (progn
        (remove-hook 'post-command-hook 'floobits-send-highlight)
        (remove-hook 'buffer-list-update-hook 'floobits-buffer-list-change))
    (remove-hook 'post-command-hook 'floobits-post-command-func))

  (remove-hook 'after-save-hook 'floobits-after-save-hook)
  (remove-hook 'minibuffer-exit-hook 'floobits-minibuffer-exit-hook)
  (ad-disable-advice 'delete-file 'before 'floobits-delete-file)
  (ad-disable-advice 'rename-file 'before 'floobits-rename-file))

(defadvice delete-file (before floobits-delete-file (name &optional trash))
  (when (floobits-path-is-shared name)
    (if (member "delete_buf" floobits-perms)
        (floobits-send-to-agent (list (cons 'path name)) 'delete_buf)
      (message "You don't have permission to delete buffers in this workspace."))))

(defadvice rename-file (before floobits-rename-file
                               (old-name new-name &optional OK-IF-ALREADY-EXISTS))
  ;; ignore renames for files ending in ~ since they're probably backups
  (when (and (floobits-path-is-shared old-name) (not (string= "~" (substring new-name -1))))
    (if (member "rename_buf" floobits-perms)

;; Package-Requires: ((json "1.2") (highlight "0"))
;; Package-Version: 1.5.22
;; URL: http://github.com/Floobits/floobits-emacs
;; Version: 24.0
;;
;;; Commentary:
;;
