Function: recentf-apply-menu-filter

recentf-apply-menu-filter is a byte-compiled function defined in recentf.el.gz.

Signature

(recentf-apply-menu-filter FILTER L)

Documentation

Apply function FILTER to the list of menu-elements L.

It takes care of sub-menu elements in L and recursively apply FILTER to them. It is guaranteed that FILTER receives only a list of single menu-elements (no sub-menu).

Source Code

;; Defined in /usr/src/emacs/lisp/recentf.el.gz
(defun recentf-apply-menu-filter (filter l)
  "Apply function FILTER to the list of menu-elements L.
It takes care of sub-menu elements in L and recursively apply FILTER
to them.  It is guaranteed that FILTER receives only a list of single
menu-elements (no sub-menu)."
  (if (and l (functionp filter))
      (let ((case-fold-search recentf-case-fold-search)
            elts others)
        ;; split L into two sub-lists, one of sub-menus elements and
        ;; another of single menu elements.
        (dolist (elt l)
          (if (recentf-sub-menu-element-p elt)
              (push elt elts)
            (push elt others)))
        ;; Apply FILTER to single elements.
        (when others
          (setq others (funcall filter (nreverse others))))
        ;; Apply FILTER to sub-menu elements.
        (setq l nil)
        (dolist (elt elts)
          (recentf-set-menu-element-value
           elt (recentf-apply-menu-filter
                filter (recentf-menu-element-value elt)))
          (push elt l))
        ;; Return the new filtered menu element list.
        (nconc l others))
    l))