-;;; 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.
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))
"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.
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.
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.
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.
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.
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.
(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)
(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.
(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
(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}"))))))))
(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.
(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.
(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)
-;;; shr.el --- Simple HTML Renderer
+;;; shr.el --- Simple HTML Renderer -*- lexical-binding: t -*-
;; Copyright (C) 2010-2016 Free Software Foundation, Inc.
(max-height (and edges
(truncate (* shr-max-image-proportion
(- (nth 3 edges) (nth 1 edges))))))
- svg image)
+ svg)
(when (and max-width
(> width max-width))
(setq height (truncate (* (/ (float max-width) width) height))
(dolist (column row)
(setq max (max max (nth 2 column))))
max)))
- (dotimes (i (max height 1))
+ (dotimes (_ (max height 1))
(shr-indent)
(insert shr-table-vertical-line "\n"))
(dolist (column row)
(goto-char start)
;; Sum up all the widths from the column. (There may be
;; more than one if this is a "colspan" column.)
- (dotimes (i (nth 4 column))
+ (dotimes (_ (nth 4 column))
;; The colspan directive may be wrong and there may not be
;; that number of columns.
(when (<= column-number (1- (length widths)))
(forward-line 1))
;; Add blank lines at padding at the bottom of the TD,
;; possibly.
- (dotimes (i (- height (length lines)))
+ (dotimes (_ (- height (length lines)))
(end-of-line)
(let ((start (point)))
(insert (propertize " "
(push data tds)))))
(when (and colspan
(> colspan 1))
- (dotimes (c (1- colspan))
+ (dotimes (_ (1- colspan))
(setq i (1+ i))
(push
(if fill