-(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_\\)*\\_>"))
- (i 0)
- match)
- (while (re-search-forward regexp nil t)
- (setq match (match-string-no-properties 0))
- (if (company-in-string-or-comment)
- (re-search-forward "\\s>\\|\\s!\\|\\s\"" nil t)
- (unless (eq (match-end 0) pos) ;; ignore match before point
- (push match symbols)))
- (and limit
- (eq (incf i) 25)
- (setq i 0)
- (> (float-time (time-since start)) limit)
- (return symbols)))
- symbols)))
-
-(defun company-dabbrev-code--symbols (prefix &optional limit)
- (let ((start (current-time))
- (symbols (company-dabbrev-code--buffer-symbols prefix (point))))
- (dolist (buffer (delq (current-buffer) (buffer-list)))
- (and (eq (buffer-local-value 'major-mode buffer) major-mode)
- (with-current-buffer buffer
- (setq symbols
- (company-dabbrev-code--buffer-symbols prefix nil symbols
- start limit))))
- (and limit
- (> (float-time (time-since start)) limit)
- (return)))
- symbols))
+(defcustom company-dabbrev-code-everywhere nil
+ "Non-nil to offer completions in comments and strings."
+ :type 'boolean)
+
+(defcustom company-dabbrev-code-ignore-case nil
+ "Non-nil to ignore case when collecting completion candidates."
+ :type 'boolean)
+
+(defun company-dabbrev-code--make-regexp (prefix)
+ (concat "\\_<" (if (equal prefix "")
+ "\\([a-zA-Z]\\|\\s_\\)"
+ (regexp-quote prefix))
+ "\\(\\sw\\|\\s_\\)*\\_>"))