Do not duplicate "~" in path when completing

fixes #26
This commit is contained in:
Takafumi Arakaki 2012-07-25 19:34:21 +02:00
parent 232b5644a9
commit b90e18f1ff

View file

@ -40,6 +40,12 @@
:type 'integer
:group 'ein)
(defvar ein:ac-syntax-table
(let ((table (make-syntax-table ein:dotty-syntax-table)))
(modify-syntax-entry ?~ "w" table)
table)
"`ein:dotty-syntax-table' plus \"~\" considered as a word character.")
(defvar ein:ac-cache-matches nil)
(defvar ein:ac-direct-matches nil
@ -66,7 +72,7 @@ compatibility with `ein:completer-finish-completing-default'."
(setq ein:ac-direct-matches matches) ; let-binding won't work
(setq ein:ac-cache-matches (append matches ein:ac-cache-matches))
(run-with-idle-timer 1 nil #'ein:ac-clear-cache)
(with-syntax-table ein:dotty-syntax-table
(with-syntax-table ein:ac-syntax-table
(auto-complete '(ac-source-ein-direct))))
(defun ein:ac-clear-cache ()
@ -119,7 +125,7 @@ first candidate when the `ac-menu' pops up."
"Monkey patch `auto-complete' internal function to enable
dotty completion."
(if (or ein:notebook (ein:eval-if-bound 'ein:@connect))
(with-syntax-table ein:dotty-syntax-table
(with-syntax-table ein:ac-syntax-table
ad-do-it)
ad-do-it))