Function: eshell-find-previous-directory

eshell-find-previous-directory is a byte-compiled function defined in em-dirs.el.gz.

Signature

(eshell-find-previous-directory REGEXP)

Documentation

Find the most recent last-dir matching REGEXP.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-dirs.el.gz
(defun eshell-find-previous-directory (regexp)
  "Find the most recent last-dir matching REGEXP."
  (let ((index 0)
	(len (ring-length eshell-last-dir-ring))
	oldpath)
    (if (> (length regexp) 0)
	(while (< index len)
	  (setq oldpath (ring-ref eshell-last-dir-ring index))
	  (if (string-match regexp oldpath)
	      (setq index len)
	    (setq oldpath nil
		  index (1+ index)))))
    oldpath))