branch: master commit 7b9f1711fffc032db88488e53d103e2efc0887e3 Author: Ingo Lohmar <i.loh...@gmail.com> Commit: Ingo Lohmar <i.loh...@gmail.com>
Update metadata and documentation for ELPA --- README.org | 18 ++++++++++++++---- company-statistics.el | 35 +++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/README.org b/README.org index c2c3da5..4f25f13 100644 --- a/README.org +++ b/README.org @@ -6,14 +6,24 @@ of completions you choose, along with some context information, and use that to rank candidates the next time you have to choose --- hopefully showing you likelier candidates at the top of the list. ** Use It -Using the package is simple. With the files in your =load-path=, add to your -=init.el= file +Using the package is simple. + +If you install it from the gnu.elpa.org repository with Emacs' package manager, +you only need to enable the mode, e.g., in your =init.el= file: +#+begin_src emacs-lisp +(add-to-hook 'after-init-hook 'company-statistics-mode) +#+end_src + +Alternatively, make sure =company-statistics.el= is in your =load-path=, and add +to your =init.el= file #+begin_src emacs-lisp (require 'company-statistics) (company-statistics-mode) #+end_src -to load the package and turn on the mode. See the (few but powerful) -customizable options for details =M-x customize-group company-statistics=. +to load the package manually and turn on the mode. + +See the (few but powerful) customizable options for details =M-x customize-group +company-statistics=. ** Design Company-statistics is an add-on for company-mode, but is only loosely coupled to it (it works by adding a sorting function to =company-transformers= as well as a diff --git a/company-statistics.el b/company-statistics.el index de9d51a..beda36a 100644 --- a/company-statistics.el +++ b/company-statistics.el @@ -1,10 +1,14 @@ -;;; company-statistics.el --- sort candidates using completion history +;;; company-statistics.el --- Sort candidates using completion history ;; Copyright (C) 2014 Free Software Foundation, Inc. -;; Author: Ingo Lohmar +;; Author: Ingo Lohmar <i.loh...@gmail.com> +;; URL: https://github.com/company-mode/company-statistics +;; Version: 0.1 +;; Keywords: abbrev, convenience, matching +;; Package-Requires: ((emacs "24.3") (company "0.8.5")) -;; This file is part of GNU Emacs. +;; This file is not part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -19,12 +23,27 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. - ;;; Commentary: -;; - backends decide on available candidates (depends on prefix) -;; - we store how often a candidate is chosen (independent of prefixes) -;; - challenge: same candidate in several modes/projects/files, -;; but with different meaning --- handled by context information +;; +;; Package installed from gnu.elpa.org: +;; +;; (add-hook 'after-init-hook 'company-statistics-mode) +;; +;; Manually installed: make sure that this file is in load-path, and +;; +;; (require 'company-statistics) +;; (company-statistics-mode) +;; +;; Every time a candidate is chosen using company-mode, we keep track of this +;; (for a limited amount of recent choices). When presenting completion +;; candidates next time, they are sorted according to the score thus acquired. +;; +;; The same candidate might occur in different modes, projects, files etc., and +;; possibly has a different meaning each time. Therefore along with the +;; completion, we store some context information. In the default configuration, +;; we track the overall frequency, the major-mode of the buffer, and the +;; filename (if it applies), and the same criteria are used to score all +;; possible candidates. ;;; Code: