[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 27/30: Extract regexp for buffers to ignore into a new var
From: |
Dmitry Gutov |
Subject: |
[elpa] 27/30: Extract regexp for buffers to ignore into a new var |
Date: |
Tue, 14 Oct 2014 22:22:55 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 988873e8a6c36086d74f4cc144761769ba6a2591
Author: Dmitry Gutov <address@hidden>
Date: Fri Oct 10 09:09:43 2014 +0400
Extract regexp for buffers to ignore into a new var
#199
---
NEWS.md | 3 ++-
company-dabbrev-code.el | 8 ++++----
company-dabbrev.el | 12 ++++++++----
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 6766eb2..f563e78 100644
--- 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.
diff --git a/company-dabbrev-code.el b/company-dabbrev-code.el
index 0566c50..256b57f 100644
--- a/company-dabbrev-code.el
+++ b/company-dabbrev-code.el
@@ -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)
diff --git a/company-dabbrev.el b/company-dabbrev.el
index fa28611..7519caf 100644
--- a/company-dabbrev.el
+++ b/company-dabbrev.el
@@ -34,13 +34,16 @@
(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
- [elpa] 21/30: company-call-backend-raw: Use `condition-case-unless-debug', too, (continued)
- [elpa] 21/30: company-call-backend-raw: Use `condition-case-unless-debug', too, Dmitry Gutov, 2014/10/14
- [elpa] 20/30: Handle non-printable and multiple-width chars in completions, Dmitry Gutov, 2014/10/14
- [elpa] 18/30: Use `condition-case-unless-debug' more, Dmitry Gutov, 2014/10/14
- [elpa] 22/30: company-dabbrev--search: Ignore "uninteresting" buffers, Dmitry Gutov, 2014/10/14
- [elpa] 23/30: Make new tests and interactive-only, Dmitry Gutov, 2014/10/14
- [elpa] 24/30: company-fill-propertize: Use `string-width' on `company-common', Dmitry Gutov, 2014/10/14
- [elpa] 25/30: Handle nil company-common, in order not to bind it in tests, Dmitry Gutov, 2014/10/14
- [elpa] 12/30: Update NEWS; do the forgotten version bump, Dmitry Gutov, 2014/10/14
- [elpa] 14/30: company-files.el: Use the "private function" naming convention, Dmitry Gutov, 2014/10/14
- [elpa] 26/30: Call `bbdb-search' inside `eval' block, Dmitry Gutov, 2014/10/14
- [elpa] 27/30: Extract regexp for buffers to ignore into a new var,
Dmitry Gutov <=
- [elpa] 28/30: company-template-c-like-templatify: Support generics, Dmitry Gutov, 2014/10/14
- [elpa] 29/30: Bump the version, Dmitry Gutov, 2014/10/14
- [elpa] 30/30: Merge commit '60d4c09c982a1c562a70cd6aa705f47ab3badcfb' from company, Dmitry Gutov, 2014/10/14