Skip to content

Commit

Permalink
Merge branch 'master' of github.com:auto-complete/auto-complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomohiro Matsuyama committed Aug 29, 2012
2 parents 655470a + fee7ac3 commit 78b5c39
Show file tree
Hide file tree
Showing 7 changed files with 2,355 additions and 14 deletions.
20 changes: 18 additions & 2 deletions auto-complete-config.el
Expand Up @@ -143,7 +143,11 @@
(with-no-warnings
(if (fboundp 'yas/get-snippet-tables)
;; >0.6.0
(apply 'append (mapcar 'ac-yasnippet-candidate-1 (yas/get-snippet-tables major-mode)))
(apply 'append (mapcar 'ac-yasnippet-candidate-1
(condition-case nil
(yas/get-snippet-tables major-mode)
(wrong-number-of-arguments
(yas/get-snippet-tables)))))
(let ((table
(if (fboundp 'yas/snippet-table)
;; <0.6.0
Expand All @@ -166,16 +170,27 @@
(defun ac-semantic-candidates (prefix)
(with-no-warnings
(delete "" ; semantic sometimes returns an empty string
(mapcar 'semantic-tag-name
(mapcar '(lambda (elem)
(cons (semantic-tag-name elem)
(semantic-tag-clone elem)))
(ignore-errors
(or (semantic-analyze-possible-completions
(semantic-analyze-current-context))
(senator-find-tag-for-completion prefix)))))))

(defun ac-semantic-doc (symbol)
(let* ((proto (semantic-format-tag-summarize-with-file symbol nil t))
(doc (semantic-documentation-for-tag symbol))
(res proto))
(when doc
(setq res (concat res "\n\n" doc)))
res))

(ac-define-source semantic
'((available . (or (require 'semantic-ia nil t)
(require 'semantic/ia nil t)))
(candidates . (ac-semantic-candidates ac-prefix))
(document . ac-semantic-doc)
(prefix . c-dot-ref)
(requires . 0)
(symbol . "m")))
Expand All @@ -184,6 +199,7 @@
'((available . (or (require 'semantic-ia nil t)
(require 'semantic/ia nil t)))
(candidates . (ac-semantic-candidates ac-prefix))
(document . ac-semantic-doc)
(symbol . "s")))

;; eclim
Expand Down
23 changes: 13 additions & 10 deletions auto-complete.el
Expand Up @@ -98,7 +98,7 @@
:type 'boolean
:group 'auto-complete)

(defcustom ac-use-fuzzy t
(defcustom ac-use-fuzzy (and (locate-library "fuzzy") t)
"Non-nil means use fuzzy matching."
:type 'boolean
:group 'auto-complete)
Expand Down Expand Up @@ -194,7 +194,8 @@
ecmascript-mode javascript-mode js-mode js2-mode php-mode css-mode
makefile-mode sh-mode fortran-mode f90-mode ada-mode
xml-mode sgml-mode
ts-mode)
ts-mode
sclang-mode)
"Major modes `auto-complete-mode' can run on."
:type '(repeat symbol)
:group 'auto-complete)
Expand Down Expand Up @@ -622,10 +623,10 @@ If there is no common part, this will be nil.")
(defun ac-mode-dictionary (mode)
(loop for name in (cons (symbol-name mode)
(ignore-errors (list (file-name-extension (buffer-file-name)))))
for dir in ac-dictionary-directories
for file = (concat dir "/" name)
if (file-exists-p file)
append (ac-file-dictionary file)))
append (loop for dir in ac-dictionary-directories
for file = (concat dir "/" name)
if (file-exists-p file)
append (ac-file-dictionary file))))

(defun ac-buffer-dictionary (&optional buffer)
(with-current-buffer (or buffer (current-buffer))
Expand Down Expand Up @@ -943,7 +944,7 @@ You can not use it in source definition like (prefix . `NAME')."
(setq point nil))
(if point
(setq prefix-def prefix))))

if (equal prefix prefix-def) do (push source sources)

finally return
Expand Down Expand Up @@ -1351,6 +1352,7 @@ that have been made before in this function."

;;;; Auto completion commands

;;;###autoload
(defun auto-complete (&optional sources)
"Start auto-completion at current point."
(interactive)
Expand Down Expand Up @@ -1379,7 +1381,7 @@ that have been made before in this function."
(defun ac-fuzzy-complete ()
"Start fuzzy completion at current point."
(interactive)
(when (require 'fuzzy nil)
(when (require 'fuzzy nil t)
(unless (ac-menu-live-p)
(ac-start))
(let ((ac-match-function 'fuzzy-all-completions))
Expand Down Expand Up @@ -1435,7 +1437,7 @@ that have been made before in this function."
(ac-complete)
(when (and (ac-inline-live-p)
ac-common-part)
(ac-inline-hide)
(ac-inline-hide)
(ac-expand-string ac-common-part (eq last-command this-command))
(setq ac-common-part nil)
t)))
Expand Down Expand Up @@ -1955,7 +1957,8 @@ completion menu. This workaround stops that annoying behavior."

(defun ac-filename-candidate ()
(let (file-name-handler-alist)
(unless (or (string-match comment-start-skip ac-prefix)
(unless (or (and comment-start-skip
(string-match comment-start-skip ac-prefix))
(file-regular-p ac-prefix))
(ignore-errors
(loop with dir = (file-name-directory ac-prefix)
Expand Down

0 comments on commit 78b5c39

Please sign in to comment.