[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 02/21: Make dabbrev and dabbrev-code more customizable
From: |
Dmitry Gutov |
Subject: |
[elpa] 02/21: Make dabbrev and dabbrev-code more customizable |
Date: |
Mon, 03 Feb 2014 17:36:15 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 9fad54d2f69f1a2e38cc475612bf475097bcfe40
Author: Dmitry Gutov <address@hidden>
Date: Thu Jan 30 07:08:35 2014 +0200
Make dabbrev and dabbrev-code more customizable
#52
---
NEWS.md | 4 ++++
company-dabbrev-code.el | 12 +++++++++++-
company-dabbrev.el | 5 ++++-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 602c174..9916054 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,9 @@
# History of user-visible changes
+## Next
+
+* New user options controlling `company-dabbrev` and `company-dabbrev-code`.
+
## 2014-01-25 (0.6.14)
* The tooltip front-end is rendered with scrollbar, controlled by the user
diff --git a/company-dabbrev-code.el b/company-dabbrev-code.el
index e4c548e..408d2b2 100644
--- a/company-dabbrev-code.el
+++ b/company-dabbrev-code.el
@@ -60,6 +60,14 @@ See also `company-dabbrev-code-time-limit'."
:type '(choice (const :tag "Off" nil)
(number :tag "Seconds")))
+(defcustom company-dabbrev-code-everywhere nil
+ "Non-nil to offer completions in comments and strings."
+ :type 'boolean)
+
+(defcustom company-dabbrev-code-ignore-case nil
+ "Non-nil to ignore case in completion candidates."
+ :type 'boolean)
+
(defsubst company-dabbrev-code--make-regexp (prefix)
(concat "\\_<" (if (equal prefix "")
"\\([a-zA-Z]\\|\\s_\\)"
@@ -76,13 +84,15 @@ comments or strings."
(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-dabbrev-code-everywhere
+ (not (company-in-string-or-comment)))
(or (company-grab-symbol) 'stop)))
(candidates (let ((case-fold-search nil))
(company-dabbrev--search
(company-dabbrev-code--make-regexp arg)
company-dabbrev-code-time-limit
company-dabbrev-code-other-buffers t)))
+ (ignore-case company-dabbrev-code-ignore-case)
(duplicates t)))
(provide 'company-dabbrev-code)
diff --git a/company-dabbrev.el b/company-dabbrev.el
index 4b1a9d8..afe60f2 100644
--- a/company-dabbrev.el
+++ b/company-dabbrev.el
@@ -50,6 +50,9 @@ See also `company-dabbrev-time-limit'."
"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))
@@ -120,7 +123,7 @@ See also `company-dabbrev-time-limit'."
(company-dabbrev--search (company-dabbrev--make-regexp arg)
company-dabbrev-time-limit
company-dabbrev-other-buffers)))
- (ignore-case 'keep-prefix)
+ (ignore-case company-dabbrev-ignore-case)
(duplicates t)))
(provide 'company-dabbrev)
- [elpa] 10/21: Don't generate bogus event in Emacs 24.4, (continued)
- [elpa] 10/21: Don't generate bogus event in Emacs 24.4, Dmitry Gutov, 2014/02/03
- [elpa] 06/21: Fix #54, Dmitry Gutov, 2014/02/03
- [elpa] 11/21: Render company-preview-frontend after the cursor, Dmitry Gutov, 2014/02/03
- [elpa] 12/21: company-preview* faces: inherit from company-tooltip-[common-]selection, Dmitry Gutov, 2014/02/03
- [elpa] 15/21: Remove NEWS entry for 9b0d457, it's a bugfix, Dmitry Gutov, 2014/02/03
- [elpa] 17/21: company-capf: strip duplicates, Dmitry Gutov, 2014/02/03
- [elpa] 01/21: company-begin-commands: add `org-self-insert-command', Dmitry Gutov, 2014/02/03
- [elpa] 21/21: Merge commit '67ab56a5469f16652e73667ec3b4f76ff6befee6' from company, Dmitry Gutov, 2014/02/03
- [elpa] 16/21: Don't "transform" twice, Dmitry Gutov, 2014/02/03
- [elpa] 20/21: Remove outdated comment, Dmitry Gutov, 2014/02/03
- [elpa] 02/21: Make dabbrev and dabbrev-code more customizable,
Dmitry Gutov <=
- [elpa] 19/21: Fix #56, Dmitry Gutov, 2014/02/03
- [elpa] 04/21: Add company-transformers, Dmitry Gutov, 2014/02/03
- [elpa] 14/21: company-sort-by-occurrence: consider the preceding line, Dmitry Gutov, 2014/02/03
- [elpa] 13/21: company--continue-failed: require matching input properly, Dmitry Gutov, 2014/02/03
- [elpa] 18/21: Display annotations, Dmitry Gutov, 2014/02/03