[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bluetooth 9d79f61 46/57: puts the key bindings in their
From: |
Stefan Monnier |
Subject: |
[elpa] externals/bluetooth 9d79f61 46/57: puts the key bindings in their own defvar (as is usual) |
Date: |
Thu, 7 Nov 2019 23:28:57 -0500 (EST) |
branch: externals/bluetooth
commit 9d79f616f9545b41801066801c4845a316c6003a
Author: Raffael Stocker <address@hidden>
Commit: Raffael Stocker <address@hidden>
puts the key bindings in their own defvar (as is usual)
---
bluetooth.el | 52 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 34 insertions(+), 18 deletions(-)
diff --git a/bluetooth.el b/bluetooth.el
index 633cf97..92befae 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -106,7 +106,6 @@ This is usually `:system' if bluetoothd runs as a system
service, or
;;; This alist specifies all the commands. The format is as follows:
;;;
;;; command . COMMAND specifies the command name
-;;; key . [?c] specifies the key binding in `bluetooth-mode-map'
;;; method . "Method" specifies a D-Bus method "Method"
;;; toggle . "Tprop" specifies a D-Bus property "Tprop" that is toggled
;;; by the command
@@ -123,30 +122,50 @@ This is usually `:system' if bluetoothd runs as a system
service, or
;;; (e.g. "/org/bluez/hci0/dev_...")
;;; run . (FORM) runs the lisp FORM after the D-Bus command
;;; docstring . "STRING" adds STRING as documentation to the command
-(defvar bluetooth--commands
- '(((command . connect) (key . [?c]) (method . "Connect") (api . :device)
+(defconst bluetooth--commands
+ '(((command . connect) (method . "Connect") (api . :device)
(docstring . "Connect to the Bluetooth device at point."))
- ((command . disconnect) (key . [?d]) (method . "Disconnect")
+ ((command . disconnect) (method . "Disconnect")
(api . :device) (docstring . "Disconnect Bluetooth device at point."))
- ((command . toggle-blocked) (key . [?b]) (toggle . "Blocked")
+ ((command . toggle-blocked) (toggle . "Blocked")
(api . :device) (docstring . "Mark Bluetooth device at point blocked."))
- ((command . toggle-trusted) (key . [?t]) (toggle . "Trusted")
+ ((command . toggle-trusted) (toggle . "Trusted")
(api . :device) (docstring . "Mark Bluetooth device at point trusted."))
- ((command . set-alias) (key . [?a]) (set . "Alias")
+ ((command . set-alias) (set . "Alias")
(query . "Alias (empty to reset): ") (api . :device)
(docstring . "Set alias of Bluetooth device at point."))
- ((command . start-discovery) (key . [?r]) (method . "StartDiscovery")
+ ((command . start-discovery) (method . "StartDiscovery")
(api . :adapter) (docstring . "Start discovery mode."))
- ((command . stop-discovery) (key . [?R]) (method . "StopDiscovery")
+ ((command . stop-discovery) (method . "StopDiscovery")
(api . :adapter) (docstring . "Stop discovery mode."))
- ((command . toggle-power) (key . [?s]) (toggle . "Powered")
+ ((command . toggle-power) (toggle . "Powered")
(api . :adapter) (docstring . "Toggle power supply of adapter."))
- ((command . pair) (key . [?P]) (method . "Pair")
+ ((command . pair) (method . "Pair")
(api . :device) (docstring . "Pair with a device."))
- ((command . toggle-discoverable) (key . [?D]) (toggle . "Discoverable")
+ ((command . toggle-discoverable) (toggle . "Discoverable")
(api . :adapter) (docstring . "Toggle discoverable mode."))
- ((command . toggle-pairable) (key . [?x]) (toggle . "Pairable")
- (api . :adapter) (docstring . "Toggle pairable mode."))))
+ ((command . toggle-pairable) (toggle . "Pairable")
+ (api . :adapter) (docstring . "Toggle pairable mode.")))
+ "Bluetooth command definitions.")
+
+(defvar bluetooth-mode-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map tabulated-list-mode-map)
+ (define-key map [?c] #'bluetooth-connect)
+ (define-key map [?d] #'bluetooth-disconnect)
+ (define-key map [?b] #'bluetooth-toggle-blocked)
+ (define-key map [?t] #'bluetooth-toggle-trusted)
+ (define-key map [?a] #'bluetooth-set-alias)
+ (define-key map [?r] #'bluetooth-start-discovery)
+ (define-key map [?R] #'bluetooth-stop-discovery)
+ (define-key map [?s] #'bluetooth-toggle-power)
+ (define-key map [?P] #'bluetooth-pair)
+ (define-key map [?D] #'bluetooth-toggle-discoverable)
+ (define-key map [?x] #'bluetooth-toggle-pairable)
+ (define-key map [?i] #'bluetooth-show-device-info)
+ (define-key map [?k] #'bluetooth-remove-device)
+ map)
+ "The Bluetooth mode keymap.")
;;; This function provides the list entries for the tabulated-list
;;; view. It is called from `tabulated-list-print'.
@@ -180,8 +199,6 @@ For documentation, see URL
`https://gitlab.com/rstocker/emacs-bluetooth'."
tabulated-list-entries #'bluetooth--list-entries
tabulated-list-padding 1)
(bluetooth--make-commands)
- (define-key bluetooth-mode-map [?i] #'bluetooth-show-device-info)
- (define-key bluetooth-mode-map [?k] #'bluetooth-remove-device)
(tabulated-list-init-header))
;;; This function returns a list of bluetooth adapters and devices
@@ -340,8 +357,7 @@ For documentation, see URL
`https://gitlab.com/rstocker/emacs-bluetooth'."
(.set `(lambda (arg) (interactive ,(concat "M" .query))
(bluetooth--dbus-set , .set arg , .api)
,@ .run)))
- .docstring)
- (define-key bluetooth-mode-map .key command)))))
+ .docstring)))))
(defun bluetooth--display-state ()
"Get the current adapter state and display it.
- [elpa] externals/bluetooth 0108cbd 32/57: uses `read-from-minibuffer' instead of `read-passwd', (continued)
- [elpa] externals/bluetooth 0108cbd 32/57: uses `read-from-minibuffer' instead of `read-passwd', Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 1ec2997 22/57: uses the correct bus (:system) for the callback methods, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 83344c8 20/57: cleans up display code, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth fe926e9 28/57: puts functions before the long uuid defconsts for readability, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth c473128 40/57: adds repository URL to mode (entry) command docstring, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth eb1d4ea 25/57: adds UUID and service/device class parsing and display, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth f9bfd26 39/57: fixes a grammatical mistake in Readme.org, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 565cfec 38/57: adds more elaborate usage information, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 7714f6b 45/57: updates Readme, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 1f3b244 47/57: makes checkdoc and package-lint happy, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 9d79f61 46/57: puts the key bindings in their own defvar (as is usual),
Stefan Monnier <=
- [elpa] externals/bluetooth fd39a17 50/57: cleans up movement to beginning/end of list, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 5387639 52/57: adds path loss to device info, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth ea7ccf7 53/57: fixes mode line update, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 21e6a14 34/57: adds hl-line-mode activation, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth cb5a39c 29/57: adds SDO UUIDs and simplifies the UUID handling functions, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 44e81ed 42/57: rearranges UUID data and functions, concentrates interface names, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 72f061d 48/57: updates commentary and cleans up whitespace, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 2ce2322 49/57: improves device info printing, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth e002888 27/57: updates Readme.org, Stefan Monnier, 2019/11/07
- [elpa] externals/bluetooth 15d1f53 37/57: adds a pointer to the source of assigned numbers data, Stefan Monnier, 2019/11/07