]> code.delx.au - gnu-emacs-elpa/commitdiff
Extracted company-dabbrev-code--make-regexp.
authorNikolaj Schumacher <git@nschum.de>
Fri, 17 Apr 2009 07:20:37 +0000 (09:20 +0200)
committerNikolaj Schumacher <git@nschum.de>
Sat, 18 Apr 2009 11:00:16 +0000 (13:00 +0200)
company-dabbrev-code.el

index 8f14a23e55459688ed076fb46d9e219aeae956d0..b47aed59a52b852b68b2f2267aaf69a906ab1fe3 100644 (file)
@@ -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