Function: plstore-find

plstore-find is an autoloaded and byte-compiled function defined in plstore.el.gz.

Signature

(plstore-find PLSTORE KEYS)

Documentation

Return all PLSTORE entries matching plist KEYS.

Source Code

;; Defined in /usr/src/emacs/lisp/plstore.el.gz
(defun plstore-find (plstore keys)
  "Return all PLSTORE entries matching plist KEYS."
  (let (entries alist entry match decrypt plist)
    ;; First, go through the merged alist and collect entries matched
    ;; by the keys.
    (setq alist (plstore--get-merged-alist plstore))
    (while alist
      (setq entry (car alist)
	    alist (cdr alist)
	    match (plstore--match entry keys t))
      (if (eq match 'secret)
	  (setq decrypt t)
	(when match
	  (setq plist (cdr entry))
	  (while plist
	    (if (plstore--has-secret-keys plist)
		(setq decrypt t
		      plist nil))
	    (setq plist (nthcdr 2 plist)))
	  (setq entries (cons entry entries)))))
    ;; Second, decrypt the plstore and try again.
    (when decrypt
      (setq entries nil)
      (plstore--decrypt plstore)
      (setq alist (plstore--get-merged-alist plstore))
      (while alist
	(setq entry (car alist)
	      alist (cdr alist)
	      match (plstore--match entry keys nil))
	(if match
	    (setq entries (cons entry entries)))))
    (nreverse entries)))