-
Notifications
You must be signed in to change notification settings - Fork 5
/
auto-complete-distel.el
51 lines (40 loc) · 1.5 KB
/
auto-complete-distel.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;;; auto-complete-distel.el --- Erlang/distel completion backend for auto-complete-mode
;; Copyright (C) 2012 Sebastian Weddmark Olsson
;; Author: Sebastian Weddmark Olsson
;; URL: github.com/sebastiw/distel-completion
;; Version: 1.0.0
;; Package-Requires: ((auto-complete "1.4") (distel-completion-lib "1.0.0"))
;; Keywords: Erlang Distel auto-complete
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Add `auto-complete-distel' to the `ac-sources' list in your .emacs.
;; E.g.
;; (require 'auto-complete)
;; (require 'auto-complete-distel)
;; (add-to-list 'ac-sources 'auto-complete-distel)
;;
;; Customize
;; ------------------
;; Which syntax to skip backwards to find start of word.
;; (setq distel-completion-get-doc-from-internet t)
;;
;; Which syntax to skip backwards to find start of word.
;; (setq distel-completion-valid-syntax "a-zA-Z:_-")
;;; Code:
(require 'auto-complete)
(require 'distel-completion-lib)
(defvar auto-complete-distel
(list '(prefix . auto-complete-distel-get-start)
'(candidates . (distel-completion-complete ac-prefix (current-buffer)))
'(document . distel-completion-get-doc-string)
'(requires . 0)
'(symbol . "m"))
"All it takes to start a auto-complete backend.")
(defun auto-complete-distel-get-start ()
"Find a valid start of a completion word."
(save-excursion
(let ((distance (skip-chars-backward distel-completion-valid-syntax)))
(when (< distance 0)
(point)))))
(provide 'auto-complete-distel)
;;; auto-complete-distel.el ends here