 
 (defun ac-activate-mode-map ()
   "Activate `ac-complete-mode-map'."
-  (setq ac-saved-local-map overriding-terminal-local-map)
-  (if (eq ac-saved-local-map ac-complete-mode-map)
-      ;; maybe never reach here
-      (setq ac-saved-local-map nil))
-  (setq overriding-terminal-local-map ac-complete-mode-map))
+  (if ac-override-local-map
+      (progn
+        (setq ac-saved-local-map overriding-terminal-local-map)
+        (if (eq ac-saved-local-map ac-complete-mode-map)
+            ;; maybe never reach here
+            (setq ac-saved-local-map nil))
+        (setq overriding-terminal-local-map ac-complete-mode-map))
+    ;; rearrange ac-mode-map pair first
+    (assq-delete-all 'ac-completing minor-mode-map-alist)
+    (push (cons 'ac-completing ac-complete-mode-map) minor-mode-map-alist)))
 
 (defun ac-deactivate-mode-map ()
   "Deactivate `ac-complete-mode-map'."
-  (when (eq overriding-terminal-local-map ac-complete-mode-map)
+  (when (and ac-override-local-map
+             (eq overriding-terminal-local-map ac-complete-mode-map))
     (setq overriding-terminal-local-map ac-saved-local-map)
     (setq ac-saved-local-map nil)))
 

;; - use cl
;; - icon
;; - refactoring (especially menu)

;;; Code:



    map)
  "Keymap for completion.")

(defvar ac-saved-local-map nil
  "Old keymap before `auto-complete' activated.")
