]> code.delx.au - gnu-emacs-elpa/commitdiff
Extract regexp for buffers to ignore into a new var
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 10 Oct 2014 05:09:43 +0000 (09:09 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 10 Oct 2014 05:09:43 +0000 (09:09 +0400)
#199

NEWS.md
company-dabbrev-code.el
company-dabbrev.el

diff --git a/NEWS.md b/NEWS.md
index 6766eb2240d2893809ea1b40c33193e16a23e44b..f563e7800b019bdadc6cbb2d5a2b9be2f5edf7e8 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,7 +2,8 @@
 
 ## Next
 
-* `company-dabbrev` always ignores "uninteresting" buffers.
+* `company-dabbrev` ignores "uninteresting" buffers by default. Depends on the
+  new user option, `company-dabbrev-ignore-buffers`.
 * `company-files` checks directory's last modification time.
 * `company-files` supports relative paths and Windows drive letters.
 
index 0566c508b0aba13ee33248ec758234659495538e..256b57f329d7fbcadbf7ac2eae7f2a4270c8fccb 100644 (file)
@@ -47,10 +47,10 @@ complete only symbols, not text in comments or strings.  In other modes
 
 (defcustom company-dabbrev-code-other-buffers t
   "Determines whether `company-dabbrev-code' should search other buffers.
-If `all', search all other buffers.  If t, search buffers with the same
-major mode.  If `code', search all buffers with major modes in
-`company-dabbrev-code-modes', or derived from one of them.
-See also `company-dabbrev-code-time-limit'."
+If `all', search all other buffers, except the ignored ones.  If t, search
+buffers with the same major mode.  If `code', search all buffers with major
+modes in `company-dabbrev-code-modes', or derived from one of them.  See
+also `company-dabbrev-code-time-limit'."
   :type '(choice (const :tag "Off" nil)
                  (const :tag "Same major mode" t)
                  (const :tag "Code major modes" code)
index fa286116c871ba8aa4098d0c2780344df4f0cc8d..7519caffc1b8d4a9ad823e3cd5760618174cbb0f 100644 (file)
 
 (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.
-See also `company-dabbrev-time-limit'."
+If `all', search all other buffers, except the ignored ones.  If t, search
+buffers with the same major mode.  See also `company-dabbrev-time-limit'."
   :type '(choice (const :tag "Off" nil)
                  (const :tag "Same major mode" t)
                  (const :tag "All" all)))
 
+(defcustom company-dabbrev-ignore-buffers "\\`[ *]"
+  "Regexp matching the names of buffers to ignore."
+  :type 'regexp)
+
 (defcustom company-dabbrev-time-limit .1
   "Determines how many seconds `company-dabbrev' should look for matches."
   :type '(choice (const :tag "Off" nil)
@@ -122,7 +125,8 @@ This variable affects both `company-dabbrev' and `company-dabbrev-code'."
       (cl-dolist (buffer (delq (current-buffer) (buffer-list)))
         (with-current-buffer buffer
           (when (if (eq other-buffer-modes 'all)
-                    (not (string-match-p "\\`[ *]" (buffer-name)))
+                    (not (string-match-p company-dabbrev-ignore-buffers
+                                         (buffer-name)))
                   (apply #'derived-mode-p other-buffer-modes))
             (setq symbols
                   (company-dabbrev--search-buffer regexp nil symbols start