[elpa] externals/osc 48d043e: Fix precision of osc-read-timetag

2021-03-31 Thread Mario Lang
branch: externals/osc
commit 48d043e96006e3c0d84848ab506e5590ef8e42a3
Author: Mario Lang 
Commit: Mario Lang 

Fix precision of osc-read-timetag
---
 osc.el | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/osc.el b/osc.el
index daa0421..f676554 100644
--- a/osc.el
+++ b/osc.el
@@ -95,8 +95,7 @@
 (defun osc-timetag (time)
   (cl-multiple-value-bind (high low usec psec) (time-convert time 'list)
 (concat (osc-int32 (+ 2208988800 (ash high 16) low))
-   (osc-int32 (round (* (+ (* usec (expt 10.0 -6))
-   (* psec (expt 10.0 -12)))
+   (osc-int32 (round (* (+ (* usec 1e-06) (* psec 1e-12))
 (1- (ash 1 32
 
 ;;;###autoload
@@ -141,6 +140,21 @@ string to a vector if embedding in another OSC message is 
what you want."
   "Send an OSC message from PROCESS to the specified PATH with ARGS."
   (process-send-string process (apply #'osc-make-message path args)))
 
+(defconst osc-bundle-tag (osc-string "#bundle"))
+(defconst osc-timetag-now (concat (osc-int32 0) (osc-int32 1)))
+
+(defun osc-make-bundle (time &rest messages)
+  "Make a bundle with timetag TIME and MESSAGES as payload."
+  (apply #'concat osc-bundle-tag (if time (osc-timetag time) osc-timetag-now)
+(mapcar (lambda (message)
+  (concat (osc-int32 (length message)) message))
+messages)))
+
+;;;###autoload
+(defun osc-send-bundle (process time &rest messages)
+  "Send a bundle to PROCESS with timetag TIME and MESSAGES as payload."
+  (process-send-string process (apply #'osc-make-bundle path args)))
+
 (defun osc-read-string ()
   (let ((pos (point)) string)
 (while (not (= (following-char) 0)) (forward-char 1))
@@ -208,10 +222,8 @@ string to a vector if embedding in another OSC message is 
what you want."
 (1+ (/ f (expt 2.0 52
 
 (defun osc-read-timetag ()
-  (let ((secs (osc-read-int32))
-   (frac (osc-read-int32)))
-(time-convert (+ (- secs 2208988800)
-(/ (float frac) (1- (ash 1 32)))
+  (time-add (time-convert (- (osc-read-int32) 2208988800))
+   (time-convert (cons (osc-read-int32) (ash 1 32)
 
 (defun osc-server-set-handler (server path handler)
   "Set HANDLER for PATH on SERVER.



[elpa] externals/osc 07783f6: Fix osc-send-bundle

2021-03-31 Thread Mario Lang
branch: externals/osc
commit 07783f6677ec5f0623c99580cbfdd21e1d44f099
Author: Mario Lang 
Commit: Mario Lang 

Fix osc-send-bundle
---
 osc.el | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/osc.el b/osc.el
index f676554..3c8a38f 100644
--- a/osc.el
+++ b/osc.el
@@ -33,10 +33,6 @@
 ;; * `osc-server-set-handler' can be used to change handlers for particular
 ;;   OSC paths on a server process object on the fly.
 
-;; BUGS/TODO:
-;;
-;; * Timetags are not supported yet.
-
 ;; Usage:
 ;;
 ;; Client: (setq my-client (osc-make-client "127.0.0.1" 7770))
@@ -92,11 +88,22 @@
   (setq value (/ value 256)))
 (apply 'unibyte-string bytes)))
 
-(defun osc-timetag (time)
-  (cl-multiple-value-bind (high low usec psec) (time-convert time 'list)
-(concat (osc-int32 (+ 2208988800 (ash high 16) low))
-   (osc-int32 (round (* (+ (* usec 1e-06) (* psec 1e-12))
-(1- (ash 1 32
+(defconst osc-timetag-now
+  (concat (osc-int32 0) (osc-int32 1)))
+
+(defconst osc-ntp-offset
+  (round
+   (float-time (time-subtract (time-convert 0)
+ (encode-time '(0 0 0 1 1 1900 nil nil t))
+
+(defun osc-timetag (&optional time)
+  (if (not time)
+  osc-timetag-now
+(pcase (time-convert time 'list)
+  (`(,high ,low ,usec ,psec)
+   (concat (osc-int32 (+ (ash high 16) low osc-ntp-offset))
+  (osc-int32 (round (* (+ (* usec 1e-06) (* psec 1e-12))
+   (1- (ash 1 32))
 
 ;;;###autoload
 (defun osc-make-client (host port)
@@ -141,11 +148,10 @@ string to a vector if embedding in another OSC message is 
what you want."
   (process-send-string process (apply #'osc-make-message path args)))
 
 (defconst osc-bundle-tag (osc-string "#bundle"))
-(defconst osc-timetag-now (concat (osc-int32 0) (osc-int32 1)))
 
 (defun osc-make-bundle (time &rest messages)
   "Make a bundle with timetag TIME and MESSAGES as payload."
-  (apply #'concat osc-bundle-tag (if time (osc-timetag time) osc-timetag-now)
+  (apply #'concat osc-bundle-tag (osc-timetag time)
 (mapcar (lambda (message)
   (concat (osc-int32 (length message)) message))
 messages)))
@@ -153,7 +159,7 @@ string to a vector if embedding in another OSC message is 
what you want."
 ;;;###autoload
 (defun osc-send-bundle (process time &rest messages)
   "Send a bundle to PROCESS with timetag TIME and MESSAGES as payload."
-  (process-send-string process (apply #'osc-make-bundle path args)))
+  (process-send-string process (apply #'osc-make-bundle time messages)))
 
 (defun osc-read-string ()
   (let ((pos (point)) string)
@@ -222,7 +228,7 @@ string to a vector if embedding in another OSC message is 
what you want."
 (1+ (/ f (expt 2.0 52
 
 (defun osc-read-timetag ()
-  (time-add (time-convert (- (osc-read-int32) 2208988800))
+  (time-add (time-convert (- (osc-read-int32) osc-ntp-offset))
(time-convert (cons (osc-read-int32) (ash 1 32)
 
 (defun osc-server-set-handler (server path handler)



[elpa] externals/osc 9b288d5: Handle timetags in bundles

2021-03-31 Thread Mario Lang
branch: externals/osc
commit 9b288d571bc5f461263ca8ce48b462a8aac9118d
Author: Mario Lang 
Commit: Mario Lang 

Handle timetags in bundles
---
 osc.el | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/osc.el b/osc.el
index 3c8a38f..062f960 100644
--- a/osc.el
+++ b/osc.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2014-2021  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang 
-;; Version: 0.2
+;; Version: 0.3
 ;; Keywords: comm, processes, multimedia
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -228,8 +228,11 @@ string to a vector if embedding in another OSC message is 
what you want."
 (1+ (/ f (expt 2.0 52
 
 (defun osc-read-timetag ()
-  (time-add (time-convert (- (osc-read-int32) osc-ntp-offset))
-   (time-convert (cons (osc-read-int32) (ash 1 32)
+  (let ((secs (osc-read-int32)) (frac (osc-read-int32)))
+(if (and (zerop secs) (= frac 1))
+   nil ; now
+  (time-add (time-convert (- secs osc-ntp-offset))
+   (time-convert (cons frac (ash 1 32)))
 
 (defun osc-server-set-handler (server path handler)
   "Set HANDLER for PATH on SERVER.
@@ -268,12 +271,12 @@ the generic handler for SERVER."
(?i (osc-read-int32))
(?s (osc-read-string
(string-to-list (substring (osc-read-string) 1))
- (forward-char 8) ;skip 64-bit timetag
- (while (not (eobp))
-   (let ((size (osc-read-int32)))
- (osc-filter proc
- (buffer-substring
-  (point) (progn (forward-char size) (point)))
+ (let ((time (osc-read-timetag)))
+   (while (not (eobp))
+ (let* ((size (osc-read-int32))
+(data (buffer-substring
+   (point) (progn (forward-char size) (point)
+   (run-at-time time nil #'osc-filter proc data)
 
 ;;;###autoload
 (defun osc-make-server (host port default-handler)



[elpa] externals/company updated (9bc678a -> b8224f2)

2021-03-31 Thread ELPA Syncer
elpasync pushed a change to branch externals/company.

  from  9bc678a   Remove  elisp annotations when icons are used
   new  cecf554   (margin): Add tty compatible margin function
   new  5111c43   (margin): Add GUI or unicode margin function
   new  7ea8b98   (margin): Rename unicode to text in unicode-margin 
functions
   new  33db4e4   (margin): Remove propertize call in text margin function
   new  b8224f2   Merge pull request #1083 from mohkale/unicode-icons


Summary of changes:
 company.el | 46 ++
 1 file changed, 46 insertions(+)



[elpa] externals/company b8224f2 5/5: Merge pull request #1083 from mohkale/unicode-icons

2021-03-31 Thread ELPA Syncer
branch: externals/company
commit b8224f2d78de89c08b9f80b83b324701416ea3b9
Merge: 9bc678a 33db4e4
Author: Dmitry Gutov 
Commit: GitHub 

Merge pull request #1083 from mohkale/unicode-icons

(margin): Add tty compatible margin function
---
 company.el | 46 ++
 1 file changed, 46 insertions(+)

diff --git a/company.el b/company.el
index ac73a33..08d30a3 100644
--- a/company.el
+++ b/company.el
@@ -1451,6 +1451,52 @@ end of the match."
 candidate
 selected))
 
+(defvar company-text-icons-mapping
+  '((array . "Α")
+(boolean . "β")
+(class . "γ")
+(color . "Δ")
+(constant . "ε")
+(enum-member . "ζ")
+(enum . "Ζ")
+(event . "η")
+(field . "θ")
+(file . "Ɩ")
+(folder . "⍳")
+(interface . "ϰ")
+(key . "μ")
+(keyword . "ν")
+(method . "λ")
+(function . "ƒ")
+(misc . "ξ")
+(module . "Ο")
+(numeric . "π")
+(operator . "⊙")
+(parameter . "ρ")
+(property . "σ")
+(ruler . "τ")
+(snippet . "υ")
+(string . "φ")
+(struct . "Χ")
+(variable . "ѱ")))
+
+(defun company-text-icons-margin (candidate selected)
+  "Margin function which returns unicode icons."
+  (when-let ((candidate candidate)
+ (kind (company-call-backend 'kind candidate))
+ (icon (alist-get kind company-text-icons-mapping)))
+icon))
+
+(defun company-detect-icons-margin (candidate selected)
+  "Margin function which picks from vscodes icons or unicode icons
+based on `display-graphic-p'."
+  (if (display-graphic-p)
+  ;; Default to dark because who in their right mind uses light 😜
+  (cl-case (frame-parameter nil 'background-mode)
+('light (company-vscode-light-icons-margin candidate selected))
+(t (company-vscode-dark-icons-margin candidate selected)))
+(company-text-icons-margin candidate selected)))
+
 (defcustom company-format-margin-function nil
   "Function to format the margin.
 It accepts 2 params `candidate' and `selected' and can be used for



[elpa] externals/company cecf554 1/5: (margin): Add tty compatible margin function

2021-03-31 Thread ELPA Syncer
branch: externals/company
commit cecf554e7bf9e336a97c2ba3fc430e228b11737b
Author: Mohsin Kaleem 
Commit: Mohsin Kaleem 

(margin): Add tty compatible margin function

See 
[[https://github.com/company-mode/company-mode/issues/756#issuecomment-810306170][#756]].
---
 company.el | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/company.el b/company.el
index 1a915aa..c9e70ae 100644
--- a/company.el
+++ b/company.el
@@ -1448,6 +1448,45 @@ end of the match."
 candidate
 selected))
 
+(defvar company-unicode-icons-mapping
+  '((array . "Α")
+(boolean . "β")
+(class . "γ")
+(color . "Δ")
+(constant . "ε")
+(enum-member . "ζ")
+(enum . "Ζ")
+(event . "η")
+(field . "θ")
+(file . "Ɩ")
+(folder . "⍳")
+(interface . "ϰ")
+(key . "μ")
+(keyword . "ν")
+(method . "λ")
+(function . "ƒ")
+(misc . "ξ")
+(module . "Ο")
+(numeric . "π")
+(operator . "⊙")
+(parameter . "ρ")
+(property . "σ")
+(ruler . "τ")
+(snippet . "υ")
+(string . "φ")
+(struct . "Χ")
+(variable . "ѱ")))
+
+(defun company-unicode-icons-margin (candidate selected)
+  "Margin function which returns icons from vscode's light theme."
+  (when-let ((candidate candidate)
+ (kind (company-call-backend 'kind candidate))
+ (icon (alist-get kind company-unicode-icons-mapping)))
+(propertize icon
+'face (if selected
+  'company-tooltip-selection
+'company-tooltip
+
 (defcustom company-format-margin-function nil
   "Function to format the margin.
 It accepts 2 params `candidate' and `selected' and can be used for



[elpa] externals/company 7ea8b98 3/5: (margin): Rename unicode to text in unicode-margin functions

2021-03-31 Thread ELPA Syncer
branch: externals/company
commit 7ea8b98e433d16e42ecdff32e0b12642b4331154
Author: Mohsin Kaleem 
Commit: Mohsin Kaleem 

(margin): Rename unicode to text in unicode-margin functions
---
 company.el | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/company.el b/company.el
index 3f85908..2da714f 100644
--- a/company.el
+++ b/company.el
@@ -1448,7 +1448,7 @@ end of the match."
 candidate
 selected))
 
-(defvar company-unicode-icons-mapping
+(defvar company-text-icons-mapping
   '((array . "Α")
 (boolean . "β")
 (class . "γ")
@@ -1477,17 +1477,17 @@ end of the match."
 (struct . "Χ")
 (variable . "ѱ")))
 
-(defun company-unicode-icons-margin (candidate selected)
+(defun company-text-icons-margin (candidate selected)
   "Margin function which returns unicode icons."
   (when-let ((candidate candidate)
  (kind (company-call-backend 'kind candidate))
- (icon (alist-get kind company-unicode-icons-mapping)))
+ (icon (alist-get kind company-text-icons-mapping)))
 (propertize icon
 'face (if selected
   'company-tooltip-selection
 'company-tooltip
 
-(defun company-unicode-or-vscode-icons-margin (candidate selected)
+(defun company-detect-icons-margin (candidate selected)
   "Margin function which picks from vscodes icons or unicode icons
 based on `display-graphic-p'."
   (if (display-graphic-p)
@@ -1495,7 +1495,7 @@ based on `display-graphic-p'."
   (cl-case (frame-parameter nil 'background-mode)
 ('light (company-vscode-light-icons-margin candidate selected))
 (t (company-vscode-dark-icons-margin candidate selected)))
-(company-unicode-icons-margin candidate selected)))
+(company-text-icons-margin candidate selected)))
 
 (defcustom company-format-margin-function nil
   "Function to format the margin.



[elpa] externals/company 33db4e4 4/5: (margin): Remove propertize call in text margin function

2021-03-31 Thread ELPA Syncer
branch: externals/company
commit 33db4e497995691003a64a4141127bfebb790d7b
Author: Mohsin Kaleem 
Commit: Mohsin Kaleem 

(margin): Remove propertize call in text margin function
---
 company.el | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/company.el b/company.el
index 2da714f..5b75812 100644
--- a/company.el
+++ b/company.el
@@ -1482,10 +1482,7 @@ end of the match."
   (when-let ((candidate candidate)
  (kind (company-call-backend 'kind candidate))
  (icon (alist-get kind company-text-icons-mapping)))
-(propertize icon
-'face (if selected
-  'company-tooltip-selection
-'company-tooltip
+icon))
 
 (defun company-detect-icons-margin (candidate selected)
   "Margin function which picks from vscodes icons or unicode icons



[elpa] externals/company 5111c43 2/5: (margin): Add GUI or unicode margin function

2021-03-31 Thread ELPA Syncer
branch: externals/company
commit 5111c43d011689a183d85c442e47e7cbd658f30e
Author: Mohsin Kaleem 
Commit: Mohsin Kaleem 

(margin): Add GUI or unicode margin function

A margin function that switches between vscode and unicode icons based
on display-graphic-p.
---
 company.el | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/company.el b/company.el
index c9e70ae..3f85908 100644
--- a/company.el
+++ b/company.el
@@ -1478,7 +1478,7 @@ end of the match."
 (variable . "ѱ")))
 
 (defun company-unicode-icons-margin (candidate selected)
-  "Margin function which returns icons from vscode's light theme."
+  "Margin function which returns unicode icons."
   (when-let ((candidate candidate)
  (kind (company-call-backend 'kind candidate))
  (icon (alist-get kind company-unicode-icons-mapping)))
@@ -1487,6 +1487,16 @@ end of the match."
   'company-tooltip-selection
 'company-tooltip
 
+(defun company-unicode-or-vscode-icons-margin (candidate selected)
+  "Margin function which picks from vscodes icons or unicode icons
+based on `display-graphic-p'."
+  (if (display-graphic-p)
+  ;; Default to dark because who in their right mind uses light 😜
+  (cl-case (frame-parameter nil 'background-mode)
+('light (company-vscode-light-icons-margin candidate selected))
+(t (company-vscode-dark-icons-margin candidate selected)))
+(company-unicode-icons-margin candidate selected)))
+
 (defcustom company-format-margin-function nil
   "Function to format the margin.
 It accepts 2 params `candidate' and `selected' and can be used for