[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master dc4927b 158/173: Allow company-dabbrev-ignore-buffers to b
From: |
Dmitry Gutov |
Subject: |
[elpa] master dc4927b 158/173: Allow company-dabbrev-ignore-buffers to be a function |
Date: |
Thu, 23 Jun 2016 00:28:47 +0000 (UTC) |
branch: master
commit dc4927b3509ae37ceec3993bacd28b7b7cfa19b3
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Allow company-dabbrev-ignore-buffers to be a function
Closes #504
---
NEWS.md | 1 +
company-dabbrev.el | 24 ++++++++++++++----------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 841a62b..6612ca2 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
## Next
+* The value of `company-dabbrev-ignore-buffers` can also be a function.
* `company-files` has been moved to right after `company-capf` in
`company-backends`
([#463](https://github.com/company-mode/company-mode/issues/463)).
diff --git a/company-dabbrev.el b/company-dabbrev.el
index 3a533d5..1ece897 100644
--- a/company-dabbrev.el
+++ b/company-dabbrev.el
@@ -41,8 +41,10 @@ buffers with the same major mode. See also
`company-dabbrev-time-limit'."
(const :tag "All" all)))
(defcustom company-dabbrev-ignore-buffers "\\`[ *]"
- "Regexp matching the names of buffers to ignore."
- :type 'regexp)
+ "Regexp matching the names of buffers to ignore.
+Or a function that returns non-nil for such buffers."
+ :type '(choice (regexp :tag "Regexp")
+ (function :tag "Predicate")))
(defcustom company-dabbrev-time-limit .1
"Determines how many seconds `company-dabbrev' should look for matches."
@@ -137,14 +139,16 @@ This variable affects both `company-dabbrev' and
`company-dabbrev-code'."
ignore-comments)))
(when other-buffer-modes
(cl-dolist (buffer (delq (current-buffer) (buffer-list)))
- (with-current-buffer buffer
- (when (if (eq other-buffer-modes 'all)
- (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
- limit ignore-comments))))
+ (unless (if (stringp company-dabbrev-ignore-buffers)
+ (string-match-p company-dabbrev-ignore-buffers
+ (buffer-name buffer))
+ (funcall company-dabbrev-ignore-buffers buffer))
+ (with-current-buffer buffer
+ (when (or (eq other-buffer-modes 'all)
+ (apply #'derived-mode-p other-buffer-modes))
+ (setq symbols
+ (company-dabbrev--search-buffer regexp nil symbols start
+ limit ignore-comments)))))
(and limit
(> (float-time (time-since start)) limit)
(cl-return))))
- [elpa] master 23c6f85 109/173: Merge pull request #450 from fbergroth/capf-prefix-function, (continued)
- [elpa] master 23c6f85 109/173: Merge pull request #450 from fbergroth/capf-prefix-function, Dmitry Gutov, 2016/06/22
- [elpa] master 5bfbb05 098/173: Add the pre-render backend command, Dmitry Gutov, 2016/06/22
- [elpa] master 3ec9d5d 145/173: Add Julia keywords, Dmitry Gutov, 2016/06/22
- [elpa] master 900ae0d 096/173: Add support for company-face, Dmitry Gutov, 2016/06/22
- [elpa] master 1221739 122/173: Improve the description of cons prefix, Dmitry Gutov, 2016/06/22
- [elpa] master ac7f816 134/173: Merge pull request #466 from tarsius/patch-1, Dmitry Gutov, 2016/06/22
- [elpa] master 9e844d1 124/173: Merge pull request #459 from fbergroth/prefix-length-var, Dmitry Gutov, 2016/06/22
- [elpa] master 31780fb 114/173: Revert "company-cancel: Call frontends' 'hide before 'post-completion", Dmitry Gutov, 2016/06/22
- [elpa] master a7e4408 152/173: Merge pull request #491 from akirakyle/patch-1, Dmitry Gutov, 2016/06/22
- [elpa] master 2dd1f6a 112/173: company-cancel: Call frontends' 'hide before 'post-completion, Dmitry Gutov, 2016/06/22
- [elpa] master dc4927b 158/173: Allow company-dabbrev-ignore-buffers to be a function,
Dmitry Gutov <=
- [elpa] master 3f1afc6 171/173: Revert "Remove the [return] binding (#530)", Dmitry Gutov, 2016/06/22
- [elpa] master 9fb6072 116/173: Reimplement -electric-do using a pre-command-hook, Dmitry Gutov, 2016/06/22
- [elpa] master c845c43 097/173: Revert "Add support for company-face", Dmitry Gutov, 2016/06/22
- [elpa] master e477eaf 107/173: Bump copyright years, Dmitry Gutov, 2016/06/22
- [elpa] master 7a05d1c 115/173: company-cancel: Call pre/post-completion at the end, Dmitry Gutov, 2016/06/22
- [elpa] master cd69d7b 119/173: Add company-semantic-begin-after-member-access, Dmitry Gutov, 2016/06/22
- [elpa] master 724e6dd 136/173: Delete the cache when async completion aborts, Dmitry Gutov, 2016/06/22
- [elpa] master e251568 137/173: Update test for the latest change, Dmitry Gutov, 2016/06/22
- [elpa] master 7afffbc 068/173: Spell "backend" and "frontend" without hyphens, Dmitry Gutov, 2016/06/22
- [elpa] master 5565541 126/173: Option to have tempo expand tags after completion., Dmitry Gutov, 2016/06/22