-;;; company-dabbrev.el --- a dabbrev-like company-mode completion back-end
-;;
-;; Copyright (C) 2009 Nikolaj Schumacher
-;;
-;; This file is part of company 0.4.3.
-;;
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License
-;; as published by the Free Software Foundation; either version 2
-;; of the License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
+;;; company-dabbrev.el --- dabbrev-like company-mode completion back-end
+
+;; Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+
+;; Author: Nikolaj Schumacher
+
+;; This file is 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
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
-;;
+
;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+
+;;; Commentary:
+;;
+
+;;; Code:
(require 'company)
(eval-when-compile (require 'cl))
+(defgroup company-dabbrev nil
+ "dabbrev-like completion back-end."
+ :group 'company)
+
(defcustom company-dabbrev-other-buffers 'all
- "*Determines whether `company-dabbrev' should search other buffers.
-If 'all, search all other buffers. If t, search buffers with the same
-major-mode.
+ "Determines whether `company-dabbrev' should search other buffers.
+If `all', search all other buffers. If t, search buffers with the same
+major mode.
See also `company-dabbrev-time-limit'."
- :group 'company
:type '(choice (const :tag "Off" nil)
(const :tag "Same major mode" t)
(const :tag "All" all)))
(defcustom company-dabbrev-time-limit .5
- "*Determines how many seconds `company-dabbrev' should look for matches."
- :group 'company
+ "Determines how many seconds `company-dabbrev' should look for matches."
:type '(choice (const :tag "Off" nil)
(number :tag "Seconds")))
(defcustom company-dabbrev-char-regexp "\\sw"
- "*A regular expression matching the characters `company-dabbrev' looks for."
- :group 'company
+ "A regular expression matching the characters `company-dabbrev' looks for."
:type 'regexp)
+(defcustom company-dabbrev-ignore-case 'keep-prefix
+ "The value of `ignore-case' returned by `company-dabbrev'.")
+
(defmacro company-dabrev--time-limit-while (test start limit &rest body)
(declare (indent 3) (debug t))
`(let ((company-time-limit-while-counter 0))
;;;###autoload
(defun company-dabbrev (command &optional arg &rest ignored)
- "A dabbrev-like `company-mode' completion back-end."
+ "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 company-dabbrev-ignore-case)
+ (duplicates t)))
(provide 'company-dabbrev)
;;; company-dabbrev.el ends here