emacs-elpa-diffs
[Top][All Lists]
Advanced

[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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]