[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master d3c2d3c: Turn on lexical-binding in some net libs
From: |
Mark Oteiza |
Subject: |
[Emacs-diffs] master d3c2d3c: Turn on lexical-binding in some net libs |
Date: |
Tue, 1 Nov 2016 00:25:20 +0000 (UTC) |
branch: master
commit d3c2d3ca4591b26a8d76f4b6ef1cfe5ccf766983
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>
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.
---
lisp/net/dbus.el | 65 ++++++++++++++++++++------------------------
lisp/net/network-stream.el | 2 +-
lisp/net/newsticker.el | 2 +-
lisp/net/shr.el | 12 ++++----
4 files changed, 37 insertions(+), 44 deletions(-)
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 7a4ef1f..2d7cd2f 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)
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index c2845d9..50991fd 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -1,4 +1,4 @@
-;;; network-stream.el --- open network processes, possibly with encryption
+;;; network-stream.el --- open network processes, possibly with encryption -*-
lexical-binding: t -*-
;; Copyright (C) 2010-2016 Free Software Foundation, Inc.
diff --git a/lisp/net/newsticker.el b/lisp/net/newsticker.el
index 66b7a69..7eff422 100644
--- a/lisp/net/newsticker.el
+++ b/lisp/net/newsticker.el
@@ -1,4 +1,4 @@
-;;; newsticker.el --- A Newsticker for Emacs.
+;;; newsticker.el --- A Newsticker for Emacs. -*- lexical-binding: t -*-
;; Copyright (C) 2003-2016 Free Software Foundation, Inc.
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index a3cc807..7ea33fb 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1,4 +1,4 @@
-;;; shr.el --- Simple HTML Renderer
+;;; shr.el --- Simple HTML Renderer -*- lexical-binding: t -*-
;; Copyright (C) 2010-2016 Free Software Foundation, Inc.
@@ -1582,7 +1582,7 @@ The preference is a float determined from
`shr-prefer-media-type'."
(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))
@@ -1919,7 +1919,7 @@ The preference is a float determined from
`shr-prefer-media-type'."
(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)
@@ -1927,7 +1927,7 @@ The preference is a float determined from
`shr-prefer-media-type'."
(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)))
@@ -1958,7 +1958,7 @@ The preference is a float determined from
`shr-prefer-media-type'."
(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 " "
@@ -2140,7 +2140,7 @@ The preference is a float determined from
`shr-prefer-media-type'."
(push data tds)))))
(when (and colspan
(> colspan 1))
- (dotimes (c (1- colspan))
+ (dotimes (_ (1- colspan))
(setq i (1+ i))
(push
(if fill
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master d3c2d3c: Turn on lexical-binding in some net libs,
Mark Oteiza <=