Don’t prefix lambdas with #'

This commit is contained in:
Milan Zamazal 2022-06-28 21:27:49 +02:00
parent c31950cb30
commit 9425f7f359
2 changed files with 29 additions and 29 deletions

View File

@ -55,7 +55,7 @@ version, call `pw-lib-refresh' first."
(let ((objects pw-lib--objects)) (let ((objects pw-lib--objects))
(when type (when type
(setq objects (cl-remove-if-not (setq objects (cl-remove-if-not
#'(lambda (o) (string= (cdr (assq 'type (cdr o))) type)) (lambda (o) (string= (cdr (assq 'type (cdr o))) type))
objects))) objects)))
objects)) objects))
@ -148,13 +148,13 @@ Note that PipeWire data is cached, if you need its up-to-date
version, call `pw-lib-refresh' first." version, call `pw-lib-refresh' first."
(unless pw-lib--defaults (unless pw-lib--defaults
(let ((defaults (pw-access-defaults pw-lib--accessor)) (let ((defaults (pw-access-defaults pw-lib--accessor))
(nodes (mapcar #'(lambda (o) (nodes (mapcar (lambda (o)
(cons (pw-lib-object-value o "node.name") (pw-lib-object-id o))) (cons (pw-lib-object-value o "node.name") (pw-lib-object-id o)))
(pw-lib-objects "Node")))) (pw-lib-objects "Node"))))
(setq pw-lib--defaults (setq pw-lib--defaults
(cl-remove-if-not #'cdr (cl-remove-if-not #'cdr
(mapcar #'(lambda (d) (mapcar (lambda (d)
(cons (car d) (cdr (assoc (cdr d) nodes)))) (cons (car d) (cdr (assoc (cdr d) nodes))))
defaults))))) defaults)))))
pw-lib--defaults) pw-lib--defaults)
@ -170,12 +170,12 @@ version, call `pw-lib-refresh' first."
(or pw-lib--bindings (or pw-lib--bindings
(setq pw-lib--bindings (setq pw-lib--bindings
(apply #'nconc (apply #'nconc
(mapcar #'(lambda (o) (mapcar (lambda (o)
(let ((o-id (pw-lib-object-id o))) (let ((o-id (pw-lib-object-id o)))
(mapcar #'(lambda (p) (mapcar (lambda (p)
(cons o-id (cdr p))) (cons o-id (cdr p)))
(cl-remove-if-not #'numberp (pw-lib--object-info o) (cl-remove-if-not #'numberp (pw-lib--object-info o)
:key #'cdr)))) :key #'cdr))))
(pw-lib-objects)))))) (pw-lib-objects))))))
(defun pw-lib-children (id &optional type) (defun pw-lib-children (id &optional type)
@ -185,10 +185,10 @@ type are returned.
Note that PipeWire data is cached, if you need its up-to-date Note that PipeWire data is cached, if you need its up-to-date
version, call `pw-lib-refresh' first." version, call `pw-lib-refresh' first."
(let ((children (mapcar #'pw-lib-get-object (let ((children (mapcar #'pw-lib-get-object
(mapcar #'car (cl-remove-if #'(lambda (b) (/= (cdr b) id)) (mapcar #'car (cl-remove-if (lambda (b) (/= (cdr b) id))
(pw-lib-bindings)))))) (pw-lib-bindings))))))
(when type (when type
(setq children (cl-remove-if-not #'(lambda (o) (equal (pw-lib-object-type o) type)) (setq children (cl-remove-if-not (lambda (o) (equal (pw-lib-object-type o) type))
children))) children)))
children)) children))
@ -196,9 +196,9 @@ version, call `pw-lib-refresh' first."
(when node (when node
(let ((ports (pw-lib-children (pw-lib-object-id node) "Port"))) (let ((ports (pw-lib-children (pw-lib-object-id node) "Port")))
(if regexp (if regexp
(cl-delete-if-not #'(lambda (o) (cl-delete-if-not (lambda (o)
(if-let ((name (pw-lib-object-value o "port.name"))) (if-let ((name (pw-lib-object-value o "port.name")))
(string-match regexp name))) (string-match regexp name)))
ports) ports)
ports)))) ports))))

View File

@ -101,10 +101,10 @@ The indicator is displayed only on graphical terminals."
(description-properties (if (equal type "Client") (description-properties (if (equal type "Client")
'("application.name") '("application.name")
(let ((prefix (concat (downcase type) "."))) (let ((prefix (concat (downcase type) ".")))
(mapcar #'(lambda (suffix) (concat prefix suffix)) (mapcar (lambda (suffix) (concat prefix suffix))
'("description" "name")))))) '("description" "name"))))))
(or (cl-find-if #'identity (or (cl-find-if #'identity
(mapcar #'(lambda (p) (pw-lib-object-value object p)) (mapcar (lambda (p) (pw-lib-object-value object p))
description-properties)) description-properties))
""))) "")))
@ -213,14 +213,14 @@ The indicator is displayed only on graphical terminals."
(setq pw-ui--osd-timer (setq pw-ui--osd-timer
(run-with-timer (run-with-timer
pipewire-osd-timeout nil pipewire-osd-timeout nil
#'(lambda () (lambda ()
(when pw-ui--osd-frame (when pw-ui--osd-frame
(ignore-errors (delete-frame pw-ui--osd-frame))) (ignore-errors (delete-frame pw-ui--osd-frame)))
(when pw-ui--osd-buffer (when pw-ui--osd-buffer
(ignore-errors (kill-buffer pw-ui--osd-buffer))) (ignore-errors (kill-buffer pw-ui--osd-buffer)))
(setq pw-ui--osd-frame nil (setq pw-ui--osd-frame nil
pw-ui--osd-timer nil pw-ui--osd-timer nil
pw-ui--osd-buffer nil))))) pw-ui--osd-buffer nil)))))
(defmacro pw-ui--osd (&rest body) (defmacro pw-ui--osd (&rest body)
(declare (indent defun)) (declare (indent defun))
@ -349,10 +349,10 @@ Otherwise ask for the Node to set as the default Node."
(let ((object (or (pw-ui--current-object nil '("Device" "Node")) (let ((object (or (pw-ui--current-object nil '("Device" "Node"))
(let* ((default-node-ids (mapcar #'cdr (pw-lib-default-nodes))) (let* ((default-node-ids (mapcar #'cdr (pw-lib-default-nodes)))
(nodes (cl-remove-if (nodes (cl-remove-if
#'(lambda (n) (member (pw-lib-object-id n) default-node-ids)) (lambda (n) (member (pw-lib-object-id n) default-node-ids))
(pw-lib-objects "Node"))) (pw-lib-objects "Node")))
(node-mapping (mapcar #'(lambda (n) (cons (pw-ui--object-name n) (node-mapping (mapcar (lambda (n) (cons (pw-ui--object-name n)
(pw-lib-object-id n))) (pw-lib-object-id n)))
nodes)) nodes))
(node-name (completing-read "Default node: " node-mapping nil t))) (node-name (completing-read "Default node: " node-mapping nil t)))
(pw-lib-get-object (cdr (assoc node-name node-mapping))))))) (pw-lib-get-object (cdr (assoc node-name node-mapping)))))))