Function: frameset-filter-params

frameset-filter-params is a byte-compiled function defined in frameset.el.gz.

Signature

(frameset-filter-params PARAMETERS FILTER-ALIST SAVING)

Documentation

Filter parameter alist PARAMETERS and return a filtered alist.

FILTER-ALIST is an alist of parameter filters, in the format of frameset-filter-alist (which see). SAVING is non-nil while filtering parameters to save a frameset, nil while the filtering is done to restore it.

Source Code

;; Defined in /usr/src/emacs/lisp/frameset.el.gz
(defun frameset-filter-params (parameters filter-alist saving)
  "Filter parameter alist PARAMETERS and return a filtered alist.
FILTER-ALIST is an alist of parameter filters, in the format of
`frameset-filter-alist' (which see).
SAVING is non-nil while filtering parameters to save a frameset,
nil while the filtering is done to restore it."
  (let ((filtered nil))
    (dolist (current parameters)
      ;; When saving, the parameter alist is temporary, so modifying it
      ;; is not a problem.  When restoring, the parameter alist is part
      ;; of a frameset, so we must copy parameters to avoid inadvertent
      ;; modifications.
      (pcase (cdr (assq (car current) filter-alist))
	('nil
	 (push (if saving current (copy-tree current)) filtered))
	(:never
	 nil)
	(:restore
	 (unless saving (push (copy-tree current) filtered)))
	(:save
	 (when saving (push current filtered)))
	((or `(,fun . ,args) (and fun (pred fboundp)))
	 (let* ((this (apply fun current filtered parameters saving args))
		(val (if (eq this t) current this)))
	   (when val
	     (push (if saving val (copy-tree val)) filtered))))
	(other
	 (delay-warning 'frameset (format "Unknown filter %S" other) :error))))
    ;; Set the display parameter after filtering, so that filter functions
    ;; have access to its original value.
    (when frameset--target-display
      (setf (alist-get 'display filtered) (cdr frameset--target-display)))
    filtered))