Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
;; Google Suggest で補完
(defun google-suggest ()
(setq ac-source-mysource1-point ac-point)
(let (result buf (case-fold-search nil))
(setq buf (get-buffer-create "*google-suggest*"))
(if (string-match "^[A-Z]" ac-prefix)
(with-current-buffer buf
(call-process "/Users/youpy/work/google_suggest.rb" nil buf nil ac-prefix)
(setq result (mapcar (lambda (str)
(concat ac-prefix ":" str))
(split-string (buffer-string)))))
(append result (list ac-prefix))
(defun google-suggest-delte-prefix()
(let (cur)
(setq cur (point))
(goto-char ac-source-mysource1-point)
(search-forward ":" nil t)
(goto-char cur)
(delete-region ac-source-mysource1-point (match-end 0))))
(defvar ac-source-mysource1-point)
(defvar ac-source-mysource1
'((candidates . (google-suggest))
(prefix . "[^a-z]\\(.*\\)")
(symbol . "g")
(action . google-suggest-delte-prefix)))
;; 全てのバッファの`ac-sources`の末尾に辞書情報源を追加
(defun ac-common-setup ()
(setq ac-sources (append ac-sources '(ac-source-mysource1))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment