Function: he-dabbrev-kill-search

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

Signature

(he-dabbrev-kill-search PATTERN)

Source Code

;; Defined in /usr/src/emacs/lisp/hippie-exp.el.gz
(defun he-dabbrev-kill-search (pattern)
  (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_\\)+"))))
	(killstr (car he-expand-list)))
    (while (and (not result)
		he-expand-list)
      (while (and (not result)
		  (string-match regpat killstr he-search-loc2))
	(setq result (substring killstr (match-beginning 0) (match-end 0)))
	(set-text-properties 0 (length result) () result)
	(setq he-search-loc2 (1+ (match-beginning 0)))
	(if (or (and hippie-expand-dabbrev-as-symbol
		     (> (match-beginning 0) 0)
		     (memq (char-syntax (aref killstr (1- (match-beginning 0))))
			   '(?_ ?w)))
		(he-string-member result he-tried-table t))
	    (setq result nil)))     ; ignore if bad prefix or already in table
      (if (and (not result)
		he-expand-list)
	  (progn
	    (setq he-expand-list (cdr he-expand-list))
	    (setq killstr (car he-expand-list))
	    (setq he-search-loc2 0))))
    result))