 (defvar ac-source-abbrev
   `((candidates
      . (lambda ()
-         (all-completions ac-prefix local-abbrev-table)))
+         (append
+          (all-completions ac-prefix global-abbrev-table)
+          (all-completions ac-prefix local-abbrev-table))))
     (action
      . expand-abbrev))
   "Source for abbrev.")


(defun ac-adaptive-candidate-filter (candidates)
  "Filter candidates according to length and history (not yet)."
  (if (> (length candidates) 1)
      (let ((length (length ac-prefix)))
        (delq nil
              (mapcar (lambda (candidate)
                        (if (> (- (length candidate) length) 2)
                            candidate))
                      candidates)))
    candidates))

(defun ac-trigger-command-p ()
  "Return non-nil if `this-command' is a trigger command."

     (nthcdr ac-menu-scroll ac-candidates))
    ;; If only one candidate is remaining,
    ;; make the candidate menu disappeared.
    ;(if (eq (- (length ac-candidates) ac-menu-scroll) 1)
    ;    (ac-menu-hide-line ac-menu ac-menu-offset))
    ;; Ensure lines visible
    (if (and (> ac-menu-direction 0)
             (> i (-
