(define-key ac-menu-map (kbd "SPC")
(defun ac-complete-with-space ()
"Select the candidate and append a space. save your time for typing space."
(interactive)
(ac-complete)
(insert " ")
;; ;; FIXME: auto insert two spaces.
;; (if (pre-char before point is *only* not whitespace)
;; (insert " "))
))
(add-hook 'org-mode-hook
(lambda ()
(define-key ac-menu-map (kbd "SPC") 'self-insert-command)))