X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/abab0678161b2c8cd92d285589ae53bb2b191884..4e4c53b640bb2f6b5d9ab2f00857221dcce325b8:/packages/company/company-dabbrev.el diff --git a/packages/company/company-dabbrev.el b/packages/company/company-dabbrev.el index 84da3059e..7519caffc 100644 --- a/packages/company/company-dabbrev.el +++ b/packages/company/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) @@ -121,8 +124,10 @@ This variable affects both `company-dabbrev' and `company-dabbrev-code'." (when other-buffer-modes (cl-dolist (buffer (delq (current-buffer) (buffer-list))) (with-current-buffer buffer - (when (or (eq other-buffer-modes 'all) - (apply #'derived-mode-p other-buffer-modes)) + (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))))