[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bluetooth 404a357e51 2/2: start the list view update ti
From: |
ELPA Syncer |
Subject: |
[elpa] externals/bluetooth 404a357e51 2/2: start the list view update timer exactly once and clean up properly |
Date: |
Fri, 7 Jan 2022 15:57:17 -0500 (EST) |
branch: externals/bluetooth
commit 404a357e5115dd3159e12666c14488a296f1c4c5
Author: Raffael Stocker <r.stocker@mnet-mail.de>
Commit: Raffael Stocker <r.stocker@mnet-mail.de>
start the list view update timer exactly once and clean up properly
---
bluetooth.el | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/bluetooth.el b/bluetooth.el
index 91e240cebd..1c998ba726 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -421,8 +421,9 @@ This function only uses the first adapter reported by
Bluez."
(mapc #'bluetooth--device-remove
(hash-table-keys bluetooth--device-info))
(setq bluetooth--device-info nil)
- (remove-hook tabulated-list-revert-hook #'bluetooth--update-all)
- (cancel-timer bluetooth--update-timer)))
+ (remove-hook 'tabulated-list-revert-hook #'bluetooth--update-all)
+ (cancel-timer bluetooth--update-timer)
+ (setq bluetooth--update-timer nil)))
(defun bluetooth-unload-function ()
"Clean up when the bluetooth feature is unloaded."
@@ -4513,13 +4514,15 @@ profiles."
(bluetooth-defun-method "StartDiscovery" :adapter
"Start discovery mode."
- (setq bluetooth--update-timer
- (run-at-time nil bluetooth-update-interval
- #'bluetooth--update-print)))
+ (unless bluetooth--update-timer
+ (setq bluetooth--update-timer
+ (run-at-time nil bluetooth-update-interval
+ #'bluetooth--update-print))))
(bluetooth-defun-method "StopDiscovery" :adapter
"Stop discovery mode."
- (cancel-timer bluetooth--update-timer))
+ (cancel-timer bluetooth--update-timer)
+ (setq bluetooth--update-timer nil))
(bluetooth-defun-method "Pair" :device
"Pair with device at point.")
@@ -4801,9 +4804,15 @@ scanning the bus, displaying device info etc."
(bluetooth-mode)
(setq bluetooth--method-objects (bluetooth--register-agent))
(cl-pushnew bluetooth--mode-info mode-line-process)
- (add-hook 'kill-buffer-hook #'bluetooth--cleanup nil t)
+ (add-hook 'kill-buffer-hook #'bluetooth--cleanup 0 t)
(setq imenu-create-index-function #'bluetooth--create-imenu-index)
(bluetooth--initialize-mode-info)
+ (setq bluetooth--update-timer
+ (if (bluetooth--adapter-property (cl-first
(bluetooth--query-adapters))
+
"Discovering")
+ (run-at-time nil bluetooth-update-interval
+
#'bluetooth--update-print)
+ nil))
(setq bluetooth--adapter-signal
(bluetooth--register-signal-handler)))))