Function: he-dabbrev-search

he-dabbrev-search is a byte-compiled function defined in hippie-exp.el.gz.

Signature

(he-dabbrev-search PATTERN &optional REVERSE LIMIT)

Source Code

;; Defined in /usr/src/emacs/lisp/hippie-exp.el.gz
(defun he-dabbrev-search (pattern &optional reverse limit)
  (let ((result ())
	(regpat (cond ((not hippie-expand-dabbrev-as-symbol)
		       (concat "\\<" (regexp-quote pattern) "\\sw+"))
		      ((eq (char-syntax (aref pattern 0)) ?_)
		       (concat (regexp-quote pattern) "\\(\\sw\\|\\s_\\)+"))
		      (t
		       (concat "\\<" (regexp-quote pattern)
			       "\\(\\sw\\|\\s_\\)+")))))
    (while (and (not result)
		(if reverse
		     (re-search-backward regpat limit t)
		     (re-search-forward regpat limit t)))
      (setq result (buffer-substring-no-properties (match-beginning 0)
						   (match-end 0)))
      (if (or (and hippie-expand-dabbrev-as-symbol
		   (> (match-beginning 0) (point-min))
		   (memq (char-syntax (char-after (1- (match-beginning 0))))
			 '(?_ ?w)))
	      (he-string-member result he-tried-table t))
	  (setq result nil)))     ; ignore if bad prefix or already in table
    result))