summaryrefslogtreecommitdiff
path: root/lisp/net/dbus.el
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2016-10-31 20:19:21 -0400
committerMark Oteiza <mvoteiza@udel.edu>2016-10-31 20:19:21 -0400
commitd3c2d3ca4591b26a8d76f4b6ef1cfe5ccf766983 (patch)
tree074fb7b6019c4ab4cb6ce7aab9835a8d3a2df275 /lisp/net/dbus.el
parent05729e5ac2648324d70e454b25123f370d5c0571 (diff)
downloademacs-d3c2d3ca4591b26a8d76f4b6ef1cfe5ccf766983.tar.gz
Turn on lexical-binding in some net libs
* lisp/net/dbus.el: Turn on lexical-binding. (dbus-list-hash-table, dbus-list-known-names): (dbus-introspect-get-node-names, dbus-introspect-get-interface-names): (dbus-introspect-get-method-names, dbus-introspect-get-signal-names): (dbus-introspect-get-property-names): (dbus-introspect-get-argument-names, dbus-get-all-properties): (dbus-property-handler, dbus-get-all-managed-objects): (dbus-managed-object-handler): Replace add-to-list with push. Add nreverse in some places where the APPEND argument of add-to-list was used. * lisp/net/network-stream.el: Turn on lexical-binding. * lisp/net/newsticker.el: Turn on lexical-binding. * lisp/net/shr.el: Turn on lexical-binding. (shr-make-placeholder-image): Remove unused variable binding. (shr-inspect-table): Replace ignored bindings with underscore.
Diffstat (limited to 'lisp/net/dbus.el')
-rw-r--r--lisp/net/dbus.el65
1 files changed, 29 insertions, 36 deletions
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 7a4ef1f7bcf..2d7cd2fc612 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -1,4 +1,4 @@
-;;; dbus.el --- Elisp bindings for D-Bus.
+;;; dbus.el --- Elisp bindings for D-Bus. -*- lexical-binding: t -*-
;; Copyright (C) 2007-2016 Free Software Foundation, Inc.
@@ -492,7 +492,7 @@ See `dbus-registered-objects-table' for a description of the
hash table."
(let (result)
(maphash
- (lambda (key value) (add-to-list 'result (cons key value) 'append))
+ (lambda (key value) (push (cons key value) result))
dbus-registered-objects-table)
result))
@@ -1113,9 +1113,9 @@ unique names for services."
"Retrieve all services which correspond to a known name in BUS.
A service has a known name if it doesn't start with \":\"."
(let (result)
- (dolist (name (dbus-list-names bus) result)
+ (dolist (name (dbus-list-names bus) (nreverse result))
(unless (string-equal ":" (substring name 0 1))
- (add-to-list 'result name 'append)))))
+ (push name result)))))
(defun dbus-list-queued-owners (bus service)
"Return the unique names registered at D-Bus BUS and queued for SERVICE.
@@ -1214,9 +1214,8 @@ It returns a list of strings. The node names stand for further
object paths of the D-Bus service."
(let ((object (dbus-introspect-xml bus service path))
result)
- (dolist (elt (xml-get-children object 'node) result)
- (add-to-list
- 'result (dbus-introspect-get-attribute elt "name") 'append))))
+ (dolist (elt (xml-get-children object 'node) (nreverse result))
+ (push (dbus-introspect-get-attribute elt "name") result))))
(defun dbus-introspect-get-all-nodes (bus service path)
"Return all node names of SERVICE in D-Bus BUS at object path PATH.
@@ -1240,9 +1239,8 @@ interface is \"org.freedesktop.DBus.Properties\". If present,
children, beside \"method\" and \"signal\" objects."
(let ((object (dbus-introspect-xml bus service path))
result)
- (dolist (elt (xml-get-children object 'interface) result)
- (add-to-list
- 'result (dbus-introspect-get-attribute elt "name") 'append))))
+ (dolist (elt (xml-get-children object 'interface) (nreverse result))
+ (push (dbus-introspect-get-attribute elt "name") result))))
(defun dbus-introspect-get-interface (bus service path interface)
"Return the INTERFACE of SERVICE in D-Bus BUS at object path PATH.
@@ -1264,9 +1262,8 @@ The resulting \"interface\" object can contain \"method\", \"signal\",
SERVICE is a service of D-Bus BUS at object path PATH."
(let ((object (dbus-introspect-get-interface bus service path interface))
result)
- (dolist (elt (xml-get-children object 'method) result)
- (add-to-list
- 'result (dbus-introspect-get-attribute elt "name") 'append))))
+ (dolist (elt (xml-get-children object 'method) (nreverse result))
+ (push (dbus-introspect-get-attribute elt "name") result))))
(defun dbus-introspect-get-method (bus service path interface method)
"Return method METHOD of interface INTERFACE as XML object.
@@ -1288,9 +1285,8 @@ object can contain \"arg\" and \"annotation\" children."
SERVICE is a service of D-Bus BUS at object path PATH."
(let ((object (dbus-introspect-get-interface bus service path interface))
result)
- (dolist (elt (xml-get-children object 'signal) result)
- (add-to-list
- 'result (dbus-introspect-get-attribute elt "name") 'append))))
+ (dolist (elt (xml-get-children object 'signal) (nreverse result))
+ (push (dbus-introspect-get-attribute elt "name") result))))
(defun dbus-introspect-get-signal (bus service path interface signal)
"Return signal SIGNAL of interface INTERFACE as XML object.
@@ -1312,9 +1308,8 @@ object can contain \"arg\" and \"annotation\" children."
SERVICE is a service of D-Bus BUS at object path PATH."
(let ((object (dbus-introspect-get-interface bus service path interface))
result)
- (dolist (elt (xml-get-children object 'property) result)
- (add-to-list
- 'result (dbus-introspect-get-attribute elt "name") 'append))))
+ (dolist (elt (xml-get-children object 'property) (nreverse result))
+ (push (dbus-introspect-get-attribute elt "name") result))))
(defun dbus-introspect-get-property (bus service path interface property)
"This function returns PROPERTY of INTERFACE as XML object.
@@ -1345,9 +1340,8 @@ object, where the annotations belong to."
(dbus-introspect-get-property bus service path interface name))
(dbus-introspect-get-interface bus service path interface)))
result)
- (dolist (elt (xml-get-children object 'annotation) result)
- (add-to-list
- 'result (dbus-introspect-get-attribute elt "name") 'append))))
+ (dolist (elt (xml-get-children object 'annotation) (nreverse result))
+ (push (dbus-introspect-get-attribute elt "name") result))))
(defun dbus-introspect-get-annotation
(bus service path interface name annotation)
@@ -1382,9 +1376,8 @@ therefore, even if the method or signal has arguments."
(or (dbus-introspect-get-method bus service path interface name)
(dbus-introspect-get-signal bus service path interface name)))
result)
- (dolist (elt (xml-get-children object 'arg) result)
- (add-to-list
- 'result (dbus-introspect-get-attribute elt "name") 'append))))
+ (dolist (elt (xml-get-children object 'arg) (nreverse result))
+ (push (dbus-introspect-get-attribute elt "name") result))))
(defun dbus-introspect-get-argument (bus service path interface name arg)
"Return argument ARG as XML object.
@@ -1473,8 +1466,8 @@ nil is returned."
(dbus-call-method
bus service path dbus-interface-properties
"GetAll" :timeout 500 interface)
- result)
- (add-to-list 'result (cons (car dict) (cl-caadr dict)) 'append)))))
+ (nreverse result))
+ (push (cons (car dict) (cl-caadr dict)) result)))))
(defun dbus-register-property
(bus service path interface property access value
@@ -1609,11 +1602,11 @@ It will be registered for all objects created by `dbus-register-property'."
(when (and (equal (butlast key) (list :property bus interface))
(string-equal path (nth 2 (car val)))
(not (functionp (car (last (car val))))))
- (add-to-list
- 'result
+ (push
(list :dict-entry
(car (last key))
- (list :variant (cdar (last (car val))))))))
+ (list :variant (cdar (last (car val)))))
+ result)))
dbus-registered-objects-table)
;; Return the result, or an empty array.
(list :array (or result '(:signature "{sv}"))))))))
@@ -1684,12 +1677,12 @@ and \"org.freedesktop.DBus.Properties.GetAll\", which is slow."
(interface
(dbus-introspect-get-interface-names bus service object)
result1)
- (add-to-list
- 'result1
+ (push
(cons interface
- (dbus-get-all-properties bus service object interface))))
+ (dbus-get-all-properties bus service object interface))
+ result1))
(when result1
- (add-to-list 'result (cons object result1))))))))
+ (push (cons object result1) result)))))))
(defun dbus-managed-objects-handler ()
"Default handler for the \"org.freedesktop.DBus.ObjectManager\" interface.
@@ -1705,7 +1698,7 @@ It will be registered for all objects created by `dbus-register-service'."
(lambda (key val)
(when (and (equal (butlast key 2) (list :method bus))
(null (nth 2 (car-safe val))))
- (add-to-list 'interfaces (nth 2 key))))
+ (push (nth 2 key) interfaces)))
dbus-registered-objects-table)
;; Check all registered object paths.
@@ -1716,7 +1709,7 @@ It will be registered for all objects created by `dbus-register-service'."
(string-prefix-p path object))
(dolist (interface (cons (nth 2 key) interfaces))
(unless (assoc object result)
- (add-to-list 'result (list object)))
+ (push (list object) result))
(unless (assoc interface (cdr (assoc object result)))
(setcdr
(assoc object result)