[elpa] externals/bluetooth b60b76c 10/33: add Makefile and remove now unused bluetooth-test* files

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit b60b76c61a97a239e75a754fc5f2844c7632c5ac
Author: Raffael Stocker 
Commit: Raffael Stocker 

add Makefile and remove now unused bluetooth-test* files
---
 Makefile  | 40 
 bluetooth-test|  3 ---
 bluetooth-test.el |  3 ---
 3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
new file mode 100644
index 000..62b1c37
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+# Updating dependencies:
+# ELPA master branch (for hydra):
+#   git clone git://git.savannah.gnu.org/emacs/elpa.git
+# ELPA externals setup:
+#   make depsetup
+# ELPA externals update
+#   make depupdate
+
+.POSIX:
+EMACS = emacs
+EL = bluetooth.el
+ELPA_EXT = dash
+LDFLAGS = -L ./dep/dash -L ../elpa/packages/hydra
+
+.PHONY: compile clean depclean depsetup depupdate run
+
+compile: $(EL:.el=.elc)
+
+clean:
+   rm -f bluetooth.elc
+
+depclean:
+   rm -rf ./dep/*
+
+depsetup:
+   mkdir -p ./dep
+   $(foreach dep,$(ELPA_EXT),git clone \
+   git://git.savannah.gnu.org/emacs/elpa.git   \
+   --single-branch --branch externals/$(dep) ./dep/$(dep);)
+
+depupdate:
+   $(foreach dep,$(ELPA_EXT),cd ./dep/$(dep) && git pull && cd ..)
+
+.SUFFIXES: .el .elc
+.el.elc:
+   $(EMACS) -Q --batch -L . $(LDFLAGS) -f batch-byte-compile $<
+
+run: $(EL:.el=.elc)
+   $(EMACS) -Q -L . $(LDFLAGS) --eval "(load \"bluetooth\")"   \
+   --eval "(bluetooth-list-devices)" &
diff --git a/bluetooth-test b/bluetooth-test
deleted file mode 100755
index b113d6a..000
--- a/bluetooth-test
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-/usr/bin/emacs -Q -l bluetooth-test.el &
diff --git a/bluetooth-test.el b/bluetooth-test.el
deleted file mode 100644
index 182c34a..000
--- a/bluetooth-test.el
+++ /dev/null
@@ -1,3 +0,0 @@
-(package-initialize)
-(byte-compile-file "bluetooth.el" t)
-(bluetooth-list-devices)



[elpa] externals/bluetooth 8e8b6d0 19/33: bump up the copyright year

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 8e8b6d0dacbaa50303f4d36e8cf58431b73ee553
Author: Raffael Stocker 
Commit: Raffael Stocker 

bump up the copyright year
---
 bluetooth.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bluetooth.el b/bluetooth.el
index d7a34ca..ab16c29 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -1,6 +1,6 @@
 ;;; bluetooth.el --- A Major mode for Bluetooth devices -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2019 Free Software Foundation, Inc.
+;; Copyright (C) 2019, 2020 Free Software Foundation, Inc.
 
 ;; Author: Raffael Stocker 
 ;; Etienne Prud’homme 



[elpa] externals/bluetooth 2f8f31c 08/33: adds an unload function

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 2f8f31c1db714963b261c810e1fc2ac640e2f21a
Author: Raffael Stocker 
Commit: Raffael Stocker 

adds an unload function
---
 bluetooth.el | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/bluetooth.el b/bluetooth.el
index c0914b2..9661765 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -351,6 +351,12 @@ This function only uses the first adapter reported by 
Bluez."
 (mapc #'dbus-unregister-object bluetooth--method-objects)
 (dbus-unregister-object bluetooth--adapter-signal)))
 
+(defun bluetooth-unload-function ()
+  "Clean up when the bluetooth feature is unloaded."
+  (when (buffer-live-p (get-buffer bluetooth-buffer-name))
+(kill-buffer bluetooth-buffer-name))
+  nil)
+
 (defun bluetooth-remove-device ()
   "Remove Bluetooth device at point (unpaires device and host)."
   (interactive)



[elpa] externals/bluetooth 943ddf3 21/33: Clean up the UUID and class descriptions

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 943ddf323fe53a110ad56d0621c84bf5a48d5c7c
Author: Raffael Stocker 
Commit: Raffael Stocker 

Clean up the UUID and class descriptions
---
 bluetooth.el | 62 ++--
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index f8e485d..da033ff 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -658,9 +658,9 @@ scanning the bus, displaying device info etc."
(shift . 0)
(fn . bluetooth--class-parse-bitfield)
(next . bluetooth--class-major-dev-classes)
-   (data . ((13 . "Limited Discoverable Mode")
-(14 . "(reserved)")
-(15 . "(reserved)")
+   (data . ((13 . "Limited discoverable mode")
+(14 . "(Reserved)")
+(15 . "(Reserved)")
 (16 . "Positioning")
 (17 . "Networking")
 (18 . "Rendering")
@@ -680,7 +680,7 @@ scanning the bus, displaying device info etc."
(data . ((#x0 . ("Miscellaneous" . nil))
 (#x1 . ("Computer" . 
bluetooth--class-computer-minor-classes))
 (#x2 . ("Phone" . 
bluetooth--class-phone-minor-classes))
-(#x3 . ("LAN /Network Access point" .
+(#x3 . ("LAN/Network Access point" .
 
bluetooth--class-network-minor-classes))
 (#x4 . ("Audio/Video" . 
bluetooth--class-av-minor-classes))
 (#x5 . ("Peripheral" . 
bluetooth--class-peripheral-minor-classes))
@@ -744,24 +744,24 @@ scanning the bus, displaying device info etc."
(fn . bluetooth--class-parse-value)
(next . nil)
(data . ((#x0 . "Uncategorized")
-(#x1 . "Wearable Headset Device")
-(#x2 . "Hands-free Device")
+(#x1 . "Wearable headset device")
+(#x2 . "Hands-free device")
 (#x3 . "(Reserved)")
 (#x4 . "Microphone")
 (#x5 . "Loudspeaker")
 (#x6 . "Headphones")
-(#x7 . "Portable Audio")
+(#x7 . "Portable audio")
 (#x8 . "Car audio")
 (#x9 . "Set-top box")
-(#xa . "HiFi Audio Device")
+(#xa . "HiFi audio device")
 (#xb . "VCR")
-(#xc . "Video Camera")
+(#xc . "Video camera")
 (#xd . "Camcorder")
-(#xe . "Video Monitor")
-(#xf . "Video Display and Loudspeaker")
-(#x10 . "Video Conferencing")
+(#xe . "Video monitor")
+(#xf . "Video display and loudspeaker")
+(#x10 . "Video conferencing")
 (#x11 . "(Reserved)")
-(#x12 . "Gaming/Toy"
+(#x12 . "Gaming/toy"
   "Bluetooth audio/video minor classes.")
 
 (defconst bluetooth--class-peripheral-minor-classes
@@ -770,7 +770,7 @@ scanning the bus, displaying device info etc."
(shift . -2)
(fn . bluetooth--class-parse-peripheral)
(next . nil)
-   (data . ((#x30 . ((#x00 . "Not Keyboard / Not Pointing Device")
+   (data . ((#x30 . ((#x00 . "Not keyboard/not pointing device")
  (#x10 . "Keyboard")
  (#x20 . "Pointing device")
  (#x30 . "Combo keyboard/pointing 
device")))
@@ -780,8 +780,8 @@ scanning the bus, displaying device info etc."
 (#x3 . "Remote control")
 (#x4 . "Sensing device")
 (#x5 . "Digitizer tablet")
-(#x6 . "Card Reader")
-(#x7 . "Digital Pen")
+(#x6 . "Card reader")
+(#x7 . "Digital pen")
 (#x8 . "Handheld scanner")
 (#x9 . "Handheld gestural input 
device"))
   "Bluetooth peripheral minor classes.")
@@ -819,7 +819,7 @@ scanning the bus, displaying device info etc."
(next . nil)
(data . ((#x1 . "Robot")
 (#x2 . "Vehicle")
-(#x3 . "Doll / Action figure")
+(#x3 . "Doll/action figure")
 (#x4 . "Controller")
 (#x5 . "Game"
   "Bluetooth toy minor classes.")
@@ -831,21 +831,21 @@ sc

[elpa] externals/bluetooth 98afd71 22/33: add property and uuid functions, update info display

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 98afd7130e11fd9bfe35b03d11b3d2bd3900089b
Author: Raffael Stocker 
Commit: Raffael Stocker 

add property and uuid functions, update info display

New functions:
bluetooth--device-properties
bluetooth--device-uuids
---
 bluetooth.el | 47 +--
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index da033ff..68d415e 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -486,6 +486,27 @@ adapter reported by Bluez."
(alist-get 
:adapter

   bluetooth--interfaces)
 
+(defun bluetooth--device-properties (dev-id)
+  "Return all properties of device DEV-ID."
+  (bluetooth--call-method
+   (car (last (split-string dev-id "/"))) :device
+   #'dbus-get-all-properties))
+
+(defun bluetooth--device-uuids (properties)
+  "Return a UUID alist of device DEV-ID.
+Each list element contains a UUID as the key and the
+corresponding description string as the value.  If no description
+string is available (e.g. for unknown UUIDs,) the UUID itself is
+the value."
+  (let ((uuids (cdr (assoc "UUIDs" properties)))
+   (uuid-alist))
+   (when uuids
+ (dolist (id uuids)
+   (let ((desc (or (bluetooth--parse-service-class-uuid id)
+   (list id
+ (push (list id desc) uuid-alist
+   (nreverse uuid-alist)))
+
 
  mode entry command
 
@@ -3623,9 +3644,7 @@ scanning the bus, displaying device info etc."
(bluetooth--with-alias dev-id
  (with-current-buffer-window
   "*Bluetooth device info*" nil nil
-  (let ((props (bluetooth--call-method
-(car (last (split-string 
dev-id "/"))) :device
-#'dbus-get-all-properties)))
+  (let ((props (bluetooth--device-properties dev-id)))
 (ins-heading "Bluetooth device info\n\n")
 (ins-attr "Alias" alias)
 (when-let (address (cdr (assoc "Address" props)))
@@ -3655,18 +3674,18 @@ scanning the bus, displaying device info etc."
   (dolist (elt (cadr x))
 (insert (format "%15s %s\n" "" 
elt)))
 (insert (format "%15s %s\n" "" (cadr 
x)))
-(when-let (uuids (cdr (assoc "UUIDs" props)))
+(when (cdr (assoc "UUIDs" props))
   (ins-heading "\nSerives (UUIDs)\n")
-  (dolist (id uuids)
-(let ((desc (or 
(bluetooth--parse-service-class-uuid id)
-(list id
-  (when (car desc)
-(insert (format "%30s  " (car desc
-  (when (cadr desc)
-(insert (format "%s " (cadr desc
-  (when (caddr desc)
-(insert (format "(%s)" (caddr desc
-  (insert "\n")
+  (mapc (lambda (id-pair)
+  (let ((desc (cadr id-pair)))
+(when (car desc)
+  (insert (format "%36s  " 
(car desc
+(when (cadr desc)
+  (insert (format "%s " (cadr 
desc
+(when (caddr desc)
+  (insert (format "(%s)" 
(caddr desc
+(insert "\n")))
+(bluetooth--device-uuids props
   (special-mode)))
 
 (provide 'bluetooth)



[elpa] externals/bluetooth 24d3c4a 03/33: fixes column widths in list format so sorting arrows are visible

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 24d3c4a330df3410aa614f96e481d82df0bc8cc4
Author: Raffael Stocker 
Commit: Raffael Stocker 

fixes column widths in list format so sorting arrows are visible
---
 bluetooth.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 783a8d8..173076e 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -223,8 +223,8 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
 ;; NOTE: the strings MUST correspond to Bluez device properties
 ;; as they are used to gather the information from Bluez.
 (defconst bluetooth--list-format
-  [("Alias" 30 t) ("Paired" 6 t) ("Connected" 9 t) ("Address" 17 t)
-   ("Blocked" 7 t) ("Trusted" 7 t)] "The list view format for bluetooth mode.")
+  [("Alias" 24 t) ("Paired" 8 t) ("Connected" 11 t) ("Address" 17 t)
+   ("Blocked" 9 t) ("Trusted" 9 t)] "The list view format for bluetooth mode.")
 
 ;; This function provides the list entries for the tabulated-list
 ;; view.  It is called from `tabulated-list-print'.



[elpa] externals/bluetooth 8f3dcaa 11/33: move some of the comments into docstrings

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 8f3dcaab73dee361b1f64c2424c062b78415bb24
Author: Raffael Stocker 
Commit: Raffael Stocker 

move some of the comments into docstrings
---
 bluetooth.el | 40 +++-
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 33e5ed4..9816371 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -78,17 +78,22 @@ This is usually `:system' if bluetoothd runs as a system 
service, or
 
 (put 'bluetooth--mode-info 'risky-local-variable t)
 
-;; The state information list defines the kind of adapter state displayed
-;; in the mode-line.  The first element of a sublist is an adapter property,
-;; the second is a list containing first the current status of the item 
(t/nil),
-;; second the displayed string if the property is non-nil and
-;; third the displayed string if the property is nil.  If a
-;; display element is nil, nothing will be displayed for this property.
+
 (defvar bluetooth--mode-state '(("Powered" . (nil nil "off"))
("Discoverable" . (nil "discoverable" nil))
("Pairable" . (nil "pairable" nil))
("Discovering" . (nil "scan" nil)))
-  "Mode line adapter state information.")
+  "Mode line adapter state information.
+
+The state information list defines the kind of adapter state
+displayed in the mode-line.  The first element of each sub-list
+is an adapter property, the second is a list containing the
+ - current status of the item (t or nil),
+ - string displayed if the property is non-nil,
+ - string displayed if the property is nil.
+
+If a display element is nil, nothing will be displayed for this
+property and state.")
 
 ;; Bluez service name as defined by the Bluez API
 (defconst bluetooth--service "org.bluez" "D-Bus service name of Bluez.")
@@ -219,12 +224,13 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
  ((null value) "no")
  (t "yes"
 
-;; List format for the main display buffer.
-;; NOTE: the strings MUST correspond to Bluez device properties
-;; as they are used to gather the information from Bluez.
 (defconst bluetooth--list-format
   [("Alias" 24 t) ("Paired" 8 t) ("Connected" 11 t) ("Address" 17 t)
-   ("Blocked" 9 t) ("Trusted" 9 t)] "The list view format for bluetooth mode.")
+   ("Blocked" 9 t) ("Trusted" 9 t)]
+  "The list view format for bluetooth mode.
+
+NOTE: the strings MUST correspond to Bluez device properties
+as they are used to gather the information from Bluez.")
 
 ;; This function provides the list entries for the tabulated-list
 ;; view.  It is called from `tabulated-list-print'.
@@ -400,11 +406,10 @@ This function only uses the first adapter reported by 
Bluez."
 (unless (string-blank-p info)
   (concat " [" info "]"
 
-;; This D-Bus signal handler listens to property changes of the
-;; adapter and updates the status display accordingly.
 (defun bluetooth--handle-prop-change (interface data &rest _)
   "Handle property change signals on D-Bus INTERFACE as given by DATA.
-Only adapter properties are considered."
+Only adapter properties are considered.  If an adapter property changes,
+update the status display accordingly."
   (when (string= interface (alist-get :adapter bluetooth--interfaces))
 (dolist (elt data)
   (let ((prop (car elt))
@@ -412,10 +417,11 @@ Only adapter properties are considered."
(when-let (state (cdr (assoc prop bluetooth--mode-state)))
  (setcar state value))
 
-;; This function registers a signal handler for the _first_ adapter
-;; reported by Bluez.
 (defun bluetooth--register-signal-handler ()
-  "Register signal handler for adapter property changes."
+  "Register a signal handler for adapter property changes.
+
+This function registers a signal handler only for the first
+adapter reported by Bluez."
   (let ((adapters (dbus-introspect-get-node-names bluetooth-bluez-bus
  bluetooth--service
  bluetooth--root)))



[elpa] externals/bluetooth b5fc5c2 28/33: correct docstring in bluetooth-disconnect

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit b5fc5c27f7c15e3685ae71b963e08abca1f3be6b
Author: Raffael Stocker 
Commit: Raffael Stocker 

correct docstring in bluetooth-disconnect
---
 bluetooth.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bluetooth.el b/bluetooth.el
index eff3247..d0e7dcd 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -180,7 +180,7 @@ non-interactively with UUID set to nil, connect to all 
profiles."
   "Disconnect the Bluetooth device at point.
 When called with a prefix argument, ask for a profile and
 disconnect only this profile.  Otherwise, or when called
-non-interactively with UUID set to nil, disconnect to all
+non-interactively with UUID set to nil, disconnect all
 profiles."
   (interactive (bluetooth--choose-uuid))
   (if uuid



[elpa] externals/bluetooth 6599093 31/33: update list of member UUIDs (bluetooth--member-uuid-alist).

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 6599093ff10e77b4c62f5e7b73e259e28373c02b
Author: Raffael Stocker 
Commit: Raffael Stocker 

update list of member UUIDs (bluetooth--member-uuid-alist).
---
 bluetooth.el | 74 ++--
 1 file changed, 72 insertions(+), 2 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index e84c9b2..de68b6b 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -1127,6 +1127,7 @@ scanning the bus, displaying device info etc."
 
 
  Bluetooth member UUIDs
+;; Last updated: 19. Sep 2020
 
 (defconst bluetooth--member-uuid-alist
   #s(hash-table
@@ -1508,8 +1509,77 @@ scanning the bus, displaying device info etc."
  #xFD8A ("Signify Netherlands B.V.")
  #xFD89 ("Urbanminded LTD")
  #xFD88 ("Urbanminded LTD")
- #xFD87 ("Google LLC")))
-  "Bluetooth manufacturer UUIDs.")
+ #xFD87 ("Google LLC")
+ #xFD86 ("Abbott")
+ #xFD85 ("Husqvarna AB")
+ #xFD84 ("Tile, Inc.")
+ #xFD83 ("iNFORM Technology GmbH")
+ #xFD82 ("Sony Corporation")
+ #xFD81 ("CANDY HOUSE, Inc.")
+ #xFD80 ("Phindex Technologies, Inc")
+ #xFD7F ("Husqvarna AB")
+ #xFD7E ("Samsung Electronics Co., Ltd.")
+ #xFD7D ("Center for Advanced Research Wernher Von Braun")
+ #xFD7C ("Toshiba Information Systems (Japan) Corporation")
+ #xFD7B ("WYZE LABS, INC.")
+ #xFD7A ("Withings")
+ #xFD79 ("Withings")
+ #xFD78 ("Withings")
+ #xFD77 ("Withings")
+ #xFD76 ("Insulet Corporation")
+ #xFD75 ("Insulet Corporation")
+ #xFD74 ("BRControls Products BV")
+ #xFD73 ("BRControls Products BV")
+ #xFD72 ("Logitech International SA")
+ #xFD71 ("GN Hearing A/S")
+ #xFD70 ("GuangDong Oppo Mobile Telecommunications Corp., Ltd.")
+ #xFD6F ("Apple, Inc.")
+ #xFD6E ("Polidea sp. z o.o.")
+ #xFD6D ("Sigma Elektro GmbH")
+ #xFD6C ("Samsung Electronics Co., Ltd.")
+ #xFD6B ("rapitag GmbH")
+ #xFD6A ("Emerson")
+ #xFD69 ("Samsung Electronics Co., Ltd.")
+ #xFD68 ("Ubique Innovation AG")
+ #xFD67 ("Montblanc Simplo GmbH")
+ #xFD66 ("Zebra Technologies Corporation")
+ #xFD65 ("Razer Inc.")
+ #xFD64 ("INRIA")
+ #xFD63 ("Fitbit, Inc.")
+ #xFD62 ("Fitbit, Inc.")
+ #xFD61 ("Arendi AG")
+ #xFD60 ("Sercomm Corporation")
+ #xFD5F ("Oculus VR, LLC")
+ #xFD5E ("Tapkey GmbH")
+ #xFD5D ("maxon motor ltd.")
+ #xFD5C ("React Mobile")
+ #xFD5B ("V2SOFT INC.")
+ #xFD5A ("Samsung Electronics Co., Ltd.")
+ #xFD59 ("Samsung Electronics Co., Ltd.")
+ #xFD58 ("Volvo Car Corporation")
+ #xFD57 ("Volvo Car Corporation")
+ #xFD56 ("Resmed Ltd")
+ #xFD55 ("Braveheart Wireless, Inc.")
+ #xFD54 ("Qingdao Haier Technology Co., Ltd.")
+ #xFD53 ("PCI Private Limited")
+ #xFD52 ("UTC Fire and Security")
+ #xFD51 ("UTC Fire and Security")
+ #xFD50 ("Hangzhou Tuya Information Technology Co., Ltd")
+ #xFD4F ("Forkbeard Technologies AS")
+ #xFD4E ("70mai Co., Ltd.")
+ #xFD4D ("70mai Co., Ltd.")
+ #xFD4C ("Adolf Wuerth GmbH & Co KG")
+ #xFD4B ("Samsung Electronics Co., Ltd.")
+ #xFD4A ("Sigma Elektro GmbH")
+ #xFD49 ("Panasonic Corporation")
+ #xFD48 ("Geberit International AG")
+ #xFD47 ("Liberty Global Inc.")
+ #xFD46 ("Lemco IKE")
+ #xFD45 ("GB Solution co., Ltd")
+ #xFD44 ("Apple Inc.")
+ #xFD43 ("Apple Inc.")
+ #xFD42 ("Globe (Jiangsu) Co., Ltd")))
+  "Bluetooth member UUIDs.")
 
 
  service and class parsing code



[elpa] externals/bluetooth 28d16f6 33/33: set version number to 0.2

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 28d16f61e91660033106d6e96ead60741fbdb084
Author: Raffael Stocker 
Commit: Raffael Stocker 

set version number to 0.2
---
 bluetooth.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bluetooth.el b/bluetooth.el
index af7ddfe..1ddc2fb 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -7,7 +7,7 @@
 ;;
 ;; Maintainer: Raffael Stocker 
 ;; Created: 13 Aug 2019
-;; Version: 0.1.2
+;; Version: 0.2
 ;; Package-Requires: ((emacs "25.1") (dash "2.12.0"))
 ;; Keywords: hardware
 ;; URL: https://gitlab.com/rstocker/emacs-bluetooth



[elpa] externals/bluetooth 1649156 06/33: removes incorrect mode-info clean-up

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 1649156a7c568b6a2e9c9c24c7aac2e6533bf2a2
Author: Raffael Stocker 
Commit: Raffael Stocker 

removes incorrect mode-info clean-up
---
 bluetooth.el | 2 --
 1 file changed, 2 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index e12ceb1..c0914b2 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -341,8 +341,6 @@ This function only uses the first adapter reported by 
Bluez."
 
 (defun bluetooth--cleanup ()
   "Clean up when mode buffer is killed."
-  (setq mode-line-misc-info
-   (cl-remove bluetooth--mode-info mode-line-misc-info))
   ;; This function is registered as a kill-buffer-hook, so we don't
   ;; want any errors to get in the way of killing the buffer
   (ignore-errors



[elpa] externals/bluetooth f107d6f 13/33: Add menu entries to bluetooth-mode-map

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit f107d6f710d2e68ebdf707e4f13f3adc53dd4416
Author: Etienne Prud’homme 
Commit: Etienne Prud’homme 

Add menu entries to bluetooth-mode-map
---
 bluetooth.el | 32 
 1 file changed, 32 insertions(+)

diff --git a/bluetooth.el b/bluetooth.el
index 33e5ed4..c8a099b 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -193,6 +193,38 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
 (define-key map [?k] #'bluetooth-remove-device)
 (define-key map [?<] #'bluetooth-beginning-of-list)
 (define-key map [?>] #'bluetooth-end-of-list)
+
+   (define-key map [menu-bar bluetooth]
+ (cons "Bluetooth" (make-sparse-keymap "Bluetooth")))
+   (define-key map [menu-bar bluetooth device]
+ (cons "Device" (make-sparse-keymap "Device")))
+
+   (define-key map [menu-bar bluetooth toggle-discoverable]
+ '(menu-item "Toggle discoverable" bluetooth-toggle-discoverable
+ :help "Toggle discoverable mode"))
+   (define-key map [menu-bar bluetooth toggle-pairable]
+ '(menu-item "Toggle pairable" bluetooth-toggle-pairable
+ :help "Toggle pairable mode"))
+   (define-key map [menu-bar bluetooth toggle-powered]
+ '(menu-item "Toggle powered" bluetooth-toggle-powered
+ :help "Toggle power supply of adapter"))
+
+   (define-key map [menu-bar bluetooth device toggle-trusted]
+ '(menu-item "Toggle trusted" bluetooth-toggle-trusted
+ :help "Trust/untrust bluetooth device"))
+   (define-key map [menu-bar bluetooth device toggle-blocked]
+ '(menu-item "Toggle blocked" bluetooth-toggle-blocked
+ :help "Block/unblock bluetooth device"))
+   (define-key map [menu-bar bluetooth device disconnect]
+ '(menu-item "Disconnect" bluetooth-disconnect
+ :help "Disconnect bluetooth device"))
+   (define-key map [menu-bar bluetooth device connect]
+ '(menu-item "Connect" bluetooth-connect
+ :help "Connect bluetooth device"))
+   (define-key map [menu-bar bluetooth device pair]
+ '(menu-item "Pair" bluetooth-pair
+ :help "Pair bluetooth device"))
+
 map)
   "The Bluetooth mode keymap.")
 



[elpa] externals/bluetooth 7bb793f 26/33: remove unneeded hydra reference from Makefile

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 7bb793fbc97bc6b2061831a3f980ea4d9e12b211
Author: Raffael Stocker 
Commit: Raffael Stocker 

remove unneeded hydra reference from Makefile
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 62b1c37..1fff9b5 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@
 EMACS = emacs
 EL = bluetooth.el
 ELPA_EXT = dash
-LDFLAGS = -L ./dep/dash -L ../elpa/packages/hydra
+LDFLAGS = -L ./dep/dash
 
 .PHONY: compile clean depclean depsetup depupdate run
 



[elpa] externals/bluetooth 950cc77 27/33: add more menu entries

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 950cc7740757d8b0b2f9cca46cf7f6353d0df521
Author: Raffael Stocker 
Commit: Raffael Stocker 

add more menu entries
---
 bluetooth.el | 36 ++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index d5e93e8..eff3247 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -12,8 +12,6 @@
 ;; Keywords: hardware
 ;; URL: https://gitlab.com/rstocker/emacs-bluetooth
 
-;; This file is part of GNU Emacs
-
 ;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or (at
@@ -189,6 +187,19 @@ profiles."
  (bluetooth--dbus-method "DisconnectProfile" :device (car uuid))
(bluetooth--dbus-method "Disconnect" :device)))
 
+(defun bluetooth-connect-profile ()
+  "Ask for a Bluetooth profile and connect the device at point to it."
+  (interactive)
+  (let ((prefix-arg (list 4)))
+   (command-execute #'bluetooth-connect)))
+
+(defun bluetooth-disconnect-profile ()
+  "Ask for a Bluetooth profile and disconnect the device at point from it."
+  (interactive)
+  (let ((prefix-arg (list 4)))
+   (command-execute #'bluetooth-disconnect)))
+
+
 (defmacro bluetooth-defun-method (method api docstring)
   (declare (doc-string 3) (indent 2))
   (let ((name (bluetooth--function-name method)))
@@ -270,6 +281,12 @@ profiles."
(define-key map [menu-bar bluetooth device]
  (cons "Device" (make-sparse-keymap "Device")))
 
+   (define-key map [menu-bar bluetooth stop-discovery]
+ '(menu-item "Stop discovery" bluetooth-stop-discovery
+ :help "Stop discovery"))
+   (define-key map [menu-bar bluetooth start-discovery]
+ '(menu-item "Start discovery" bluetooth-start-discovery
+ :help "Start discovery"))
(define-key map [menu-bar bluetooth toggle-discoverable]
  '(menu-item "Toggle discoverable" bluetooth-toggle-discoverable
  :help "Toggle discoverable mode"))
@@ -280,18 +297,33 @@ profiles."
  '(menu-item "Toggle powered" bluetooth-toggle-powered
  :help "Toggle power supply of adapter"))
 
+   (define-key map [menu-bar bluetooth device show-info]
+ '(menu-item "Show device info" bluetooth-show-device-info
+ :help "Show bluetooth device info"))
+   (define-key map [menu-bar bluetooth device set-alias]
+ '(menu-item "Set device alias" bluetooth-set-alias
+ :help "Set device alias"))
(define-key map [menu-bar bluetooth device toggle-trusted]
  '(menu-item "Toggle trusted" bluetooth-toggle-trusted
  :help "Trust/untrust bluetooth device"))
(define-key map [menu-bar bluetooth device toggle-blocked]
  '(menu-item "Toggle blocked" bluetooth-toggle-blocked
  :help "Block/unblock bluetooth device"))
+   (define-key map [menu-bar bluetooth device disconnect-profile]
+ '(menu-item "Disconnect profile" bluetooth-disconnect-profile
+ :help "Disconnect bluetooth device profile"))
(define-key map [menu-bar bluetooth device disconnect]
  '(menu-item "Disconnect" bluetooth-disconnect
  :help "Disconnect bluetooth device"))
+   (define-key map [menu-bar bluetooth device connect-profile]
+ '(menu-item "Connect profile" bluetooth-connect-profile
+ :help "Connect bluetooth device profile"))
(define-key map [menu-bar bluetooth device connect]
  '(menu-item "Connect" bluetooth-connect
  :help "Connect bluetooth device"))
+   (define-key map [menu-bar bluetooth device remove]
+ '(menu-item "Remove" bluetooth-remove-device
+ :help "Remove bluetooth device"))
(define-key map [menu-bar bluetooth device pair]
  '(menu-item "Pair" bluetooth-pair
  :help "Pair bluetooth device"))



[elpa] externals/bluetooth e95f30b 20/33: avoid using undocumented value of ‘push’

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit e95f30bce08ed8b611eb4a3e167bce595f10e70a
Author: Raffael Stocker 
Commit: Raffael Stocker 

avoid using undocumented value of ‘push’

* bluetooth.el (bluetooth--parse-class): use ‘cons’ instead of ‘push’ for

 value accumulation
---
 bluetooth.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bluetooth.el b/bluetooth.el
index ab16c29..f8e485d 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -1449,7 +1449,7 @@ scanning the bus, displaying device info etc."
   (let* ((m-field (lsh (logand class 
.mask) .shift))
  (res (cons .name

 (list (funcall .fn m-field .data
- (n-acc (push res 
acc)))
+ (n-acc (cons res 
acc)))
 (cond ((functionp .next)
(let ((spec 
(funcall .next m-field .data)))
  (if spec



[elpa] externals/bluetooth 0ca89cf 24/33: clean up the connect and disconnect functions

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 0ca89cfaccf97d94e080724001b8fb995a861c54
Author: Raffael Stocker 
Commit: Raffael Stocker 

clean up the connect and disconnect functions

allows connecting to different UUIDs of the same profile
new function: bluetooth--choose-uuid
---
 bluetooth.el | 39 +--
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 75dc404..d5e93e8 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -149,20 +149,31 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."

(lambda (x) (concat "-" (downcase x)))

name t)
 
+(defun bluetooth--choose-uuid ()
+  "Ask for a UUID and return it in a form suitable for ‘interactive’."
+  (if current-prefix-arg
+ (let* ((dev-id (tabulated-list-get-id))
+(uuids (bluetooth--device-uuids
+(bluetooth--device-properties dev-id)))
+(profile (completing-read "Profile: "
+  
(mapcar (lambda (x)
+   
 (concat (caadr x)
+   
 ", "
+   
 (cadadr x)))
+   
   uuids)
+  nil 
t)))
+   (list (cl-rassoc profile uuids
+:key (lambda (x)
+   (concat (caar 
x) ", " (cadar x)))
+:test #'string=)))
+   '(nil)))
+
 (defun bluetooth-connect (uuid)
   "Connect to the Bluetooth device at point.
 When called with a prefix argument, ask for a profile and
 connect only this profile.  Otherwise, or when called
 non-interactively with UUID set to nil, connect to all profiles."
-  (interactive
-   (if current-prefix-arg
-  (let* ((dev-id (tabulated-list-get-id))
- (uuids (bluetooth--device-uuids
- (bluetooth--device-properties 
dev-id)))
- (profile (completing-read "Profile: "
-   
(mapcar #'cadadr uuids) nil t)))
-(list (cl-rassoc profile uuids :key #'cadar :test #'string=)))
-'(nil)))
+  (interactive (bluetooth--choose-uuid))
   (if uuid
  (bluetooth--dbus-method "ConnectProfile" :device (car uuid))
(bluetooth--dbus-method "Connect" :device)))
@@ -173,15 +184,7 @@ When called with a prefix argument, ask for a profile and
 disconnect only this profile.  Otherwise, or when called
 non-interactively with UUID set to nil, disconnect to all
 profiles."
-  (interactive
-   (if current-prefix-arg
-  (let* ((dev-id (tabulated-list-get-id))
- (uuids (bluetooth--device-uuids
- (bluetooth--device-properties 
dev-id)))
- (profile (completing-read "Profile: "
-   
(mapcar #'cadadr uuids) nil t)))
-(list (cl-rassoc profile uuids :key #'cadar :test #'string=)))
-'(nil)))
+  (interactive (bluetooth--choose-uuid))
   (if uuid
  (bluetooth--dbus-method "DisconnectProfile" :device (car uuid))
(bluetooth--dbus-method "Disconnect" :device)))



[elpa] externals/bluetooth fba1988 07/33: adds a simple compile/test setup script

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit fba19882654361d9dfb23b5a2ce88b2a202e56e7
Author: Raffael Stocker 
Commit: Raffael Stocker 

adds a simple compile/test setup script
---
 bluetooth-test| 3 +++
 bluetooth-test.el | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/bluetooth-test b/bluetooth-test
new file mode 100755
index 000..b113d6a
--- /dev/null
+++ b/bluetooth-test
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/usr/bin/emacs -Q -l bluetooth-test.el &
diff --git a/bluetooth-test.el b/bluetooth-test.el
new file mode 100644
index 000..182c34a
--- /dev/null
+++ b/bluetooth-test.el
@@ -0,0 +1,3 @@
+(package-initialize)
+(byte-compile-file "bluetooth.el" t)
+(bluetooth-list-devices)



[elpa] externals/bluetooth dc4b63b 30/33: correct docstrings

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit dc4b63b862a07b38fa4e7de49fb946aa7eebd7fa
Author: Raffael Stocker 
Commit: Raffael Stocker 

correct docstrings

* bluetooth.el (bluetooth-set-alias): add reference to NAME parameter
   (bluetooth--device-uuids): correct reference to 
parameter
---
 bluetooth.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index a783ce4..e84c9b2 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -233,7 +233,7 @@ profiles."
   "Toggle pairable mode.")
 
 (defun bluetooth-set-alias (name)
-  "Set alias of Bluetooth device at point."
+  "Set alias of Bluetooth device at point to NAME."
   (interactive "MAlias (empty to reset): ")
   (bluetooth--dbus-set "Alias" name :device))
 
@@ -561,11 +561,12 @@ adapter reported by Bluez."
#'dbus-get-all-properties))
 
 (defun bluetooth--device-uuids (properties)
-  "Return a UUID alist of device DEV-ID.
+  "Extract a UUID alist from device PROPERTIES.
 Each list element contains a UUID as the key and the
 corresponding description string as the value.  If no description
 string is available (e.g. for unknown UUIDs,) the UUID itself is
-the value."
+the value.  The device properties can be obtained in the suitable
+form by a call to ‘bluetooth--device-properties’."
   (let ((uuids (cdr (assoc "UUIDs" properties)))
(uuid-alist))
(when uuids



[elpa] externals/bluetooth 53323b9 09/33: matches case sensitively in bluetooth--function-name

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 53323b9d5fb35f75c424b183e7fe8aa9f33967a1
Author: Raffael Stocker 
Commit: Raffael Stocker 

matches case sensitively in bluetooth--function-name
---
 bluetooth.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 9661765..33e5ed4 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -127,11 +127,12 @@ This is usually `:system' if bluetoothd runs as a system 
service, or
   (defun bluetooth--function-name (name &optional prefix)
 "Make a function name out of NAME and PREFIX.
 The generated function name has the form `bluetoothPREFIX-NAME'."
-(concat "bluetooth"
-   prefix
-   (replace-regexp-in-string "[[:upper:]][[:lower:]]+"
- (lambda (x) (concat "-" (downcase x)))
- name t
+(let ((case-fold-search nil))
+  (concat "bluetooth"
+ prefix
+ (replace-regexp-in-string "[[:upper:]][[:lower:]]+"
+   (lambda (x) (concat "-" (downcase x)))
+   name t)
 
 (defmacro bluetooth-defun-method (method api docstring)
   (declare (doc-string 3) (indent 2))
@@ -555,7 +556,6 @@ scanning the bus, displaying device info etc."
   "RequestAuthorization" "AuthorizeService" "Cancel")))
 (setq bluetooth--method-objects
  (cl-loop for method in methods
-  with case-fold-search = nil
   for fname = (bluetooth--function-name method "-")
   collect (dbus-register-method bluetooth-bluez-bus
 dbus-service-emacs



[elpa] externals/bluetooth b12caf1 16/33: update author list

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit b12caf19748ca25279d59619e6c89e31d6adccba
Author: Raffael Stocker 
Commit: Raffael Stocker 

update author list
---
 bluetooth.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bluetooth.el b/bluetooth.el
index b644c6e..400ca4d 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -3,6 +3,8 @@
 ;; Copyright (C) 2019 Free Software Foundation, Inc.
 
 ;; Author: Raffael Stocker 
+;; Etienne Prud’homme 
+;;
 ;; Maintainer: Raffael Stocker 
 ;; Created: 13 Aug 2019
 ;; Version: 0.1.2



[elpa] externals/bluetooth 94d9827 05/33: displays MAC address if alias is unknown (pairing agent)

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 94d9827b8853ba3f698766207ba8ff39082524c0
Author: Raffael Stocker 
Commit: Raffael Stocker 

displays MAC address if alias is unknown (pairing agent)
---
 bluetooth.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 262a412..e12ceb1 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -457,9 +457,10 @@ scanning the bus, displaying device info etc."
 (defmacro bluetooth--with-alias (device &rest body)
   "Evaluate BODY with DEVICE alias bound to ALIAS."
   (declare (indent defun))
-  `(let ((alias (bluetooth--call-method
-(car (last (split-string ,device "/"))) :device
-#'dbus-get-property "Alias")))
+  `(let* ((dev (car (last (split-string ,device "/"
+ (alias (or (bluetooth--call-method dev :device
+#'dbus-get-property "Alias")
+(replace-regexp-in-string "_" ":" dev nil nil nil 4
  ,@body))
 
 (defmacro bluetooth--maybe-cancel-reject (&rest body)



[elpa] externals/bluetooth eb4b158 15/33: Merge commit 'f107d6f'

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit eb4b15851df8b63b5c4ccfe37a7a4ee5653629bf
Merge: e15f6d0 f107d6f
Author: Raffael Stocker 
Commit: Raffael Stocker 

Merge commit 'f107d6f'
---
 bluetooth.el | 32 
 1 file changed, 32 insertions(+)

diff --git a/bluetooth.el b/bluetooth.el
index 9816371..b644c6e 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -198,6 +198,38 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
 (define-key map [?k] #'bluetooth-remove-device)
 (define-key map [?<] #'bluetooth-beginning-of-list)
 (define-key map [?>] #'bluetooth-end-of-list)
+
+   (define-key map [menu-bar bluetooth]
+ (cons "Bluetooth" (make-sparse-keymap "Bluetooth")))
+   (define-key map [menu-bar bluetooth device]
+ (cons "Device" (make-sparse-keymap "Device")))
+
+   (define-key map [menu-bar bluetooth toggle-discoverable]
+ '(menu-item "Toggle discoverable" bluetooth-toggle-discoverable
+ :help "Toggle discoverable mode"))
+   (define-key map [menu-bar bluetooth toggle-pairable]
+ '(menu-item "Toggle pairable" bluetooth-toggle-pairable
+ :help "Toggle pairable mode"))
+   (define-key map [menu-bar bluetooth toggle-powered]
+ '(menu-item "Toggle powered" bluetooth-toggle-powered
+ :help "Toggle power supply of adapter"))
+
+   (define-key map [menu-bar bluetooth device toggle-trusted]
+ '(menu-item "Toggle trusted" bluetooth-toggle-trusted
+ :help "Trust/untrust bluetooth device"))
+   (define-key map [menu-bar bluetooth device toggle-blocked]
+ '(menu-item "Toggle blocked" bluetooth-toggle-blocked
+ :help "Block/unblock bluetooth device"))
+   (define-key map [menu-bar bluetooth device disconnect]
+ '(menu-item "Disconnect" bluetooth-disconnect
+ :help "Disconnect bluetooth device"))
+   (define-key map [menu-bar bluetooth device connect]
+ '(menu-item "Connect" bluetooth-connect
+ :help "Connect bluetooth device"))
+   (define-key map [menu-bar bluetooth device pair]
+ '(menu-item "Pair" bluetooth-pair
+ :help "Pair bluetooth device"))
+
 map)
   "The Bluetooth mode keymap.")
 



[elpa] externals/bluetooth 2746c62 23/33: change connect and disconnect functions to handle single profiles

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 2746c62a5181e746b8bc8c9b9fc2556c09794704
Author: Raffael Stocker 
Commit: Raffael Stocker 

change connect and disconnect functions to handle single profiles
---
 bluetooth.el | 41 +
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 68d415e..75dc404 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -149,6 +149,43 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."

(lambda (x) (concat "-" (downcase x)))

name t)
 
+(defun bluetooth-connect (uuid)
+  "Connect to the Bluetooth device at point.
+When called with a prefix argument, ask for a profile and
+connect only this profile.  Otherwise, or when called
+non-interactively with UUID set to nil, connect to all profiles."
+  (interactive
+   (if current-prefix-arg
+  (let* ((dev-id (tabulated-list-get-id))
+ (uuids (bluetooth--device-uuids
+ (bluetooth--device-properties 
dev-id)))
+ (profile (completing-read "Profile: "
+   
(mapcar #'cadadr uuids) nil t)))
+(list (cl-rassoc profile uuids :key #'cadar :test #'string=)))
+'(nil)))
+  (if uuid
+ (bluetooth--dbus-method "ConnectProfile" :device (car uuid))
+   (bluetooth--dbus-method "Connect" :device)))
+
+(defun bluetooth-disconnect (uuid)
+  "Disconnect the Bluetooth device at point.
+When called with a prefix argument, ask for a profile and
+disconnect only this profile.  Otherwise, or when called
+non-interactively with UUID set to nil, disconnect to all
+profiles."
+  (interactive
+   (if current-prefix-arg
+  (let* ((dev-id (tabulated-list-get-id))
+ (uuids (bluetooth--device-uuids
+ (bluetooth--device-properties 
dev-id)))
+ (profile (completing-read "Profile: "
+   
(mapcar #'cadadr uuids) nil t)))
+(list (cl-rassoc profile uuids :key #'cadar :test #'string=)))
+'(nil)))
+  (if uuid
+ (bluetooth--dbus-method "DisconnectProfile" :device (car uuid))
+   (bluetooth--dbus-method "Disconnect" :device)))
+
 (defmacro bluetooth-defun-method (method api docstring)
   (declare (doc-string 3) (indent 2))
   (let ((name (bluetooth--function-name method)))
@@ -156,10 +193,6 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
(interactive)
(bluetooth--dbus-method ,method ,api
 
-(bluetooth-defun-method "Connect" :device
-  "Connect to the Bluetooth device at point.")
-(bluetooth-defun-method "Disconnect" :device
-  "Disconnect Bluetooth device at point.")
 (bluetooth-defun-method "StartDiscovery" :adapter
   "Start discovery mode.")
 (bluetooth-defun-method "StopDiscovery" :adapter



[elpa] externals/bluetooth e86e01f 12/33: add local variable for flycheck mode

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit e86e01f6acead2edb7a842ffb790f75d5f565097
Author: Raffael Stocker 
Commit: Raffael Stocker 

add local variable for flycheck mode
---
 bluetooth.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/bluetooth.el b/bluetooth.el
index 9816371..fa5428d 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -3605,4 +3605,8 @@ scanning the bus, displaying device info etc."
 
 (provide 'bluetooth)
 
+;; Local variables:
+;; eval: (flycheck-mode)
+;; End:
+
 ;;; bluetooth.el ends here



[elpa] externals/bluetooth 5d72618 17/33: add page breaks and section headings

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 5d726184263679dfcbcb146b3d7c5b63e8e80f34
Author: Raffael Stocker 
Commit: Raffael Stocker 

add page breaks and section headings
---
 bluetooth.el | 33 +
 1 file changed, 33 insertions(+)

diff --git a/bluetooth.el b/bluetooth.el
index 400ca4d..5297729 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -47,6 +47,9 @@
 (require 'rx)
 (eval-when-compile (require 'subr-x))
 
+
+ customization
+
 (defgroup bluetooth nil
   "Bluetooth device management."
   :group 'comm)
@@ -69,6 +72,9 @@ This is usually `:system' if bluetoothd runs as a system 
service, or
   '((t . (:slant italic)))
   "Face for device attribute names.")
 
+
+ internal constants and variables
+
 (defconst bluetooth-buffer-name "*Bluetooth*"
   "Name of the buffer in which to list bluetooth devices.")
 
@@ -130,6 +136,9 @@ property and state.")
 ;; This variable holds the device information as obtained from D-Bus.
 (defvar bluetooth--device-info nil "Device info obtained from Bluez.")
 
+
+ command definitions
+
 (eval-and-compile
   (defun bluetooth--function-name (name &optional prefix)
 "Make a function name out of NAME and PREFIX.
@@ -182,6 +191,9 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
   (interactive "MAlias (empty to reset): ")
   (bluetooth--dbus-set "Alias" name :device))
 
+
+ keymap and menu
+
 (defvar bluetooth-mode-map
   (let ((map (make-sparse-keymap)))
 (set-keymap-parent map tabulated-list-mode-map)
@@ -235,6 +247,9 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
 map)
   "The Bluetooth mode keymap.")
 
+
+ internal functions
+
 ;; This function returns a list of bluetooth adapters and devices
 ;; in the form
 ;; (("hci0"
@@ -471,6 +486,8 @@ adapter reported by Bluez."
:arg-namespace
(alist-get :adapter
   bluetooth--interfaces)
+
+ mode entry command
 
 ;;;###autoload
 (defun bluetooth-list-devices ()
@@ -493,6 +510,8 @@ scanning the bus, displaying device info etc."
   (bluetooth--register-signal-handler
 
 ;;; Bluetooth pairing agent code
+
+ Bluetooth pairing agent code
 
 ;; The release function is not needed at the moment, but needs
 ;; to be implemented for the agent API.
@@ -609,6 +628,8 @@ scanning the bus, displaying device info etc."
(alist-get :agent-manager bluetooth--interfaces)
"RegisterAgent"
:object-path bluetooth--own-path "KeyboardDisplay"))
+
+ service and class UUID definitions
 
 ;; The following constants define the meaning of the Bluetooth
 ;; CLASS property, which is made up of a number of fields.
@@ -1015,6 +1036,9 @@ scanning the bus, displaying device info etc."
   #xFFFE ("AirFuel Alliance" "Wireless Power Transfer Service")))
   "Bluetooth standards development organizations UUIDS.")
 
+
+ Bluetooth member UUIDs
+
 (defconst bluetooth--member-uuid-alist
   #s(hash-table
  size 100 data
@@ -1398,6 +1422,9 @@ scanning the bus, displaying device info etc."
   #xFD87 ("Google LLC")))
   "Bluetooth manufacturer UUIDs.")
 
+
+ service and class parsing code
+
 (defconst bluetooth--uuid-alists
   `((#xfff0 . ,bluetooth--sdo-uuid-alist)
 (#xfd00 . ,bluetooth--member-uuid-alist)
@@ -1465,6 +1492,9 @@ scanning the bus, displaying device info etc."
   "Get the minor field spec for FIELD using DATA as specification."
   (symbol-value (cdr (alist-get field data
 
+
+ Bluetooth company IDs
+
 ;; Very long list of manufacturer IDs.
 ;; Last updated: 05. Nov 2019
 (defconst bluetooth--manufacturer-ids
@@ -3575,6 +3605,9 @@ scanning the bus, displaying device info etc."
   #x0836 "Bitwards Oy"))
   "Bluetooth manufacturer IDs.")
 
+
+ device info display
+
 (defun bluetooth-show-device-info ()
   "Show detailed information on the device at point."
   (interactive)



[elpa] externals/bluetooth 8d4b762 01/33: fixes indent declaration in macros, generalises function name regexp

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 8d4b762c59b1cf4b00c2690f59770622de404c33
Author: Raffael Stocker 
Commit: Raffael Stocker 

fixes indent declaration in macros, generalises function name regexp
---
 bluetooth.el | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 0c47a44..835201e 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -130,45 +130,45 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
 (save-match-data
   (concat "bluetooth"
  prefix
- (replace-regexp-in-string "[A-Z][a-z]+"
+ (replace-regexp-in-string "[[:upper:]][[:lower:]]+"
(lambda (x) (concat "-" (downcase x)))
name t)
 
 (defmacro bluetooth-defun-method (method api docstring)
-  (declare (doc-string 3) (indent 3))
+  (declare (doc-string 3) (indent 2))
   (let ((name (bluetooth--function-name method)))
 `(defun ,(intern name) () ,docstring
(interactive)
(bluetooth--dbus-method ,method ,api
 
 (bluetooth-defun-method "Connect" :device
-   "Connect to the Bluetooth device at point.")
+  "Connect to the Bluetooth device at point.")
 (bluetooth-defun-method "Disconnect" :device
-   "Disconnect Bluetooth device at point.")
+  "Disconnect Bluetooth device at point.")
 (bluetooth-defun-method "StartDiscovery" :adapter
-   "Start discovery mode.")
+  "Start discovery mode.")
 (bluetooth-defun-method "StopDiscovery" :adapter
-   "Stop discovery mode.")
+  "Stop discovery mode.")
 (bluetooth-defun-method "Pair" :device
-   "Pair with device at point.")
+  "Pair with device at point.")
 
 (defmacro bluetooth-defun-toggle (property api docstring)
-  (declare (doc-string 3) (indent 3))
+  (declare (doc-string 3) (indent 2))
   (let ((name (bluetooth--function-name property "-toggle")))
 `(defun ,(intern name) () ,docstring
(interactive)
(bluetooth--dbus-toggle ,property ,api
 
 (bluetooth-defun-toggle "Blocked" :device
-   "Mark Bluetooth device at point blocked.")
+  "Mark Bluetooth device at point blocked.")
 (bluetooth-defun-toggle "Trusted" :device
-   "Mark Bluetooth device at point trusted.")
+  "Mark Bluetooth device at point trusted.")
 (bluetooth-defun-toggle "Powered" :adapter
-   "Toggle power supply of adapter.")
+  "Toggle power supply of adapter.")
 (bluetooth-defun-toggle "Discoverable" :adapter
-   "Toggle discoverable mode.")
+  "Toggle discoverable mode.")
 (bluetooth-defun-toggle "Pairable" :adapter
-   "Toggle pairable mode.")
+  "Toggle pairable mode.")
 
 (defun bluetooth-set-alias (name)
   "Set alias of Bluetooth device at point."



[elpa] externals/bluetooth e15f6d0 14/33: Revert "add local variable for flycheck mode"

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit e15f6d0f4023e30a6a108844b9c29aa9921b1f46
Author: Raffael Stocker 
Commit: Raffael Stocker 

Revert "add local variable for flycheck mode"

This reverts commit e86e01f6acead2edb7a842ffb790f75d5f565097.

flycheck-mode causes problems with ELPA tooling.
---
 bluetooth.el | 4 
 1 file changed, 4 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index fa5428d..9816371 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -3605,8 +3605,4 @@ scanning the bus, displaying device info etc."
 
 (provide 'bluetooth)
 
-;; Local variables:
-;; eval: (flycheck-mode)
-;; End:
-
 ;;; bluetooth.el ends here



[elpa] externals/bluetooth eebb593 32/33: refactor variable names of hash tables (were: -alist)

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit eebb593398fcc1e07eafdc72c1330a91fd8a3cab
Author: Raffael Stocker 
Commit: Raffael Stocker 

refactor variable names of hash tables (were: -alist)

* bluetooth.el (bluetooth--service-class-uuid-alist): new names end in 
-uuids
   (bluetooth--gatt-service-uuid-alist):
   (bluetooth--sdo-uuid-alist):
   (bluetooth--member-uuid-alist):
   (bluetooth--uuid-alists):
---
 bluetooth.el | 36 +---
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index de68b6b..af7ddfe 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -938,7 +938,10 @@ scanning the bus, displaying device info etc."
 (#xf . "Personal mobility device"
   "Bluetooth health minor classes.")
 
-(defconst bluetooth--service-class-uuid-alist
+(define-obsolete-variable-alias 'bluetooth--service-class-uuid-alist
+  'bluetooth--service-class-uuids "0.2")
+
+(defconst bluetooth--service-class-uuids
   #s(hash-table
 size 50 data
 (#x1000
@@ -1034,7 +1037,10 @@ scanning the bus, displaying device info etc."
  #x1402 ("HDP Sink" "Health Device Profile (HDP)")))
   "Bluetooth service class UUIDs.")
 
-(defconst bluetooth--gatt-service-uuid-alist
+(define-obsolete-variable-alias 'bluetooth--gatt-service-uuid-alist
+  'bluetooth--gatt-service-uuids "0.2")
+
+(defconst bluetooth--gatt-service-uuids
   #s(hash-table
 size 20 data
 (#x1800
@@ -1110,7 +1116,10 @@ scanning the bus, displaying device info etc."
  #x181D ("Weight Scale" "org.bluetooth.service.weight_scale" "GSS")))
   "Bluetooth GATT service UUIDs.")
 
-(defconst bluetooth--sdo-uuid-alist
+(define-obsolete-variable-alias 'bluetooth--sdo-uuid-alist
+  'bluetooth--sdo-uuids "0.2")
+
+(defconst bluetooth--sdo-uuids
   #s(hash-table
 size 5 data
 (#xFFF9
@@ -1129,7 +1138,10 @@ scanning the bus, displaying device info etc."
  Bluetooth member UUIDs
 ;; Last updated: 19. Sep 2020
 
-(defconst bluetooth--member-uuid-alist
+(define-obsolete-variable-alias 'bluetooth--member-uuid-alist
+  'bluetooth--member-uuids "0.2")
+
+(defconst bluetooth--member-uuids
   #s(hash-table
 size 100 data
 (#xFEFF
@@ -1584,12 +1596,14 @@ scanning the bus, displaying device info etc."
 
  service and class parsing code
 
-(defconst bluetooth--uuid-alists
-  `((#xfff0 . ,bluetooth--sdo-uuid-alist)
-   (#xfd00 . ,bluetooth--member-uuid-alist)
-   (#x1800 . ,bluetooth--gatt-service-uuid-alist)
-   (#x0 . ,bluetooth--service-class-uuid-alist))
-  "Bluetooth UUID alists sorted by beginning of range.")
+(define-obsolete-variable-alias 'bluetooth--uuid-alists 'bluetooth--uuids 
"0.2")
+
+(defconst bluetooth--uuids
+  `((#xfff0 . ,bluetooth--sdo-uuids)
+   (#xfd00 . ,bluetooth--member-uuids)
+   (#x1800 . ,bluetooth--gatt-service-uuids)
+   (#x0 . ,bluetooth--service-class-uuids))
+  "Bluetooth UUID tables sorted by beginning of range.")
 
 (defun bluetooth--parse-service-class-uuid (uuid)
   "Parse UUID and return short and long service class names."
@@ -1599,7 +1613,7 @@ scanning the bus, displaying device info etc."
  (let ((service-id (string-to-number (match-string 1 uuid) 16)))
(or (gethash service-id
 (cdr (-find (lambda (x) (>= service-id 
(car x)))
-
bluetooth--uuid-alists)))
+
bluetooth--uuids)))
(list  (format "#x%08x" service-id) "unknown"))
 
 (defun bluetooth--parse-class (class)



[elpa] externals/bluetooth updated (9ea7bad -> 28d16f6)

2020-09-19 Thread Stefan Monnier
monnier pushed a change to branch externals/bluetooth.

  from  9ea7bad   requires 'subr-x (for when-let) and fixes a defun 
definition issue
   new  8d4b762   fixes indent declaration in macros, generalises function 
name regexp
   new  6813a70   fixes comments to conform to Elisp conventions
   new  24d3c4a   fixes column widths in list format so sorting arrows are 
visible
   new  f81cb13   removes unnecessary `save-match-data' invocations
   new  94d9827   displays MAC address if alias is unknown (pairing agent)
   new  1649156   removes incorrect mode-info clean-up
   new  fba1988   adds a simple compile/test setup script
   new  2f8f31c   adds an unload function
   new  53323b9   matches case sensitively in bluetooth--function-name
   new  b60b76c   add Makefile and remove now unused bluetooth-test* files
   new  8f3dcaa   move some of the comments into docstrings
   new  e86e01f   add local variable for flycheck mode
   new  e15f6d0   Revert "add local variable for flycheck mode"
   new  f107d6f   Add menu entries to bluetooth-mode-map
   new  eb4b158   Merge commit 'f107d6f'
   new  b12caf1   update author list
   new  5d72618   add page breaks and section headings
   new  1758202   correct indentation
   new  8e8b6d0   bump up the copyright year
   new  e95f30b   avoid using undocumented value of ‘push’
   new  943ddf3   Clean up the UUID and class descriptions
   new  98afd71   add property and uuid functions, update info display
   new  2746c62   change connect and disconnect functions to handle single 
profiles
   new  0ca89cf   clean up the connect and disconnect functions
   new  2ae073b   update readme with single profile connect information
   new  7bb793f   remove unneeded hydra reference from Makefile
   new  950cc77   add more menu entries
   new  b5fc5c2   correct docstring in bluetooth-disconnect
   new  518ebdf   update company ids (bluetooth--manufacturer-ids)
   new  dc4b63b   correct docstrings
   new  6599093   update list of member UUIDs 
(bluetooth--member-uuid-alist).
   new  eebb593   refactor variable names of hash tables (were: -alist)
   new  28d16f6   set version number to 0.2


Summary of changes:
 Makefile |   40 +
 Readme.org   |   65 +-
 bluetooth.el | 7022 +++---
 3 files changed, 3854 insertions(+), 3273 deletions(-)
 create mode 100644 Makefile



[elpa] externals/bluetooth 518ebdf 29/33: update company ids (bluetooth--manufacturer-ids)

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 518ebdfa8baf3b13a656fde36f15e1f94706e126
Author: Raffael Stocker 
Commit: Raffael Stocker 

update company ids (bluetooth--manufacturer-ids)
---
 bluetooth.el | 300 ++-
 1 file changed, 298 insertions(+), 2 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index d0e7dcd..a783ce4 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -1584,7 +1584,7 @@ scanning the bus, displaying device info etc."
  Bluetooth company IDs
 
 ;; Very long list of manufacturer IDs.
-;; Last updated: 05. Nov 2019
+;; Last updated: 19. Sep 2020
 (defconst bluetooth--manufacturer-ids
   #s(hash-table
 size 500 data
@@ -3690,7 +3690,303 @@ scanning the bus, displaying device info etc."
  #x0833 "Conneqtech B.V."
  #x0834 "RIKEN KEIKI CO., LTD."
  #x0835 "Canopy Growth Corporation"
- #x0836 "Bitwards Oy"))
+ #x0836 "Bitwards Oy"
+ #x0837 "vivo Mobile Communication Co., Ltd."
+ #x0838 "Etymotic Research, Inc."
+ #x0839 "A puissance 3"
+ #x083A "BPW Bergische Achsen Kommanditgesellschaft"
+ #x083B "Piaggio Fast Forward"
+ #x083C "BeerTech LTD"
+ #x083D "Tokenize, Inc."
+ #x083E "Zorachka LTD"
+ #x083F "D-Link Corp."
+ #x0840 "Down Range Systems LLC"
+ #x0841 "General Luminaire (Shanghai) Co., Ltd."
+ #x0842 "Tangshan HongJia electronic technology co., LTD."
+ #x0843 "FRAGRANCE DELIVERY TECHNOLOGIES LTD"
+ #x0844 "Pepperl + Fuchs GmbH"
+ #x0845 "Dometic Corporation"
+ #x0846 "USound GmbH"
+ #x0847 "DNANUDGE LIMITED"
+ #x0848 "JUJU JOINTS CANADA CORP."
+ #x0849 "Dopple Technologies B.V."
+ #x084A "ARCOM"
+ #x084B "Biotechware SRL"
+ #x084C "ORSO Inc."
+ #x084D "SafePort"
+ #x084E "Carol Cole Company"
+ #x084F "Embedded Fitness B.V."
+ #x0850 "Yealink (Xiamen) Network Technology Co.,LTD"
+ #x0851 "Subeca, Inc."
+ #x0852 "Cognosos, Inc."
+ #x0853 "Pektron Group Limited"
+ #x0854 "Tap Sound System"
+ #x0855 "Helios Hockey, Inc."
+ #x0856 "Canopy Growth Corporation"
+ #x0857 "Parsyl Inc"
+ #x0858 "SOUNDBOKS"
+ #x0859 "BlueUp"
+ #x085A "DAKATECH"
+ #x085B "RICOH ELECTRONIC DEVICES CO., LTD."
+ #x085C "ACOS CO.,LTD."
+ #x085D "Guilin Zhishen Information Technology Co.,Ltd."
+ #x085E "Krog Systems LLC"
+ #x085F "COMPEGPS TEAM,SOCIEDAD LIMITADA"
+ #x0860 "Alflex Products B.V."
+ #x0861 "SmartSensor Labs Ltd"
+ #x0862 "SmartDrive Inc."
+ #x0863 "Yo-tronics Technology Co., Ltd."
+ #x0864 "Rafaelmicro"
+ #x0865 "Emergency Lighting Products Limited"
+ #x0866 "LAONZ Co.,Ltd"
+ #x0867 "Western Digital Techologies, Inc."
+ #x0868 "WIOsense GmbH & Co. KG"
+ #x0869 "EVVA Sicherheitstechnologie GmbH"
+ #x086A "Odic Incorporated"
+ #x086B "Pacific Track, LLC"
+ #x086C "Revvo Technologies, Inc."
+ #x086D "Biometrika d.o.o."
+ #x086E "Vorwerk Elektrowerke GmbH & Co. KG"
+ #x086F "Trackunit A/S"
+ #x0870 "Wyze Labs, Inc"
+ #x0871 "Dension Elektronikai Kft. (formerly: Dension Audio Systems 
Ltd.)"
+ #x0872 "11 Health & Technologies Limited"
+ #x0873 "Innophase Incorporated"
+ #x0874 "Treegreen Limited"
+ #x0875 "Berner International LLC"
+ #x0876 "SmartResQ ApS"
+ #x0877 "Tome, Inc."
+ #x0878 "The Chamberlain Group, Inc."
+ #x0879 "MIZUNO Corporation"
+ #x087A "ZRF, LLC"
+ #x087B "BYSTAMP"
+ #x087C "Crosscan GmbH"
+ #x087D "Konftel AB"
+ #x087E "1bar.net Limited"
+ #x087F "Phillips Connect Technologies LLC"
+ #x0880 "imagiLabs AB"
+ #x0881 "Optalert"
+ #x0882 "PSYONIC, Inc."
+ #x0883 "Wintersteiger AG"
+ #x0884 "Controlid Industria, Comercio de Hardware e Servicos de 
Tecnologia Ltda"
+ #x0885 "LEVOLOR, INC."
+ #x0886 "Xsens Technologies B.V."
+ #x0887 "Hydro-Gear Limited Partnership"
+ #x0888 "EnPointe Fencing Pty Ltd"
+ #x0889 "XANTHIO"
+ #x088A "sclak s.r.l."
+ #x088B "Tricorder Arraay Technologies LLC"
+ #x088C "GB Solution co.,Ltd"
+ #x088D "Soliton Systems K.K."
+ #x088E "GIGA-TMS INC"
+ #x088F "Tait International Limited"
+ #x0890 "NICHIEI INTEC CO., LTD."
+ #x0891 "SmartWireless GmbH & Co. KG"
+ #x0892 "Ingenieurbuero Birnfeld UG (haftungsbeschraenkt)"
+ #x0893 "Maytronics Ltd"
+ #x0894 "EPIFIT"
+ #x0895 "Gimer medical"
+ #x0896 "Nokian Renkaat Oyj"
+ #x0897 "Current Lighting Solutions LLC"
+ #x0898 "Sensibo, Inc."
+ #x0899 "SFS u

[elpa] externals/bluetooth 6813a70 02/33: fixes comments to conform to Elisp conventions

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 6813a7043473883725b8f921f5cdc21d15a0a6f6
Author: Raffael Stocker 
Commit: Raffael Stocker 

fixes comments to conform to Elisp conventions
---
 bluetooth.el | 130 +--
 1 file changed, 65 insertions(+), 65 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 835201e..783a8d8 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -78,30 +78,30 @@ This is usually `:system' if bluetoothd runs as a system 
service, or
 
 (put 'bluetooth--mode-info 'risky-local-variable t)
 
-;;; The state information list defines the kind of adapter state displayed
-;;; in the mode-line.  The first element of a sublist is an adapter property,
-;;; the second is a list containing first the current status of the item 
(t/nil),
-;;; second the displayed string if the property is non-nil and
-;;; third the displayed string if the property is nil.  If a
-;;; display element is nil, nothing will be displayed for this property.
+;; The state information list defines the kind of adapter state displayed
+;; in the mode-line.  The first element of a sublist is an adapter property,
+;; the second is a list containing first the current status of the item 
(t/nil),
+;; second the displayed string if the property is non-nil and
+;; third the displayed string if the property is nil.  If a
+;; display element is nil, nothing will be displayed for this property.
 (defvar bluetooth--mode-state '(("Powered" . (nil nil "off"))
("Discoverable" . (nil "discoverable" nil))
("Pairable" . (nil "pairable" nil))
("Discovering" . (nil "scan" nil)))
   "Mode line adapter state information.")
 
-;;; Bluez service name as defined by the Bluez API
+;; Bluez service name as defined by the Bluez API
 (defconst bluetooth--service "org.bluez" "D-Bus service name of Bluez.")
 
-;;; Bluez root path as defined by the Bluez API
+;; Bluez root path as defined by the Bluez API
 (defconst bluetooth--root "/org/bluez" "D-Bus path root for Bluez.")
 
-;;; our path name for the pairing agent
+;; our path name for the pairing agent
 (defconst bluetooth--own-path (concat dbus-path-emacs "/bluetooth")
   "D-Bus object path for the pairing agent.")
 
-;;; these two variables hold D-Bus objects to allow clean-up in
-;;; the kill-buffer-hook
+;; these two variables hold D-Bus objects to allow clean-up in
+;; the kill-buffer-hook
 (defvar bluetooth--method-objects '() "D-Bus method objects.")
 (defvar bluetooth--adapter-signal nil "D-Bus adapter signal object.")
 
@@ -117,10 +117,10 @@ This is usually `:system' if bluetoothd runs as a system 
service, or
 (:properties . "org.freedesktop.DBus.Properties"))
   "Bluez D-Bus interfaces.")
 
-;;; Default timeout for D-Bus commands
+;; Default timeout for D-Bus commands
 (defvar bluetooth--timeout 5000 "Default timeout for Bluez D-Bus access.")
 
-;;; This variable holds the device information as obtained from D-Bus.
+;; This variable holds the device information as obtained from D-Bus.
 (defvar bluetooth--device-info nil "Device info obtained from Bluez.")
 
 (eval-and-compile
@@ -196,13 +196,13 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
 map)
   "The Bluetooth mode keymap.")
 
-;;; This function returns a list of bluetooth adapters and devices
-;;; in the form
-;;; (("hci0"
-;;;   ("dev_78_AB_BB_DA_6C_7E" "dev_90_F1_AA_06_24_72")))
-;;;
-;;; The first element of each (sub-) list is an adapter name, followed
-;;; by a list of devices known to this adapter.
+;; This function returns a list of bluetooth adapters and devices
+;; in the form
+;; (("hci0"
+;;   ("dev_78_AB_BB_DA_6C_7E" "dev_90_F1_AA_06_24_72")))
+;;
+;; The first element of each (sub-) list is an adapter name, followed
+;; by a list of devices known to this adapter.
 (defun bluetooth--get-devices ()
   "Return a list of bluetooth adapters and devices connected to them."
   (mapcar (lambda (a)
@@ -219,15 +219,15 @@ The generated function name has the form 
`bluetoothPREFIX-NAME'."
  ((null value) "no")
  (t "yes"
 
-;;; List format for the main display buffer.
-;;; NOTE: the strings MUST correspond to Bluez device properties
-;;; as they are used to gather the information from Bluez.
+;; List format for the main display buffer.
+;; NOTE: the strings MUST correspond to Bluez device properties
+;; as they are used to gather the information from Bluez.
 (defconst bluetooth--list-format
   [("Alias" 30 t) ("Paired" 6 t) ("Connected" 9 t) ("Address" 17 t)
("Blocked" 7 t) ("Trusted" 7 t)] "The list view format for bluetooth mode.")
 
-;;; This function provides the list entries for the tabulated-list
-;;; view.  It is called from `tabulated-list-print'.
+;; This function provides the list entries for the tabulated-list
+;; view.  It is called from `tabulated-list-print'.
 (defun bluetooth--list-entries ()
   "Provide the list entries

[elpa] externals/bluetooth 2ae073b 25/33: update readme with single profile connect information

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit 2ae073bf1c6258374a211b3076b6dae517c306b9
Author: Raffael Stocker 
Commit: Raffael Stocker 

update readme with single profile connect information
---
 Readme.org | 65 +++---
 1 file changed, 32 insertions(+), 33 deletions(-)

diff --git a/Readme.org b/Readme.org
index 7a39713..934d7d5 100644
--- a/Readme.org
+++ b/Readme.org
@@ -5,7 +5,7 @@
 
   Implemented features are:
   - (un-)pairing devices
-  - (dis-)connecting
+  - (dis-)connecting devices or single profiles of devices
   - discovery mode
   - setting device properties (alias, blocked, trusted)
   - setting adapter properties (powered, discoverable, pairable)
@@ -17,48 +17,47 @@
 
 ** Usage
 
-   To install it, invoke ~M-x package-install-file~ on  ~bluetooth.el~
-   and then  use it with ~M-x bluetooth-list-devices~.
+   To install it, invoke =M-x package-install-file= on  =bluetooth.el=
+   and then  use it with =M-x bluetooth-list-devices=.
 
The mode assumes availability of Bluez on D-Bus.  Depending on the system
-   configuration, Bluez may use the ~:system~ bus or the ~:session~ bus.  This
-   can be configured by using ~M-x customize~ to set the ~bluetooth-bluez-bus~
-   variable in the ~Communication/Bluetooth~ menu to either the symbol
-   ~:system~ or ~:session~, as appropriate.
+   configuration, Bluez may use the =:system= bus or the =:session= bus.  This
+   can be configured by using =M-x customize= to set the =bluetooth-bluez-bus=
+   variable in the =Communication/Bluetooth= menu to either the symbol
+   =:system= or =:session=, as appropriate.
 
 *** Key bindings
 
 The following table lists the default key bindings:
-| Key | Command
|
-
|-+|
-| P   | pair with a device 
|
-| c   | connect to a device (may start pairing procedure)  
|
-| d   | disconnect a device
|
-| a   | set or reset a device's alias  
|
-| t   | toggle the trusted property of a device
|
-| b   | toggle the blocked property of a device (disconnects 
connected device) |
-| k   | remove a device (will disconnect and unpair)   
|
-| i   | show device information, such as RSSI value, device class 
and services |
-| r   | start discovery (scan) mode
|
-| R   | stop discovery (scan) mode 
|
-| D   | toggle the discoverable property of the adapter
|
-| x   | toggle the pairable property of the adapter
|
-| s   | toggle the power supply of the adapter 
|
-| n   | next line  
|
-| p   | previous line  
|
-| <   | go to the beginning of the list
|
-| >   | go to the end of the list  
|
-| g   | revert the buffer; this queries the bus for accessible 
devices |
-| S   | sort list by column at point   
|
-| h or ?  | describe the mode  
|
-| q   | bury the buffer
|
-| ~M-x imenu~ | invoke imenu to select a device
|
-
+| Key | Command
|
+
|-+|
+| P   | pair with a device 
|
+| c   | connect to a device (may start pairing procedure); with a 
prefix argument, connect to a single profile |
+| d   | disconnect a device; with a prefix argument, disconnect a 
single profile   |
+| a   | set or reset a device's alias  
|
+| t   | toggle the trusted property of a device
|
+| b   | toggle the blocked property of a device (disconnects 
connected device) 

[elpa] externals/bluetooth f81cb13 04/33: removes unnecessary `save-match-data' invocations

2020-09-19 Thread Stefan Monnier
branch: externals/bluetooth
commit f81cb139eda56d52b7879cd136b5fdaa9dfeaaee
Author: Raffael Stocker 
Commit: Raffael Stocker 

removes unnecessary `save-match-data' invocations
---
 bluetooth.el | 47 ++-
 1 file changed, 22 insertions(+), 25 deletions(-)

diff --git a/bluetooth.el b/bluetooth.el
index 173076e..262a412 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -127,12 +127,11 @@ This is usually `:system' if bluetoothd runs as a system 
service, or
   (defun bluetooth--function-name (name &optional prefix)
 "Make a function name out of NAME and PREFIX.
 The generated function name has the form `bluetoothPREFIX-NAME'."
-(save-match-data
-  (concat "bluetooth"
- prefix
- (replace-regexp-in-string "[[:upper:]][[:lower:]]+"
-   (lambda (x) (concat "-" (downcase x)))
-   name t)
+(concat "bluetooth"
+   prefix
+   (replace-regexp-in-string "[[:upper:]][[:lower:]]+"
+ (lambda (x) (concat "-" (downcase x)))
+ name t
 
 (defmacro bluetooth-defun-method (method api docstring)
   (declare (doc-string 3) (indent 2))
@@ -477,18 +476,17 @@ scanning the bus, displaying device info etc."
   "Request a pin code for DEVICE."
   (bluetooth--maybe-cancel-reject
 (bluetooth--with-alias device
-  (save-match-data
-   (let* ((pin (read-from-minibuffer
-(format "Enter Bluetooth PIN for `%s': " alias)))
-  (trimmed-pin (substring pin 0 (min (length pin) 16)))
-  (case-fold-search nil))
- (cond ((= 0 (length trimmed-pin))
-(message "PIN has zero length")
-nil)
-   ((string-match "[^[:alnum:]]" trimmed-pin)
-(message "PIN contains non-alphanumeric characters")
-nil)
-   (t trimmed-pin)))
+  (let* ((pin (read-from-minibuffer
+  (format "Enter Bluetooth PIN for `%s': " alias)))
+(trimmed-pin (substring pin 0 (min (length pin) 16)))
+(case-fold-search nil))
+   (cond ((= 0 (length trimmed-pin))
+  (message "PIN has zero length")
+  nil)
+ ((string-match "[^[:alnum:]]" trimmed-pin)
+  (message "PIN contains non-alphanumeric characters")
+  nil)
+ (t trimmed-pin))
 
 (defun bluetooth--display-pin-code (device pincode)
   "Display the PINCODE for DEVICE."
@@ -1366,13 +1364,12 @@ scanning the bus, displaying device info etc."
   "Parse UUID and return short and long service class names."
   (let ((uuid-re (rx (seq bos (submatch (= 8 xdigit))
  "-" (eval bluetooth--base-uuid) eos
-(save-match-data
-  (when (string-match uuid-re uuid)
-   (let ((service-id (string-to-number (match-string 1 uuid) 16)))
- (or (gethash service-id
-  (cdr (-find (lambda (x) (>= service-id (car x)))
-  bluetooth--uuid-alists)))
- (list  (format "#x%08x" service-id) "unknown")))
+(when (string-match uuid-re uuid)
+  (let ((service-id (string-to-number (match-string 1 uuid) 16)))
+   (or (gethash service-id
+(cdr (-find (lambda (x) (>= service-id (car x)))
+bluetooth--uuid-alists)))
+   (list  (format "#x%08x" service-id) "unknown"))
 
 (defun bluetooth--parse-class (class)
   "Parse the CLASS property of a Bluetooth device."



[elpa] externals/chess 7193c24 2/2: * chess-network.el (chess-network-handler): Use `executable-find'.

2020-09-19 Thread Mario Lang
branch: externals/chess
commit 7193c24769d463ae8920a2f8143f8cc3d0122eb1
Author: Mario Lang 
Commit: Mario Lang 

* chess-network.el (chess-network-handler): Use `executable-find'.
---
 chess-network.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chess-network.el b/chess-network.el
index c9a6b3d..16f7aa7 100644
--- a/chess-network.el
+++ b/chess-network.el
@@ -144,7 +144,7 @@
  (string-to-number
   (read-string "Port: ")))
(start-process "*chess-network*"
-  (current-buffer) "/usr/bin/nc"
+  (current-buffer) (executable-find "nc")
   "-l" "-p" (read-string "Port: ")))
(open-network-stream "*chess-network*" (current-buffer)
 (read-string "Host: ")



[elpa] externals/chess updated (31a581b -> 7193c24)

2020-09-19 Thread Mario Lang
mlang pushed a change to branch externals/chess.

  from  31a581b   * chess-pgn.el (chess-pgn-parse): Fix unescaped character 
literal
   new  2d797ff   * chess-game.el (chess-game-ply): Fix docstring.
   new  7193c24   * chess-network.el (chess-network-handler): Use 
`executable-find'.


Summary of changes:
 chess-game.el| 2 +-
 chess-network.el | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)



[elpa] externals/chess 2d797ff 1/2: * chess-game.el (chess-game-ply): Fix docstring.

2020-09-19 Thread Mario Lang
branch: externals/chess
commit 2d797ff3a3e9d8e0019feec7fa99a34b5d15ad42
Author: Mario Lang 
Commit: Mario Lang 

* chess-game.el (chess-game-ply): Fix docstring.
---
 chess-game.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chess-game.el b/chess-game.el
index d86f159..06b99fb 100644
--- a/chess-game.el
+++ b/chess-game.el
@@ -222,7 +222,7 @@ if INDEX is nil)."
 
 (defun chess-game-ply (game &optional index)
   "Return a ply of GAME.
-If INDEX is non-nil, the last played ply is returned."
+If INDEX is nil, the last played ply is returned."
   (cl-assert game)
   (if index
   (nth index (chess-game-plies game))



[elpa] master 6645f73: If there are multiple patches, collect the .rej from all of them

2020-09-19 Thread Lars Ingebrigtsen
branch: master
commit 6645f73a8850496f17317f3f2d7d5475946fa775
Author: Lars Ingebrigtsen 
Commit: Lars Ingebrigtsen 

If there are multiple patches, collect the .rej from all of them
---
 packages/debbugs/debbugs-gnu.el | 26 +++---
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el
index 4516423..f2179f7 100644
--- a/packages/debbugs/debbugs-gnu.el
+++ b/packages/debbugs/debbugs-gnu.el
@@ -2421,13 +2421,25 @@ If SELECTIVELY, query the user before applying the 
patch."
  (y-or-n-p (format "%s\nApply?"
(buffer-substring (point-min)
  (min 200 (point-max))
- (call-process-region (point-min) (point-max)
-  "patch" nil output-buffer nil
-  "-r" rej "--no-backup-if-mismatch"
-  "-l" "-f"
-  "-d" (expand-file-name
-debbugs-gnu-current-directory)
-  "-p1"
+ (let (old-rej)
+   (when (file-exists-p rej)
+ (with-temp-buffer
+   (insert-file-contents rej)
+   (setq old-rej (buffer-string)))
+ (delete-file rej))
+   (call-process-region (point-min) (point-max)
+"patch" nil output-buffer nil
+"-r" rej "--no-backup-if-mismatch"
+"-l" "-f"
+"-d" (expand-file-name
+  debbugs-gnu-current-directory)
+"-p1")
+   (when old-rej
+ (with-temp-buffer
+   (insert old-rej)
+   (when (file-exists-p rej)
+ (insert-file-contents rej))
+   (write-region (point-min) (point-max) rej nil 'silent)))
 (set-buffer output-buffer)
 (when (file-exists-p rej)
   (goto-char (point-max))



[elpa] master 80c0dec 4/5: [org-translate] Allow ogt-insert-glossary-translation to prompt

2020-09-19 Thread Eric Abrahamsen
branch: master
commit 80c0dece59e77efdbcbcdccf3808e5c5e6dcc018
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[org-translate] Allow ogt-insert-glossary-translation to prompt

*
packages/org-translate/org-translate.el (ogt-insert-glossary-translation):
With a prefix arg, prompt for a term to insert, rather than guessing.
---
 packages/org-translate/org-translate.el | 77 +
 1 file changed, 50 insertions(+), 27 deletions(-)

diff --git a/packages/org-translate/org-translate.el 
b/packages/org-translate/org-translate.el
index e882b4f..1c31915 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -105,7 +105,8 @@
 ;; In the translation text, use "C-M-;"
 ;; (`ogt-insert-glossary-translation') to add a translation.  The mode
 ;; will attempt to guess which term you're adding, and suggest
-;; previous translations for that term.
+;; previous translations for that term.  If you don't want it to
+;; guess, use a prefix argument to be prompted.
 
 ;; Bookmarks
 
@@ -674,33 +675,55 @@ prompt the user for STRING."
   (push string (alist-get 'source (gethash id ogt-glossary-table)
   (message "Added %s as a glossary term" string))
 
-(defun ogt-insert-glossary-translation ()
-  "Insert a likely translation of the next glossary item."
-  (interactive)
-  (let ((terms-this-segment 1)
-   glossary-id glossary-translation orig this-translation)
+(defun ogt-insert-glossary-translation (prompt)
+  "Insert a likely translation of the next glossary term.
+Guesses the glossary term to insert based on how many terms have
+already been translated in this segment.  Alternately, give a
+prefix arg to be prompted for the term to enter."
+  (interactive "P")
+  (let* ((orig (when prompt
+(completing-read
+ "Add translation of: "
+ (mapcan (lambda (v)
+   (copy-sequence (alist-get 'source v)))
+ (hash-table-values ogt-glossary-table))
+ nil t)))
+(glossary-id (when orig
+   (catch 'found
+ (maphash
+  (lambda (k v)
+(when (member orig (alist-get 'source v))
+  (throw 'found k)))
+  ogt-glossary-table
+glossary-translation this-translation)
 (ogt-update-source-location)
-(save-excursion
-  (while (re-search-backward "\\[\\[trans:"
-(save-excursion
-  (re-search-backward
-   (string ogt-segmentation-character) nil t)
-  (point))
-t)
-   (cl-incf terms-this-segment))
-  (with-selected-window ogt-source-window
-   (goto-char ogt-probable-source-location)
-   (while (null (zerop terms-this-segment))
- (re-search-forward org-link-any-re nil t)
- (when (string-prefix-p "trans:" (match-string 2))
-   (cl-decf terms-this-segment)))
-   (setq orig (match-string-no-properties 3)
- glossary-id (string-remove-prefix
-  "trans:" (match-string 2))
- glossary-translation
- (alist-get 'translation
-(gethash glossary-id ogt-glossary-table)
-(setq this-translation
+;; If we didn't prompt, attempt to guess which glossary term
+;; should be translated next by counting how many we've already
+;; done this segment.
+(unless (and orig glossary-id)
+  (let ((terms-this-segment 1))
+   (save-excursion
+ (while (re-search-backward
+ "\\[\\[trans:"
+ (save-excursion
+   (re-search-backward
+(string ogt-segmentation-character) nil t)
+   (point))
+ t)
+   (cl-incf terms-this-segment)))
+   (with-selected-window ogt-source-window
+ (goto-char ogt-probable-source-location)
+ (while (null (zerop terms-this-segment))
+   (re-search-forward org-link-any-re nil t)
+   (when (string-prefix-p "trans:" (match-string 2))
+ (cl-decf terms-this-segment)))
+ (setq orig (match-string-no-properties 3)
+   glossary-id (string-remove-prefix
+"trans:" (match-string 2))
+(setq glossary-translation
+ (alist-get 'translation
+(gethash glossary-id ogt-glossary-table))
+ this-translation
  (completing-read (format "Translation of %s: " orig)
   glossary-translation))
 (cl-pushnew



[elpa] master 562ecca 1/5: [org-translate] Improve documentation

2020-09-19 Thread Eric Abrahamsen
branch: master
commit 562ecca70f91c67e3b069196a98959df306cd887
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[org-translate] Improve documentation

* packages/org-translate/org-translate.el: Better initial walkthrough;
add mode map to minor-mode docstring.
---
 packages/org-translate/org-translate.el | 114 
 1 file changed, 87 insertions(+), 27 deletions(-)

diff --git a/packages/org-translate/org-translate.el 
b/packages/org-translate/org-translate.el
index 8bf61c4..a11b519 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -28,32 +28,87 @@
 ;; It is not a full-fledged CAT tool.  It essentially does two things:
 ;; manages segmentation correspondences between the source text and
 ;; the translation, and manages a glossary which can be used for
-;; automatic translation, displaying previous usages, etc.
-
-;; Currently assumes a single file holding a single translation
-;; project, with three separate headings for source text, translation,
-;; and glossary (other headings will be ignored).  Each translation
-;; project has five local settings, each of which also has a global
-;; default value.  The first three settings are used to locate the org
-;; subtrees representing source text, translation text, and glossary.
-;; The fourth setting defines the segmentation strategy: the source
-;; text can be segmented by sentence, paragraph, or regular
-;; expression.  The fifth setting determines the character to be used
-;; to delimit segments.
-
-;; While translating, use "C-M-n" to start a new segment in the
-;; translation text.  "C-M-b" and "C-M-f" will move forward and back
-;; between segments, maintaining the correspondence with the source
-;; text.  If the source text highlighting gets "lost", reset it with
-;; "C-M-t".  To add a new glossary item, move to the source window,
-;; put the region on the new item, and use M-x ogt-add-glossary-item.
-;; In the translation text, add a translation of the next glossary
-;; item with "C-M-y".
-
-;; Translation projects can optionally be defined and configured in
-;; the option `ogt-translation-projects' (see docstring for details)
-;; though this is only useful if you're working on multiple projects
-;; with different settings.
+;; automatic term translation, displaying previous usages, etc.
+
+;; Buffer setup:
+
+;; The mode currently assumes a single file holding a single
+;; translation project, with three separate top-level headings for
+;; source text, translation, and glossary (other headings will be
+;; ignored).  The three customization options
+;; `ogt-default-source-locator', `ogt-default-translation-locator' and
+;; `ogt-default-glossary-locator' can be used to tell the mode which
+;; heading is which; by default it expects a buffer that looks like
+;; this:
+
+;; * Le Rouge et le Noir :source:
+;;   La petite ville de Verrières peut passer pour...
+
+;; * The Red and the Black  :translation:
+;;   The small town of Verrieres may be regarded...
+
+;; * Glossary
+;; ** ville de Verrières
+
+;; In other words, tags are used to find the source and translation
+;; texts, while the glossary heading is just called "Glossary".  This
+;; is also configurable on a per-project basis, using the
+;; `ogt-translation-projects' option.
+
+;; Segmentation
+
+;; The first time you start this mode in a new translation project
+;; buffer (after first setting up the three headings appropriately),
+;; the mode will detect that the project has not yet been segmented,
+;; and will offer to do so.  Segmentation involves inserting the value
+;; of `ogt-segmentation-character' at intervals in the source text.
+;; As you progress through the translation, you'll insert that same
+;; character at corresponding places in the translation text, allowing
+;; the minor mode to keep track of which segment corresponds to which,
+;; and to keep the display of source and translation synchronized.
+
+;; The option `ogt-segmentation-strategy' determines how the source
+;; text is segmented.  Currently the options are to segment by
+;; sentence, by paragraph, or by regular expression.  Note that, after
+;; initial segmentation, the minor mode will leave the segmentation
+;; characters alone, and you're free to insert, delete or move them as
+;; needed.
+
+;; As you reach the end of each translation segment, use "C-M-n"
+;; (`ogt-new-segment') to insert a segmentation character and start a
+;; new segment.  The character should be inserted at the _beginning_
+;; of the new segment, not at the end of the last -- eg at the start
+;; of a paragraph or sentence.
+
+;; Use "C-M-f" and "C-M-b" to move forward and backward in the
+;; translation text by segment.  This will allow the minor mode to
+;; keep the corresponding source segment in view.  Alternately, move
+;; point however you like in the translation text, then use "C-M-t" to

[elpa] master updated (6645f73 -> 0e31f33)

2020-09-19 Thread Eric Abrahamsen
girzel pushed a change to branch master.

  from  6645f73   If there are multiple patches, collect the .rej from all 
of them
   new  562ecca   [org-translate] Improve documentation
   new  13d4d8a   [org-translate] Be stricter at startup
   new  75d8ced   [org-translate] Rename ogt-add-glossary-item: 
ogt-new-glossary-term
   new  80c0dec   [org-translate] Allow ogt-insert-glossary-translation to 
prompt
   new  0e31f33   [org-translate] Fix bug in ogt-hightlight-source-segment


Summary of changes:
 packages/org-translate/org-translate.el | 287 +---
 1 file changed, 192 insertions(+), 95 deletions(-)



[elpa] master 75d8ced 3/5: [org-translate] Rename ogt-add-glossary-item: ogt-new-glossary-term

2020-09-19 Thread Eric Abrahamsen
branch: master
commit 75d8cedd0ea46bd1413d2597c1199c3548723c52
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[org-translate] Rename ogt-add-glossary-item: ogt-new-glossary-term

* packages/org-translate/org-translate.el (ogt-new-glossary-term): Fix
bug in adding the very first glossary item. When finding other
instances of the term, anticipate them being split across lines.
(org-translate-mode-map): Provide binding for both adding new term,
and inserting translation.
---
 packages/org-translate/org-translate.el | 34 +++--
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/packages/org-translate/org-translate.el 
b/packages/org-translate/org-translate.el
index 9d59cae..e882b4f 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -97,13 +97,12 @@
 ;; translated a term previously, and offers these for completion on
 ;; inserting a new translation.
 
-;; To create a new glossary term, use "M-x ogt-add-glossary-item".  If
-;; you've marked text in the source buffer, this will become the new
-;; term, otherwise you'll be prompted to enter the string.  This
-;; command will attempt to turn all instances of this term in the
-;; source text into a link.
+;; To create a new glossary term, use "C-M-y".  If you've marked text
+;; in the source buffer, this will become the new term, otherwise
+;; you'll be prompted to enter the string.  This command will attempt
+;; to turn all instances of this term in the source text into a link.
 
-;; In the translation text, use "C-M-y"
+;; In the translation text, use "C-M-;"
 ;; (`ogt-insert-glossary-translation') to add a translation.  The mode
 ;; will attempt to guess which term you're adding, and suggest
 ;; previous translations for that term.
@@ -310,7 +309,8 @@ By default, just remove it."
 (define-key map (kbd "C-M-b") #'ogt-backward-segment)
 (define-key map (kbd "C-M-n") #'ogt-new-segment)
 (define-key map (kbd "C-M-t") #'ogt-update-source-location)
-(define-key map (kbd "C-M-y") #'ogt-insert-glossary-translation)
+(define-key map (kbd "C-M-y") #'ogt-new-glossary-term)
+(define-key map (kbd "C-M-;") #'ogt-insert-glossary-translation)
 map))
 
 (define-minor-mode org-translate-mode
@@ -643,7 +643,7 @@ the next one."
(recenter 10))
 (ogt-update-source-location)))
 
-(defun ogt-add-glossary-item (string)
+(defun ogt-new-glossary-term (string)
   "Add STRING as an item in the glossary.
 If the region is active, it will be used as STRING.  Otherwise,
 prompt the user for STRING."
@@ -655,18 +655,24 @@ prompt the user for STRING."
   (read-string "Glossary term: "
   (save-excursion
 (ogt-goto-heading 'glossary)
-(org-goto-first-child)
-(org-insert-heading-respect-content)
+(if (org-goto-first-child)
+   (org-insert-heading-respect-content)
+  (end-of-line)
+  (org-insert-subheading 1))
 (insert string)
-(let ((id (org-id-get-create)))
+(let ((id (org-id-get-create))
+ ;; STRING might be broken across lines.  What do we do about
+ ;; Chinese, with no word separators?
+ (doctored (replace-regexp-in-string
+"[[:blank:]]+" "[[:space:]\n]+"
+string)))
   (ogt-goto-heading 'source)
   (save-restriction
(org-narrow-to-subtree)
-   ;; TODO: `string' highly likely to be broken over newlines.
-   (while (re-search-forward string nil t)
+   (while (re-search-forward doctored nil t)
  (replace-match (format "[[trans:%s][%s]]" id string
   (push string (alist-get 'source (gethash id ogt-glossary-table)
-  (message "Added %s as a glossary item" string))
+  (message "Added %s as a glossary term" string))
 
 (defun ogt-insert-glossary-translation ()
   "Insert a likely translation of the next glossary item."



[elpa] master 13d4d8a 2/5: [org-translate] Be stricter at startup

2020-09-19 Thread Eric Abrahamsen
branch: master
commit 13d4d8a1765d61f8daabed85c7ccb01770c9c892
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[org-translate] Be stricter at startup

* packages/org-translate/org-translate.el: Require 'org-id, first of
all.
(ogt-locate-heading): Raise error if we can't find any of the
necessary headings.
(org-translate-mode): If anything errors, shut the mode off again.
---
 packages/org-translate/org-translate.el | 71 ++---
 1 file changed, 39 insertions(+), 32 deletions(-)

diff --git a/packages/org-translate/org-translate.el 
b/packages/org-translate/org-translate.el
index a11b519..9d59cae 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -136,6 +136,7 @@
 
 (require 'bookmark)
 (require 'ox)
+(require 'org-id)
 
 (defgroup org-translate nil
   "Customizations for the org-translate library."
@@ -339,22 +340,24 @@ By default, just remove it."
  ogt-translation-projects)
   (this-plist (when this-project
 (alist-get this-project ogt-translation-projects
-  (setq ogt-source-heading (or (plist-get this-plist :source)
-  (ogt-locate-heading
-   ogt-default-source-locator))
-   ogt-translation-heading (or (plist-get this-plist :translation)
-   (ogt-locate-heading
-ogt-default-translation-locator))
-   ogt-glossary-heading (or (plist-get this-plist :glossary)
-(ogt-locate-heading
- ogt-default-glossary-locator))
-   ogt-segmentation-strategy (or (plist-get this-plist :seg-strategy)
- ogt-default-segmentation-strategy)
-   ogt-segmentation-character (or (plist-get this-plist :seg-character)
-  ogt-default-segmentation-character)
-   ogt-glossary-table (make-hash-table :size 500 :test #'equal)
-   ogt-probable-source-location (make-marker)
-   ogt-source-segment-overlay (make-overlay (point) (point)))
+  (condition-case nil
+ (setq ogt-source-heading (or (plist-get this-plist :source)
+  (ogt-locate-heading
+   ogt-default-source-locator))
+   ogt-translation-heading (or (plist-get this-plist :translation)
+   (ogt-locate-heading
+ogt-default-translation-locator))
+   ogt-glossary-heading (or (plist-get this-plist :glossary)
+(ogt-locate-heading
+ ogt-default-glossary-locator))
+   ogt-segmentation-strategy (or (plist-get this-plist 
:seg-strategy)
+ ogt-default-segmentation-strategy)
+   ogt-segmentation-character (or (plist-get this-plist 
:seg-character)
+  
ogt-default-segmentation-character)
+   ogt-glossary-table (make-hash-table :size 500 :test #'equal)
+   ogt-probable-source-location (make-marker)
+   ogt-source-segment-overlay (make-overlay (point) (point)))
+   (error (org-translate-mode -1)))
   (push #'ogt-export-remove-segmenters org-export-filter-body-functions)
   (overlay-put ogt-source-segment-overlay
   'face 'highlight)
@@ -512,22 +515,26 @@ and applies a highlight to the appropriate segment of 
text."
 Creates an ID if necessary."
   (save-excursion
 (goto-char (point-min))
-(pcase locator
-  (`(heading . ,text)
-   (catch 'found
-(while (re-search-forward org-complex-heading-regexp nil t)
-  (when (string-match-p text (match-string 4))
-(throw 'found (org-id-get-create))
-  (`(tag . ,tag-text)
-   (catch 'found
-(while (re-search-forward org-tag-line-re nil t)
-  (when (string-match-p tag-text (match-string 2))
-(throw 'found (org-id-get-create))
-  (`(id . ,id-text)
-   (org-id-goto id-text))
-  (`(property (,prop . ,value))
-   (goto-char (org-find-property prop value))
-   (org-id-get-create)
+(let ((id (pcase locator
+   (`(heading . ,text)
+(catch 'found
+  (while (re-search-forward
+  org-complex-heading-regexp nil t)
+(when (string-match-p text (match-string 4))
+  (throw 'found (org-id-get-create))
+   (`(tag . ,tag-text)
+(catch 'found
+  (while (re-search-forward org-tag-line-re nil t)
+(when (string-match-p tag-text (match-stri

[elpa] master 0e31f33 5/5: [org-translate] Fix bug in ogt-hightlight-source-segment

2020-09-19 Thread Eric Abrahamsen
branch: master
commit 0e31f33379aec0110cf9db3ed87d0b49f59aa45f
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[org-translate] Fix bug in ogt-hightlight-source-segment

*
packages/org-translate/org-translate.el (ogt-highlight-source-segment):
This returned the correct position, but point actually needed to be
after the segmentation character.
---
 packages/org-translate/org-translate.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/packages/org-translate/org-translate.el 
b/packages/org-translate/org-translate.el
index 1c31915..b12bc40 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -496,7 +496,8 @@ and applies a highlight to the appropriate segment of text."
 (re-search-backward
  (string ogt-segmentation-character)
  nil t)
-(1+ (point)))
+(forward-char)
+(point))
(progn
 (or (and (re-search-forward
   (string ogt-segmentation-character)



[elpa] externals/chess 6d14e58: Fix use of CL types

2020-09-19 Thread Stefan Monnier
branch: externals/chess
commit 6d14e5800dba2ab3e3995867209dc24ebac0fe3f
Author: Stefan Monnier 
Commit: Stefan Monnier 

Fix use of CL types

* chess-game.el (chess-game-add-ply): `listp` is not a type.
* chess-network.el (chess-full-name): Silence compiler warnings.
* chess-pos.el (chess-pos): Define as type before use in `cl-typep`.
---
 chess-game.el| 4 ++--
 chess-network.el | 4 +++-
 chess-pos.el | 4 +++-
 chess-uci.el | 5 +++--
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/chess-game.el b/chess-game.el
index 06b99fb..c0b6079 100644
--- a/chess-game.el
+++ b/chess-game.el
@@ -1,6 +1,6 @@
 ;;; chess-game.el --- Maintain a chess game that is being played or viewed
 
-;; Copyright (C) 2002, 2004, 2014  Free Software Foundation, Inc.
+;; Copyright (C) 2002-2020  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley 
 ;; Maintainer: Mario Lang 
@@ -231,7 +231,7 @@ If INDEX is nil, the last played ply is returned."
 (defun chess-game-add-ply (game ply)
   "Add PLY to the main variation of GAME."
   (cl-assert game)
-  (cl-check-type ply listp)
+  (cl-check-type ply list)
   (let ((plies (chess-game-plies game)))
 (if plies
(nconc plies (list ply))
diff --git a/chess-network.el b/chess-network.el
index 16f7aa7..4d51666 100644
--- a/chess-network.el
+++ b/chess-network.el
@@ -1,6 +1,6 @@
 ;;; chess-network.el --- Play against an opponent over the network
 
-;; Copyright (C) 2002, 2003, 2008  Free Software Foundation, Inc.
+;; Copyright (C) 2002-2020  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley 
 ;; Maintainer: Mario Lang 
@@ -127,6 +127,8 @@
 (defvar chess-network-kind)
 (make-variable-buffer-local 'chess-network-kind)
 
+(defvar chess-full-name)
+
 (defun chess-network-handler (game event &rest args)
   "Initialize the network chess engine."
   (unless chess-engine-handling-event
diff --git a/chess-pos.el b/chess-pos.el
index 732893d..4416766 100644
--- a/chess-pos.el
+++ b/chess-pos.el
@@ -1,6 +1,6 @@
 ;;; chess-pos.el --- Routines for manipulating chess positions
 
-;; Copyright (C) 2002, 2004, 2014  Free Software Foundation, Inc.
+;; Copyright (C) 2002-2020  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley 
 ;; Maintainer: Mario Lang 
@@ -131,6 +131,8 @@ This variable automatically becomes buffer-local when 
changed.")
   "Return non-nil if POSITION is a chess position object."
   (and (vectorp position) (= (length position) 75)))
 
+(cl-deftype chess-pos () '(satisfies chess-pos-p))
+
 (chess-message-catalog 'english
   '((chess-nag-1   . "good move [traditional \"!\"]")
 (chess-nag-2   . "poor move [traditional \"?\"]")
diff --git a/chess-uci.el b/chess-uci.el
index f54e9c0..e10e133 100644
--- a/chess-uci.el
+++ b/chess-uci.el
@@ -1,6 +1,6 @@
 ;;; chess-uci.el --- Common functions for the Universal Chess Interface 
protocol
 
-;; Copyright (C) 2014  Free Software Foundation, Inc.
+;; Copyright (C) 2014-2020  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang 
 ;; Keywords: games, processes
@@ -50,7 +50,8 @@
   (if (and (= from (chess-pos-king-index position color))
(= (chess-index-rank from) (chess-index-rank to))
(> (abs (- (chess-index-file from)
-  (chess-index-file to))) 1))
+  (chess-index-file to)))
+  1))
   (chess-ply-castling-changes
position
(< (- (chess-index-file to) (chess-index-file from)) 0))



[elpa] master 4bc5aa2: [org-translate] Add keymap for translation links, plus occur command

2020-09-19 Thread Eric Abrahamsen
branch: master
commit 4bc5aa2ecb1742259997c3a80012129bf959d383
Author: Eric Abrahamsen 
Commit: Eric Abrahamsen 

[org-translate] Add keymap for translation links, plus occur command

* packages/org-translate/org-translate.el (ogt-link-keymap): Keymap
active on trans: type links.
(ogt-term-occur): Command to show all occurances of a translation
term in the buffer. Doesn't actually work (doesn't display anything)
but we'll figure that out.
---
 packages/org-translate/org-translate.el | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/packages/org-translate/org-translate.el 
b/packages/org-translate/org-translate.el
index b12bc40..e6ba42f 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -290,10 +290,16 @@ fragilely, and deleted and re-set with abandon.")
 (defvar-local ogt-source-segment-overlay nil
   "Overlay on the current source segment.")
 
+(defvar ogt-link-keymap
+  (let ((map (make-sparse-keymap)))
+(define-key map (kbd "o") #'ogt-term-occur)
+map)
+  "Keymap active on \"trans:\" type Org links.")
+
 (org-link-set-parameters
  "trans"
  :follow #'ogt-follow-link
- ;; Give it a :keymap!  Very nice.
+ :keymap ogt-link-keymap
  :export #'ogt-export-link)
 
 (defun ogt-follow-link (link)
@@ -409,6 +415,16 @@ By default, just remove it."
   (replace-regexp-in-string
(string ogt-segmentation-character) "" body-string))
 
+(defun ogt-term-occur ()
+  "Run `occur' for the glossary term at point.
+Available on \"trans:\" type links that represent glossary
+terms."
+  (interactive)
+  (let ((id (org-element-property :path (org-element-context
+;; I thought I should use `org-occur', but that only seems to work
+;; correctly in the sparse tree context.
+(occur (concat "trans:" id
+
 (defun ogt-prettify-segmenters (&optional begin end)
   "Add a display face to all segmentation characters.
 If BEGIN and END are given, prettify segmenters between those