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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 06/14: Introduce company-dabbrev-downcase


From: Dmitry Gutov
Subject: [elpa] 06/14: Introduce company-dabbrev-downcase
Date: Tue, 18 Feb 2014 05:51:01 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit 902176176cd4b88a5f00a1b452e237acea64aa78
Author: Dmitry Gutov <address@hidden>
Date:   Tue Feb 11 03:48:28 2014 +0200

    Introduce company-dabbrev-downcase
    
    Closes #60
---
 company-dabbrev.el |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/company-dabbrev.el b/company-dabbrev.el
index b9d47a3..c0cd0e0 100644
--- a/company-dabbrev.el
+++ b/company-dabbrev.el
@@ -53,6 +53,16 @@ See also `company-dabbrev-time-limit'."
 (defcustom company-dabbrev-ignore-case 'keep-prefix
   "The value of `ignore-case' returned by `company-dabbrev'.")
 
+(defcustom company-dabbrev-downcase 'case-replace
+  "Whether to downcase the returned candidates.
+
+The value of nil means keep them as-is.
+`case-replace' means use the value of `case-replace'.
+Any other value means downcase.
+
+If you set this value to nil, you may also want to set
+`company-dabbrev-ignore-case' to any value other than `keep-prefix'.")
+
 (defcustom company-dabbrev-minimum-length (1+ company-minimum-prefix-length)
   "The minimum length for the string to be included.")
 
@@ -124,10 +134,15 @@ See also `company-dabbrev-time-limit'."
     (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)))
+     (let ((words (company-dabbrev--search (company-dabbrev--make-regexp arg)
+                                         company-dabbrev-time-limit
+                                         company-dabbrev-other-buffers))
+           (downcase-p (if (eq company-dabbrev-downcase 'case-replace)
+                           case-replace
+                         company-dabbrev-downcase)))
+       (if downcase-p
+           (mapcar 'downcase words)
+         words)))
     (ignore-case company-dabbrev-ignore-case)
     (duplicates t)))
 



reply via email to

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