Function: try-expand-dabbrev
try-expand-dabbrev is a byte-compiled function defined in
hippie-exp.el.gz.
Signature
(try-expand-dabbrev OLD)
Documentation
Try to expand word "dynamically", searching the current buffer.
The argument OLD has to be nil the first call of this function, and t for subsequent calls (for further possible expansions of the same string). It returns t if a new expansion is found, nil otherwise.
Source Code
;; Defined in /usr/src/emacs/lisp/hippie-exp.el.gz
(defun try-expand-dabbrev (old)
"Try to expand word \"dynamically\", searching the current buffer.
The argument OLD has to be nil the first call of this function, and t
for subsequent calls (for further possible expansions of the same
string). It returns t if a new expansion is found, nil otherwise."
(let ((expansion ()))
(if (not old)
(progn
(he-init-string (he-dabbrev-beg) (point))
(set-marker he-search-loc he-string-beg)
(setq he-search-bw t)))
(if (not (equal he-search-string ""))
(save-excursion
(save-restriction
(if hippie-expand-no-restriction
(widen))
;; Try looking backward unless inhibited.
(if he-search-bw
(progn
(goto-char he-search-loc)
(setq expansion (he-dabbrev-search he-search-string t))
(set-marker he-search-loc (point))
(if (not expansion)
(progn
(set-marker he-search-loc he-string-end)
(setq he-search-bw ())))))
(if (not expansion) ; Then look forward.
(progn
(goto-char he-search-loc)
(setq expansion (he-dabbrev-search he-search-string nil))
(set-marker he-search-loc (point)))))))
(if (not expansion)
(progn
(if old (he-reset-string))
())
(progn
(he-substitute-string expansion t)
t))))