Lines Matching defs:completion

6 ;; completion to provide code completion results for C, Objective-C,
8 ;; code-completion results in a secondary buffer based on the code
15 ;; completion based on Clang. It needs your help to make it better!
17 ;; To use the Clang code completion mode, first make sure that the
20 ;; clang-completion-mode.el somewhere in your Emacs load path. You can
33 ;; (load-library "clang-completion-mode")
37 ;; M-x customize-group RET clang-completion-mode RET
39 ;; Finally, to try Clang-based code completion in a particular buffer,
40 ;; use M-x clang-completion-mode. When "Clang" shows up in the mode
41 ;; line, Clang's code-completion is enabled.
43 ;; Clang's code completion is based on parsing the complete source
46 ;; options, etc.) to provide code-completion results. Currently, these
57 :group 'clang-completion-mode)
64 :group 'clang-completion-mode)
66 ;;; The prefix header to use with Clang code completion.
67 (setq clang-completion-prefix-header "")
69 ;;; The substring we will use to filter completion results
70 (setq clang-completion-substring "")
72 ;;; The current completion buffer
73 (setq clang-completion-buffer nil)
87 (setq clang-completion-prefix-header
88 (read-string "Clang prefix header> " "" clang-completion-prefix-header
91 ;; Process "filter" that keeps track of the code-completion results
94 (defun clang-completion-stash-filter (proc string)
103 (defun is-completion-line (line)
105 (string-match (concat "COMPLETION: " clang-completion-substring) line)))
109 (defun clang-completion-display (buffer)
114 (completion-lines (filter 'is-completion-line all-lines)))
115 (if (consp completion-lines)
127 ;; Insert the code-completion string into the process buffer.
129 (insert (mapconcat 'identity completion-lines "\n")))
132 ;; Process "sentinel" that, on successful code completion, replaces the
133 ;; contents of the code-completion buffer with the new code-completion results
135 (defun clang-completion-sentinel (proc event)
144 (cc-pch (if (equal clang-completion-prefix-header "") nil
146 (concat clang-completion-prefix-header ".pch"))))
151 `("-code-completion-at" ,cc-point)
154 ;; Start the code-completion process.
157 ;; If there is already a code-completion process, kill it first.
162 (setq clang-completion-substring "")
164 (setq clang-completion-buffer cc-buffer-name)
169 (set-process-filter cc-proc 'clang-completion-stash-filter)
170 (set-process-sentinel cc-proc 'clang-completion-sentinel)
173 ;; Code-completion when one of the trigger characters is typed into
184 (setq clang-completion-substring (thing-at-point 'symbol))
187 (clang-completion-display clang-completion-buffer)
191 ;; update the filter for the currently-active code completion.
199 ;; for the currently-active code completion.
206 ;; for the currently-active code completion.
213 (defvar clang-completion-mode-map nil
216 (if (null clang-completion-mode-map)
217 (fset 'clang-completion-mode-map
218 (setq clang-completion-mode-map (make-sparse-keymap))))
220 (if (not (assq 'clang-completion-mode minor-mode-map-alist))
222 (cons (cons 'clang-completion-mode clang-completion-mode-map)
225 ;; Punctuation characters trigger code completion.
227 (define-key clang-completion-mode-map char 'clang-complete-self-insert))
230 ;; currently-active code completion.
236 (define-key clang-completion-mode-map char 'clang-filter-self-insert))
239 ;; code completion.
240 (define-key clang-completion-mode-map [(backspace)] 'clang-backspace)
241 (define-key clang-completion-mode-map [(delete)] 'clang-delete)
244 (define-minor-mode clang-completion-mode
245 "Clang code-completion mode"
248 clang-completion-mode-map)