Function: dabbrev--try-find

dabbrev--try-find is a byte-compiled function defined in dabbrev.el.gz.

Signature

(dabbrev--try-find ABBREV REVERSE N IGNORE-CASE)

Documentation

Search for ABBREV, backwards if REVERSE, N times.

If IGNORE-CASE is non-nil, ignore case while searching. Return the expansion found, and save the location of the start of the expansion in dabbrev--last-expansion-location.

Source Code

;; Defined in /usr/src/emacs/lisp/dabbrev.el.gz
(defun dabbrev--try-find (abbrev reverse n ignore-case)
  "Search for ABBREV, backwards if REVERSE, N times.
If IGNORE-CASE is non-nil, ignore case while searching.
Return the expansion found, and save the location of the start
of the expansion in `dabbrev--last-expansion-location'."
  (save-excursion
    (save-restriction
      (widen)
      (let ((expansion nil))
	(and dabbrev--last-expansion-location
	     (goto-char dabbrev--last-expansion-location))
	(let ((case-fold-search ignore-case)
	      (count n))
	  (while (and (> count 0)
		      (setq expansion (dabbrev--search
                                       abbrev reverse
                                       (and ignore-case
                                            (if (eq dabbrev-case-distinction
                                                    'case-replace)
                                                case-replace
                                              dabbrev-case-distinction)))))
	    (setq count (1- count))))
	(and expansion
	     (setq dabbrev--last-expansion-location (point)))
	expansion))))