From 9875d164b8bae823ba50aa63ba2cb795fa45a45d Mon Sep 17 00:00:00 2001 From: Nikolaj Schumacher Date: Fri, 17 Apr 2009 09:20:37 +0200 Subject: [PATCH] Extracted company-dabbrev-code--make-regexp. --- company-dabbrev-code.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/company-dabbrev-code.el b/company-dabbrev-code.el index 8f14a23..b47aed5 100644 --- a/company-dabbrev-code.el +++ b/company-dabbrev-code.el @@ -56,14 +56,17 @@ search other buffers for that many seconds and then return." (> (float-time (time-since ,start)) ,limit) (throw 'done 'company-time-out)))))) +(defsubst company-dabbrev-code--make-regexp (prefix) + (concat "\\_<" (if (equal prefix "") + "\\([a-zA-Z]\\|\\s_\\)" + (regexp-quote prefix)) + "\\(\\sw\\|\\s_\\)*\\_>")) + (defun company-dabbrev-code--buffer-symbols (prefix pos &optional symbols start limit) (save-excursion (goto-char (point-min)) - (let ((regexp (concat "\\_<" (if (equal prefix "") - "\\([a-zA-Z]\\|\\s_\\)" - (regexp-quote prefix)) - "\\(\\sw\\|\\s_\\)*\\_>")) + (let ((regexp (company-dabbrev-code--make-regexp prefix)) match) (company-dabrev-code--time-limit-while (re-search-forward regexp nil t) start limit -- 2.39.2