                       ))
 ;; ----------------
 
-(defvar two-mode-update 0)
+(defvar two-mode-update nil)
 (defvar two-mode-mode-idle-timer nil)
 (defvar two-mode-bool nil)
 (defvar two-mode-mode-delay (/ (float 1) (float 8)))

(setq two-mode-switch-hook nil)

(defun two-mode-mode-setup ()
  (make-local-hook 'post-command-hook)
  (add-hook 'post-command-hook 'two-mode-mode-need-update nil t)
  (make-local-variable 'minor-mode-alist)
  (make-local-variable 'two-mode-bool)
  (setq two-mode-bool t)
  (when two-mode-mode-idle-timer
    (cancel-timer two-mode-mode-idle-timer))
  (setq two-mode-mode-idle-timer
        (run-with-idle-timer two-mode-mode-delay t
                             'two-mode-mode-update-mode))
  (or (assq 'two-mode-bool minor-mode-alist)
      (setq minor-mode-alist
            (cons '(two-mode-bool " two-mode") minor-mode-alist))))

(defun two-mode-mode-need-update ()
  (setq two-mode-update 1))

(defun two-mode-change-mode (to-mode func)
  (if (string= to-mode mode-name)
      t
    (progn
      (funcall func)
      ;; After the mode was set, we reread the "Local Variables" section.
      ;; We do need this for example in SGML-mode if "sgml-parent-document"

;; multiple modes, so I suppose that 'two-mode-mode' isn't strictly
;; accurate anymore.

;; Modified May 2010 by Steve Vinoski to work with emacs 23.

;; configure these:
(defvar default-mode (list "SGML" 'sgml-mode))
(defvar second-modes (list
