"A `company-mode' completion back-end for abbrev."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-abbrev
- 'company-abbrev-insert))
- ('prefix (company-grab-symbol))
- ('candidates (nconc
- (delete "" (all-completions arg global-abbrev-table))
- (delete "" (all-completions arg local-abbrev-table))))
- ('meta (abbrev-expansion arg))
- ('require-match t)))
+ (interactive (company-begin-backend 'company-abbrev
+ 'company-abbrev-insert))
+ (prefix (company-grab-symbol))
+ (candidates (nconc
+ (delete "" (all-completions arg global-abbrev-table))
+ (delete "" (all-completions arg local-abbrev-table))))
+ (meta (abbrev-expansion arg))
+ (require-match t)))
(provide 'company-abbrev)
;;; company-abbrev.el ends here
`company-clang-auto-save' determines whether to do this automatically."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-clang))
- ('init (unless company-clang-executable
- (error "Company found no clang executable"))
- (when (version< (company-clang-version)
- company-clang-required-version)
- (error "Company requires clang version 1.1")))
- ('prefix (and (memq major-mode company-clang-modes)
- buffer-file-name
- company-clang-executable
- (not (company-in-string-or-comment))
- (or (company-grab-symbol) 'stop)))
- ('candidates (company-clang--candidates arg))
- ('post-completion (and (derived-mode-p 'objc-mode)
- (string-match ":" arg)
- (company-clang-objc-templatify arg)))))
+ (interactive (company-begin-backend 'company-clang))
+ (init (unless company-clang-executable
+ (error "Company found no clang executable"))
+ (when (version< (company-clang-version)
+ company-clang-required-version)
+ (error "Company requires clang version 1.1")))
+ (prefix (and (memq major-mode company-clang-modes)
+ buffer-file-name
+ company-clang-executable
+ (not (company-in-string-or-comment))
+ (or (company-grab-symbol) 'stop)))
+ (candidates (company-clang--candidates arg))
+ (post-completion (and (derived-mode-p 'objc-mode)
+ (string-match ":" arg)
+ (company-clang-objc-templatify arg)))))
(provide 'company-clang)
;;; company-clang.el ends here
"A `company-mode' completion back-end for `css-mode'."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-css))
- ('prefix (and (derived-mode-p 'css-mode)
- (or (company-grab company-css-tag-regexp 1)
- (company-grab company-css-pseudo-regexp 1)
- (company-grab company-css-property-value-regexp 2)
- (company-css-grab-property))))
- ('candidates
+ (interactive (company-begin-backend 'company-css))
+ (prefix (and (derived-mode-p 'css-mode)
+ (or (company-grab company-css-tag-regexp 1)
+ (company-grab company-css-pseudo-regexp 1)
+ (company-grab company-css-property-value-regexp 2)
+ (company-css-grab-property))))
+ (candidates
(cond
((company-grab company-css-tag-regexp 1)
(all-completions arg company-css-html-tags))
(company-grab company-css-property-value-regexp 1))))
((company-css-grab-property)
(all-completions arg company-css-property-alist))))
- ('sorted t)))
+ (sorted t)))
(provide 'company-css)
;;; company-css.el ends here
comments or strings."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-dabbrev-code))
- ('prefix (and (or (eq t company-dabbrev-code-modes)
- (apply 'derived-mode-p company-dabbrev-code-modes))
- (not (company-in-string-or-comment))
- (or (company-grab-symbol) 'stop)))
- ('candidates (let ((completion-ignore-case nil))
- (company-dabbrev--search
- (company-dabbrev-code--make-regexp arg)
- company-dabbrev-code-time-limit
- company-dabbrev-code-other-buffers t)))
- ('duplicates t)))
+ (interactive (company-begin-backend 'company-dabbrev-code))
+ (prefix (and (or (eq t company-dabbrev-code-modes)
+ (apply 'derived-mode-p company-dabbrev-code-modes))
+ (not (company-in-string-or-comment))
+ (or (company-grab-symbol) 'stop)))
+ (candidates (let ((completion-ignore-case nil))
+ (company-dabbrev--search
+ (company-dabbrev-code--make-regexp arg)
+ company-dabbrev-code-time-limit
+ company-dabbrev-code-other-buffers t)))
+ (duplicates t)))
(provide 'company-dabbrev-code)
;;; company-dabbrev-code.el ends here
"A dabbrev-like `company-mode' completion back-end."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-dabbrev))
- ('prefix (company-grab-word))
- ('candidates
+ (interactive (company-begin-backend 'company-dabbrev))
+ (prefix (company-grab-word))
+ (candidates
(mapcar 'downcase
(company-dabbrev--search (company-dabbrev--make-regexp arg)
company-dabbrev-time-limit
company-dabbrev-other-buffers)))
- ('ignore-case t)
- ('duplicates t)))
+ (ignore-case t)
+ (duplicates t)))
(provide 'company-dabbrev)
;;; company-dabbrev.el ends here
`company-eclim-auto-save' determines whether to do this automatically."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-eclim))
- ('prefix (and (derived-mode-p 'java-mode 'jde-mode)
- buffer-file-name
- company-eclim-executable
- (company-eclim--project-name)
- (not (company-in-string-or-comment))
- (or (company-grab-symbol) 'stop)))
- ('candidates (company-eclim--candidates arg))
- ('meta (cadr (assoc arg company-eclim--doc)))
+ (interactive (company-begin-backend 'company-eclim))
+ (prefix (and (derived-mode-p 'java-mode 'jde-mode)
+ buffer-file-name
+ company-eclim-executable
+ (company-eclim--project-name)
+ (not (company-in-string-or-comment))
+ (or (company-grab-symbol) 'stop)))
+ (candidates (company-eclim--candidates arg))
+ (meta (cadr (assoc arg company-eclim--doc)))
;; because "" doesn't return everything
- ('no-cache (equal arg ""))))
+ (no-cache (equal arg ""))))
(provide 'company-eclim)
;;; company-eclim.el ends here
"A `company-mode' completion back-end for `emacs-lisp-mode'."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-elisp))
- ('prefix (and (eq (derived-mode-p 'emacs-lisp-mode) 'emacs-lisp-mode)
- (company-grab-lisp-symbol)))
- ('candidates (company-elisp-candidates arg))
- ('meta (company-elisp-doc arg))
- ('doc-buffer (let ((symbol (intern arg)))
- (save-window-excursion
- (when (or (ignore-errors (describe-function symbol))
- (ignore-errors (describe-variable symbol)))
- (help-buffer)))))
- ('location (let ((sym (intern arg)))
- (or (ignore-errors (find-definition-noselect sym nil))
- (ignore-errors (find-definition-noselect sym 'defvar))
- (ignore-errors (find-definition-noselect sym t)))))))
+ (interactive (company-begin-backend 'company-elisp))
+ (prefix (and (eq (derived-mode-p 'emacs-lisp-mode) 'emacs-lisp-mode)
+ (company-grab-lisp-symbol)))
+ (candidates (company-elisp-candidates arg))
+ (meta (company-elisp-doc arg))
+ (doc-buffer (let ((symbol (intern arg)))
+ (save-window-excursion
+ (when (or (ignore-errors (describe-function symbol))
+ (ignore-errors (describe-variable symbol)))
+ (help-buffer)))))
+ (location (let ((sym (intern arg)))
+ (or (ignore-errors (find-definition-noselect sym nil))
+ (ignore-errors (find-definition-noselect sym 'defvar))
+ (ignore-errors (find-definition-noselect sym t)))))))
(provide 'company-elisp)
;;; company-elisp.el ends here
"A `company-mode' completion back-end for etags."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-etags))
- ('prefix (and (memq major-mode company-etags-modes)
- (not (company-in-string-or-comment))
- (company-etags-buffer-table)
- (or (company-grab-symbol) 'stop)))
- ('candidates (company-etags--candidates arg))
- ('location (let ((tags-table-list (company-etags-buffer-table)))
- (when (fboundp 'find-tag-noselect)
- (save-excursion
- (let ((buffer (find-tag-noselect arg)))
- (cons buffer (with-current-buffer buffer (point))))))))
- ('sorted t)))
+ (interactive (company-begin-backend 'company-etags))
+ (prefix (and (memq major-mode company-etags-modes)
+ (not (company-in-string-or-comment))
+ (company-etags-buffer-table)
+ (or (company-grab-symbol) 'stop)))
+ (candidates (company-etags--candidates arg))
+ (location (let ((tags-table-list (company-etags-buffer-table)))
+ (when (fboundp 'find-tag-noselect)
+ (save-excursion
+ (let ((buffer (find-tag-noselect arg)))
+ (cons buffer (with-current-buffer buffer (point))))))))
+ (sorted t)))
(provide 'company-etags)
;;; company-etags.el ends here
"a `company-mode' completion back-end existing file names."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-files))
- ('prefix (company-files-grab-existing-name))
- ('candidates (company-files-complete arg))
- ('location (cons (dired-noselect
- (file-name-directory (directory-file-name arg))) 1))
- ('sorted t)
- ('no-cache t)))
+ (interactive (company-begin-backend 'company-files))
+ (prefix (company-files-grab-existing-name))
+ (candidates (company-files-complete arg))
+ (location (cons (dired-noselect
+ (file-name-directory (directory-file-name arg))) 1))
+ (sorted t)
+ (no-cache t)))
(provide 'company-files)
;;; company-files.el ends here
"A `company-mode' completion back-end for GNU Global."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-gtags))
- ('prefix (and company-gtags-executable
- (memq major-mode company-gtags-modes)
- (not (company-in-string-or-comment))
- (company-gtags--tags-available-p)
- (or (company-grab-symbol) 'stop)))
- ('candidates (company-gtags-fetch-tags arg))
- ('sorted t)
- ('location (company-gtags-location arg))))
+ (interactive (company-begin-backend 'company-gtags))
+ (prefix (and company-gtags-executable
+ (memq major-mode company-gtags-modes)
+ (not (company-in-string-or-comment))
+ (company-gtags--tags-available-p)
+ (or (company-grab-symbol) 'stop)))
+ (candidates (company-gtags-fetch-tags arg))
+ (sorted t)
+ (location (company-gtags-location arg))))
(provide 'company-gtags)
;;; company-gtags.el ends here
"A `company-mode' completion back-end using ispell."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-ispell))
- ('prefix (when (company-ispell-available)
- (company-grab-word)))
- ('candidates (lookup-words arg (or company-ispell-dictionary
- ispell-complete-word-dict)))
- ('sorted t)
- ('ignore-case t)))
+ (interactive (company-begin-backend 'company-ispell))
+ (prefix (when (company-ispell-available)
+ (company-grab-word)))
+ (candidates (lookup-words arg (or company-ispell-dictionary
+ ispell-complete-word-dict)))
+ (sorted t)
+ (ignore-case t)))
(provide 'company-ispell)
;;; company-ispell.el ends here
"A `company-mode' back-end for programming language keywords."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-))
- ('prefix (and (assq major-mode company-keywords-alist)
- (not (company-in-string-or-comment))
- (or (company-grab-symbol) 'stop)))
- ('candidates
+ (interactive (company-begin-backend 'company-))
+ (prefix (and (assq major-mode company-keywords-alist)
+ (not (company-in-string-or-comment))
+ (or (company-grab-symbol) 'stop)))
+ (candidates
(let ((completion-ignore-case nil)
(symbols (cdr (assq major-mode company-keywords-alist))))
(all-completions arg (if (consp symbols)
symbols
(cdr (assq symbols company-keywords-alist))))))
- ('sorted t)))
+ (sorted t)))
(provide 'company-keywords)
;;; company-keywords.el ends here
(defun company-nxml-tag (command &optional arg &rest ignored)
(case command
- ('prefix (and (derived-mode-p 'nxml-mode)
- rng-validate-mode
- (company-grab company-nxml-in-tag-name-regexp 1)))
- ('candidates (company-nxml-prepared
- (company-nxml-all-completions arg
- (rng-match-possible-start-tag-names))))
- ('sorted t)))
+ (prefix (and (derived-mode-p 'nxml-mode)
+ rng-validate-mode
+ (company-grab company-nxml-in-tag-name-regexp 1)))
+ (candidates (company-nxml-prepared
+ (company-nxml-all-completions
+ arg (rng-match-possible-start-tag-names))))
+ (sorted t)))
(defun company-nxml-attribute (command &optional arg &rest ignored)
(case command
- ('prefix (and (derived-mode-p 'nxml-mode)
- rng-validate-mode
- (memq (char-after) '(?\ ?\t ?\n)) ;; outside word
- (company-grab rng-in-attribute-regex 1)))
- ('candidates (company-nxml-prepared
- (and (rng-adjust-state-for-attribute
- lt-pos (- (point) (length arg)))
- (company-nxml-all-completions arg
- (rng-match-possible-attribute-names)))))
- ('sorted t)))
+ (prefix (and (derived-mode-p 'nxml-mode)
+ rng-validate-mode
+ (memq (char-after) '(?\ ?\t ?\n)) ;; outside word
+ (company-grab rng-in-attribute-regex 1)))
+ (candidates (company-nxml-prepared
+ (and (rng-adjust-state-for-attribute
+ lt-pos (- (point) (length arg)))
+ (company-nxml-all-completions
+ arg (rng-match-possible-attribute-names)))))
+ (sorted t)))
(defun company-nxml-attribute-value (command &optional arg &rest ignored)
(case command
- ('prefix (and (derived-mode-p 'nxml-mode)
- rng-validate-mode
- (and (memq (char-after) '(?' ?\" ?\ ?\t ?\n)) ;; outside word
- (looking-back company-nxml-in-attribute-value-regexp)
- (or (match-string-no-properties 4)
- (match-string-no-properties 5)
- ""))))
- ('candidates (company-nxml-prepared
- (let (attr-start attr-end colon)
- (and (looking-back rng-in-attribute-value-regex lt-pos)
- (setq colon (match-beginning 2)
- attr-start (match-beginning 1)
- attr-end (match-end 1))
- (rng-adjust-state-for-attribute lt-pos attr-start)
- (rng-adjust-state-for-attribute-value
- attr-start colon attr-end)
- (all-completions arg
- (rng-match-possible-value-strings))))))))
+ (prefix (and (derived-mode-p 'nxml-mode)
+ rng-validate-mode
+ (and (memq (char-after) '(?' ?\" ?\ ?\t ?\n)) ;; outside word
+ (looking-back company-nxml-in-attribute-value-regexp)
+ (or (match-string-no-properties 4)
+ (match-string-no-properties 5)
+ ""))))
+ (candidates (company-nxml-prepared
+ (let (attr-start attr-end colon)
+ (and (looking-back rng-in-attribute-value-regex lt-pos)
+ (setq colon (match-beginning 2)
+ attr-start (match-beginning 1)
+ attr-end (match-end 1))
+ (rng-adjust-state-for-attribute lt-pos attr-start)
+ (rng-adjust-state-for-attribute-value
+ attr-start colon attr-end)
+ (all-completions
+ arg (rng-match-possible-value-strings))))))))
;;;###autoload
(defun company-nxml (command &optional arg &rest ignored)
"A `company-mode' completion back-end for `nxml-mode'."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-nxml))
- ('prefix (or (company-nxml-tag 'prefix)
- (company-nxml-attribute 'prefix)
- (company-nxml-attribute-value 'prefix)))
- ('candidates (cond
- ((company-nxml-tag 'prefix)
- (company-nxml-tag 'candidates arg))
- ((company-nxml-attribute 'prefix)
- (company-nxml-attribute 'candidates arg))
- ((company-nxml-attribute-value 'prefix)
- (sort (company-nxml-attribute-value 'candidates arg)
- 'string<))))
- ('sorted t)))
+ (interactive (company-begin-backend 'company-nxml))
+ (prefix (or (company-nxml-tag 'prefix)
+ (company-nxml-attribute 'prefix)
+ (company-nxml-attribute-value 'prefix)))
+ (candidates (cond
+ ((company-nxml-tag 'prefix)
+ (company-nxml-tag 'candidates arg))
+ ((company-nxml-attribute 'prefix)
+ (company-nxml-attribute 'candidates arg))
+ ((company-nxml-attribute-value 'prefix)
+ (sort (company-nxml-attribute-value 'candidates arg)
+ 'string<))))
+ (sorted t)))
(provide 'company-nxml)
;;; company-nxml.el ends here
(defun company-oddmuse-get-page-table ()
(case major-mode
- ('yaoddmuse-mode (with-no-warnings
- (yaoddmuse-get-pagename-table yaoddmuse-wikiname)))
- ('oddmuse-mode (with-no-warnings
- (oddmuse-make-completion-table oddmuse-wiki)))))
+ (yaoddmuse-mode (with-no-warnings
+ (yaoddmuse-get-pagename-table yaoddmuse-wikiname)))
+ (oddmuse-mode (with-no-warnings
+ (oddmuse-make-completion-table oddmuse-wiki)))))
;;;###autoload
(defun company-oddmuse (command &optional arg &rest ignored)
"A `company-mode' completion back-end for `oddmuse-mode'."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-oddmuse))
- ('prefix (let ((case-fold-search nil))
- (and (memq major-mode '(oddmuse-mode yaoddmuse-mode))
- (looking-back company-oddmuse-link-regexp (point-at-bol))
- (or (match-string 1)
- (match-string 2)))))
- ('candidates (all-completions arg (company-oddmuse-get-page-table)))))
+ (interactive (company-begin-backend 'company-oddmuse))
+ (prefix (let ((case-fold-search nil))
+ (and (memq major-mode '(oddmuse-mode yaoddmuse-mode))
+ (looking-back company-oddmuse-link-regexp (point-at-bol))
+ (or (match-string 1)
+ (match-string 2)))))
+ (candidates (all-completions arg (company-oddmuse-get-page-table)))))
(provide 'company-oddmuse)
;;; company-oddmuse.el ends here
This requires pysmell.el and pymacs.el."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-pysmell))
- ('prefix (and (derived-mode-p 'python-mode)
- buffer-file-name
- (not (company-in-string-or-comment))
- (company-pysmell--available-p)
- (company-pysmell--grab-symbol)))
- ('candidates (delete "" (pysmell-get-all-completions)))))
+ (interactive (company-begin-backend 'company-pysmell))
+ (prefix (and (derived-mode-p 'python-mode)
+ buffer-file-name
+ (not (company-in-string-or-comment))
+ (company-pysmell--available-p)
+ (company-pysmell--grab-symbol)))
+ (candidates (delete "" (pysmell-get-all-completions)))))
(provide 'company-pysmell)
;;; company-pysmell.el ends here
"A `company-mode' completion back-end for ropemacs."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-ropemacs))
- ('prefix (and (derived-mode-p 'python-mode)
- (not (company-in-string-or-comment))
- (company-ropemacs--grab-symbol)))
- ('candidates (mapcar (lambda (element) (concat arg element))
- (rope-completions)))
- ('doc-buffer (company-ropemacs-doc-buffer arg))
- ('location (company-ropemacs-location arg))))
+ (interactive (company-begin-backend 'company-ropemacs))
+ (prefix (and (derived-mode-p 'python-mode)
+ (not (company-in-string-or-comment))
+ (company-ropemacs--grab-symbol)))
+ (candidates (mapcar (lambda (element) (concat arg element))
+ (rope-completions)))
+ (doc-buffer (company-ropemacs-doc-buffer arg))
+ (location (company-ropemacs-location arg))))
(provide 'company-ropemacs)
;;; company-ropemacs.el ends here
"A `company-mode' completion back-end using CEDET Semantic."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-semantic))
- ('prefix (and (memq major-mode company-semantic-modes)
- (semantic-active-p)
- (not (company-in-string-or-comment))
- (or (company-semantic--grab) 'stop)))
- ('candidates (if (and (equal arg "")
- (not (looking-back "->\\|\\.")))
- (company-semantic-completions-raw arg)
- (company-semantic-completions arg)))
- ('meta (funcall company-semantic-metadata-function
- (assoc arg company-semantic--current-tags)))
- ('doc-buffer (company-semantic-doc-buffer
- (assoc arg company-semantic--current-tags)))
+ (interactive (company-begin-backend 'company-semantic))
+ (prefix (and (memq major-mode company-semantic-modes)
+ (semantic-active-p)
+ (not (company-in-string-or-comment))
+ (or (company-semantic--grab) 'stop)))
+ (candidates (if (and (equal arg "")
+ (not (looking-back "->\\|\\.")))
+ (company-semantic-completions-raw arg)
+ (company-semantic-completions arg)))
+ (meta (funcall company-semantic-metadata-function
+ (assoc arg company-semantic--current-tags)))
+ (doc-buffer (company-semantic-doc-buffer
+ (assoc arg company-semantic--current-tags)))
;; because "" is an empty context and doesn't return local variables
- ('no-cache (equal arg ""))
- ('location (let ((tag (assoc arg company-semantic--current-tags)))
- (when (buffer-live-p (semantic-tag-buffer tag))
- (cons (semantic-tag-buffer tag)
- (semantic-tag-start tag)))))))
+ (no-cache (equal arg ""))
+ (location (let ((tag (assoc arg company-semantic--current-tags)))
+ (when (buffer-live-p (semantic-tag-buffer tag))
+ (cons (semantic-tag-buffer tag)
+ (semantic-tag-start tag)))))))
(provide 'company-semantic)
;;; company-semantic.el ends here
"A `company-mode' completion back-end for tempo."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-tempo
- 'company-tempo-insert))
- ('prefix (or (car (tempo-find-match-string tempo-match-finder)) ""))
- ('candidates (all-completions arg (tempo-build-collection)))
- ('meta (company-tempo-meta arg))
- ('require-match t)
- ('sorted t)))
+ (interactive (company-begin-backend 'company-tempo
+ 'company-tempo-insert))
+ (prefix (or (car (tempo-find-match-string tempo-match-finder)) ""))
+ (candidates (all-completions arg (tempo-build-collection)))
+ (meta (company-tempo-meta arg))
+ (require-match t)
+ (sorted t)))
(provide 'company-tempo)
;;; company-tempo.el ends here
"A `company-mode' completion back-end for Xcode projects."
(interactive (list 'interactive))
(case command
- ('interactive (company-begin-backend 'company-xcode))
- ('prefix (and company-xcode-xcodeindex-executable
+ (interactive (company-begin-backend 'company-xcode))
+ (prefix (and company-xcode-xcodeindex-executable
+ (company-xcode-tags)
+ (not (company-in-string-or-comment))
+ (or (company-grab-symbol) 'stop)))
+ (candidates (let ((completion-ignore-case nil))
(company-xcode-tags)
- (not (company-in-string-or-comment))
- (or (company-grab-symbol) 'stop)))
- ('candidates (let ((completion-ignore-case nil))
- (company-xcode-tags)
- (all-completions arg (company-xcode-tags))))))
+ (all-completions arg (company-xcode-tags))))))
(provide 'company-xcode)
;;
;; (defun company-my-backend (command &optional arg &rest ignored)
;; (case command
-;; ('prefix (when (looking-back "foo\\>")
-;; (match-string 0)))
-;; ('candidates (list "foobar" "foobaz" "foobarbaz"))
-;; ('meta (format "This value is named %s" arg))))
+;; (prefix (when (looking-back "foo\\>")
+;; (match-string 0)))
+;; (candidates (list "foobar" "foobaz" "foobarbaz"))
+;; (meta (format "This value is named %s" arg))))
;;
;; Sometimes it is a good idea to mix two back-ends together, for example to
;; enrich gtags with dabbrev-code results (to emulate local variables):
(defun company--multi-backend-adapter (backends command &rest args)
(case command
- ('candidates
+ (candidates
(apply 'append (mapcar (lambda (backend) (apply backend command args))
backends)))
- ('sorted nil)
- ('duplicates t)
+ (sorted nil)
+ (duplicates t)
(otherwise
(let (value)
(dolist (backend backends)
(defun company-pseudo-tooltip-frontend (command)
"A `company-mode' front-end similar to a tool-tip but based on overlays."
(case command
- ('pre-command (company-pseudo-tooltip-hide-temporarily))
- ('post-command
+ (pre-command (company-pseudo-tooltip-hide-temporarily))
+ (post-command
(let ((old-height (if (overlayp company-pseudo-tooltip-overlay)
(overlay-get company-pseudo-tooltip-overlay
'company-height)
(company-pseudo-tooltip-show-at-point (- (point)
(length company-prefix)))))
(company-pseudo-tooltip-unhide))
- ('hide (company-pseudo-tooltip-hide)
- (setq company-tooltip-offset 0))
- ('update (when (overlayp company-pseudo-tooltip-overlay)
- (company-pseudo-tooltip-edit company-candidates
- company-selection)))))
+ (hide (company-pseudo-tooltip-hide)
+ (setq company-tooltip-offset 0))
+ (update (when (overlayp company-pseudo-tooltip-overlay)
+ (company-pseudo-tooltip-edit company-candidates
+ company-selection)))))
(defun company-pseudo-tooltip-unless-just-one-frontend (command)
"`company-pseudo-tooltip-frontend', but not shown for single candidates."
(defun company-preview-frontend (command)
"A `company-mode' front-end showing the selection as if it had been inserted."
(case command
- ('pre-command (company-preview-hide))
- ('post-command (company-preview-show-at-point (point)))
- ('hide (company-preview-hide))))
+ (pre-command (company-preview-hide))
+ (post-command (company-preview-show-at-point (point)))
+ (hide (company-preview-hide))))
(defun company-preview-if-just-one-frontend (command)
"`company-preview-frontend', but only shown for single candidates."
(defun company-echo-frontend (command)
"A `company-mode' front-end showing the candidates in the echo area."
(case command
- ('post-command (company-echo-show-soon 'company-echo-format))
- ('hide (company-echo-hide))))
+ (post-command (company-echo-show-soon 'company-echo-format))
+ (hide (company-echo-hide))))
(defun company-echo-strip-common-frontend (command)
"A `company-mode' front-end showing the candidates in the echo area."
(case command
- ('post-command (company-echo-show-soon 'company-echo-strip-common-format))
- ('hide (company-echo-hide))))
+ (post-command (company-echo-show-soon 'company-echo-strip-common-format))
+ (hide (company-echo-hide))))
(defun company-echo-metadata-frontend (command)
"A `company-mode' front-end showing the documentation in the echo area."
(case command
- ('post-command (company-echo-show-when-idle 'company-fetch-metadata))
- ('hide (company-echo-hide))))
+ (post-command (company-echo-show-when-idle 'company-fetch-metadata))
+ (hide (company-echo-hide))))
;; templates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;