[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bluetooth 8cac69d 26/57: checks list-id for nil to avoi
From: |
Stefan Monnier |
Subject: |
[elpa] externals/bluetooth 8cac69d 26/57: checks list-id for nil to avoid errors at actions w/o list item |
Date: |
Thu, 7 Nov 2019 23:28:53 -0500 (EST) |
branch: externals/bluetooth
commit 8cac69d85fa63bf948a7cea2fa00d3cc4f2a245b
Author: Raffael Stocker <address@hidden>
Commit: Raffael Stocker <address@hidden>
checks list-id for nil to avoid errors at actions w/o list item
---
bluetooth.el | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/bluetooth.el b/bluetooth.el
index 9ea275d..53c7ca7 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -300,25 +300,30 @@ devices, as well as setting properties."
;;; Invoke a D-Bus method with or without parameters.
(defun bluetooth--dbus-method (method api &rest args)
"Invoke METHOD on D-Bus API with ARGS."
- (apply #'bluetooth--call-method (tabulated-list-get-id) api
- #'dbus-call-method-asynchronously method
- #'bluetooth--update-list :timeout bluetooth--timeout args))
+ (let ((dev-id (tabulated-list-get-id)))
+ (when dev-id
+ (apply #'bluetooth--call-method dev-id api
+ #'dbus-call-method-asynchronously method
+ #'bluetooth--update-list :timeout bluetooth--timeout args))))
;;; Toggle a property.
(defun bluetooth--dbus-toggle (property api)
"Toggle boolean PROPERTY on D-Bus API."
- (let* ((dev-id (tabulated-list-get-id))
- (value (bluetooth--call-method dev-id api
- #'dbus-get-property property)))
- (bluetooth--call-method dev-id api #'dbus-set-property property (not
value))
- (bluetooth--update-list)))
+ (let ((dev-id (tabulated-list-get-id)))
+ (when dev-id
+ (let ((value (bluetooth--call-method dev-id api
+ #'dbus-get-property property)))
+ (bluetooth--call-method dev-id api #'dbus-set-property property
+ (not value))
+ (bluetooth--update-list)))))
;;; Set a property.
(defun bluetooth--dbus-set (property arg api)
"Set PROPERTY to ARG on D-Bus API."
- (bluetooth--call-method (tabulated-list-get-id)
- api #'dbus-set-property property arg)
- (bluetooth--update-list))
+ (let ((dev-id (tabulated-list-get-id)))
+ (when dev-id
+ (bluetooth--call-method dev-id api #'dbus-set-property property arg)
+ (bluetooth--update-list))))
;;; end of worker function definitions
- [elpa] externals/bluetooth 5db9e29 08/57: adds bluetooth--release, (continued)
- [elpa] externals/bluetooth 5db9e29 08/57: adds bluetooth--release, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth a883d60 10/57: fixes spurious error on clean-up, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth e6ca72d 06/57: corrects docstrings and Readme.org, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth dd28c81 11/57: turns defvar into defconst where possible, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 00497ca 03/57: adds bluetooth.el and .gitignore, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 0cac7d9 09/57: makes status display in mode line buffer-local, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 58dd9f9 12/57: adds 'Maintainer' header and cleans up 'Package-Requires', Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 2560749 15/57: adds Imenu integration, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth cc33d79 14/57: corrects project name in LICENSE, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 3743458 17/57: corrects list redisplay when mode is restarted, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 8cac69d 26/57: checks list-id for nil to avoid errors at actions w/o list item,
Stefan Monnier <=
- [elpa] externals/bluetooth 4a40ee6 24/57: adds GATT UUIDs and a rudimentary display function, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth f33cb12 02/57: Add LICENSE, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth ee4e582 30/57: fixes compiler warnings about unused parameters, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 3365413 33/57: corrects the major mode check in `list-bluetooth-devices', Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth b47bddc 36/57: switches device-info buffer to special mode, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 42a9487 35/57: moves `hl-line-mode' to end of init so hl is shown at startup, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 325febd 16/57: adds Imenu integration to Readme feature list, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth f0e5047 18/57: removes unnecessary quotes before lambdas and corrects indentation, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 738347b 19/57: adds TAGS to .gitignore, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 28e9eb2 21/57: wraps @body in progn in bluetooth--maybe-cancel-reject, Stefan Monnier, 2019/11/07