Function: ido-wash-history

ido-wash-history is an interactive and byte-compiled function defined in ido.el.gz.

Signature

(ido-wash-history)

Documentation

Clean-up Ido history and cache information.

Removes badly formatted data and ignored directories.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/ido.el.gz
(defun ido-wash-history ()
  "Clean-up Ido history and cache information.
Removes badly formatted data and ignored directories."
  (interactive)
  ;; Check format of each of our lists, discard bogus elements
  (setq ido-last-directory-list
	(and (listp ido-last-directory-list)
	     (let ((l ido-last-directory-list) r)
	       (while l
		 (if (and (consp (car l))
			  (stringp (car (car l)))
			  (stringp (cdr (car l))))
		     (setq r (cons (car l) r)))
		 (setq l (cdr l)))
	       (nreverse r))))
  (setq ido-work-directory-list
	(and (listp ido-work-directory-list)
	     (let ((l ido-work-directory-list) r)
	       (while l
		 (if (and (stringp (car l))
			  (or ido-record-ftp-work-directories
			      (not (ido-is-ftp-directory (car l)))))
		     (setq r (cons (car l) r)))
		 (setq l (cdr l)))
	       (nreverse r))))
  (setq ido-work-file-list
	(and (listp ido-work-file-list)
	     (let ((l ido-work-file-list) r)
	       (while l
		 (if (stringp (car l))
		     (setq r (cons (car l) r)))
		 (setq l (cdr l)))
	       (nreverse r))))
  (setq ido-dir-file-cache
	(and (listp ido-dir-file-cache)
	     (let ((l ido-dir-file-cache) r)
	       (while l
		 (if (and (listp (car l))
			  (> (length (car l)) 2)
			  (let ((dir (car (car l)))
				(time (car (cdr (car l))))
				(files (cdr (cdr (car l)))))
			    (and
			     (stringp dir)
			     (if (condition-case nil
				     (not (time-equal-p time 0))
				   (error))
				 (ido-may-cache-directory dir)
			       (and
				(consp time)
				(numberp (cdr time))
				(cond
				 ((eq (car time) 'ftp)
				  (and (ido-is-ftp-directory dir)
				       (ido-cache-ftp-valid (cdr time))))
				 ((eq (car time) 'unc)
				  (and (ido-is-unc-host dir)
				       (ido-cache-unc-valid (cdr time)))))))
			     (let ((s files) (ok t))
			       (while s
				 (if (stringp (car s))
				     (setq s (cdr s))
				   (setq s nil ok nil)))
			       ok))))
		     (setq r (cons (car l) r)))
		 (setq l (cdr l)))
	       (nreverse r))))

  ;; Remove ignored directories from work directory list
  ;; according to ido-work-directory-list-ignore-regexps
  (if ido-work-directory-list
      (let ((dirs (reverse ido-work-directory-list)))
	(setq ido-work-directory-list nil)
	(while dirs
	  (ido-record-work-directory (car dirs))
	  (setq dirs (cdr dirs)))))
  ;; Get rid of text properties
  (let ((l ido-last-directory-list) e)
    (while l
      (setq e (car l) l (cdr l))
      (set-text-properties 0 (length (car e)) nil (car e))
      (set-text-properties 0 (length (cdr e)) nil (cdr e))))
  (let ((l ido-work-directory-list) e)
    (while l
      (setq e (car l) l (cdr l))
      (set-text-properties 0 (length e) nil e)))
  (let ((l ido-work-file-list) e)
    (while l
      (setq e (car l) l (cdr l))
      (set-text-properties 0 (length e) nil e)))
  (let ((l ido-dir-file-cache) e d)
    (while l
      (setq e (car l) l (cdr l))
      (if (listp e)
	  (while e
	    (setq d (car e) e (cdr e))
	    (if (not (consp d))
		(set-text-properties 0 (length d) nil d)))))))