[elpa] externals/cape a2b5ed033c 2/2: Extend README

2022-07-02 Thread ELPA Syncer
branch: externals/cape
commit a2b5ed033ccf44d42c3062142d17c63ee5acf3f7
Author: Daniel Mendler 
Commit: Daniel Mendler 

Extend README
---
 README.org | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 3261b1aaff..fc5edd463c 100644
--- a/README.org
+++ b/README.org
@@ -250,7 +250,8 @@ personal configuration.
 
   ;; Example 3: Define a defensive Dabbrev Capf, which accepts all inputs.
   ;; If you use Corfu and `corfu-auto=t', the first candidate won't be auto
-  ;; selected! You can use this instead of `cape-dabbrev'.
+  ;; selected even if `corfu-preselect-first=t'! You can use this instead of
+  ;; `cape-dabbrev'.
   (defun my-cape-dabbrev-accept-all ()
 (cape-wrap-accept-all #'cape-dabbrev))
   (add-to-list 'completion-at-point-functions #'my-cape-dabbrev-accept-all)



[elpa] externals/cape 9fbce87783 1/2: Add Capf transformer examples

2022-07-02 Thread ELPA Syncer
branch: externals/cape
commit 9fbce877837f4f7c86a55dab279a3fce7e25e9b0
Author: Daniel Mendler 
Commit: Daniel Mendler 

Add Capf transformer examples
---
 README.org | 44 ++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index ffbbd4d444..3261b1aaff 100644
--- a/README.org
+++ b/README.org
@@ -102,7 +102,6 @@ could be upstreamed into Emacs itself.
 #+end_src
 
 * Experimental features
-
 ** Company adapter
 
 /Wrap your Company backend in a Cape and turn it into a Capf!/
@@ -219,6 +218,11 @@ achieve a similarly refreshing strategy.
 
 ** Other Capf transformers
 
+Cape provides a set of additional Capf transformation functions, which are
+mostly meant to used by experts to fine tune the Capf behavior and Capf
+interaction. These can either be used as advices (=cape-wrap-*)= or to create a
+new Capf from an existing Capf (=cape-capf-*=).
+
 - ~cape-interactive-capf~: Create a Capf which can be called interactively.
 - ~cape-wrap-accept-all~, ~cape-capf-accept-all~: Create a Capf which accepts 
every input as valid.
 - ~cape-wrap-silent~, ~cape-capf-silent~: Wrap a chatty Capf and silence it.
@@ -227,7 +231,43 @@ achieve a similarly refreshing strategy.
 - ~cape-wrap-case-fold~, ~cape-capf-case-fold~: Create a Capf which is case 
insensitive.
 - ~cape-wrap-properties~, ~cape-capf-properties~: Add completion properties to 
a Capf.
 - ~cape-wrap-predicate~, ~cape-capf-predicate~: Add candidate predicate to a 
Capf.
-- ~cape-wrap-prefix-length~, ~cape-capf-prefix-length~: Enforce a minimal 
prefix length.
+- ~cape-wrap-prefix-length~, ~cape-capf-prefix-length~: Enforce a minimal 
prefix
+  length.
+
+In the following we show a few example configurations, which have come up on 
the
+[[https://github.com/minad/cape/issues][Cape]] or 
[[https://github.com/minad/corfu/issues][Corfu issue tracker]] or the 
[[https://github.com/minad/corfu/wiki][Corfu wiki.]] I use some of these tweaks 
in my
+personal configuration.
+
+#+begin_src emacs-lisp
+  ;; Example 1: Sanitize the `pcomplete-completions-at-point' Capf.
+  ;; The Capf has undesired side effects on Emacs 28 and earlier.
+  (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
+  (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
+
+  ;; Example 2: Configure a Capf with a specific auto completion prefix length
+  (setq-local completion-at-point-functions
+  (list (cape-capf-prefix-length #'cape-dabbrev 2)))
+
+  ;; Example 3: Define a defensive Dabbrev Capf, which accepts all inputs.
+  ;; If you use Corfu and `corfu-auto=t', the first candidate won't be auto
+  ;; selected! You can use this instead of `cape-dabbrev'.
+  (defun my-cape-dabbrev-accept-all ()
+(cape-wrap-accept-all #'cape-dabbrev))
+  (add-to-list 'completion-at-point-functions #'my-cape-dabbrev-accept-all)
+
+  ;; Example 4: Define interactive Capf which can be bound to a key.
+  ;; Here we wrap the `elisp-completion-at-point' such that we can
+  ;; complete Elisp code explicitly in arbitrary buffers.
+  (global-set-key (kbd "C-c p e")
+  (cape-interactive-capf #'elisp-completion-at-point))
+
+  ;; Example 5: Ignore :keywords in Elisp completion.
+  (defun ignore-elisp-keywords (sym)
+(not (keywordp sym)))
+  (setq-local completion-at-point-functions
+  (list (cape-capf-predicate #'elisp-completion-at-point
+ #'ignore-elisp-keywords)))
+#+end_src
 
 * Contributions
 



[elpa] externals/cape updated (86a1df6cba -> a2b5ed033c)

2022-07-02 Thread ELPA Syncer
elpasync pushed a change to branch externals/cape.

  from  86a1df6cba cape-super-capf: Fix nil error (See #45)
   new  9fbce87783 Add Capf transformer examples
   new  a2b5ed033c Extend README


Summary of changes:
 README.org | 45 +++--
 1 file changed, 43 insertions(+), 2 deletions(-)



[elpa] externals/corfu 5a8c2f50a1: README: Add link

2022-07-02 Thread ELPA Syncer
branch: externals/corfu
commit 5a8c2f50a1411800d0f9f890230d76c8cefb8ce2
Author: Daniel Mendler 
Commit: Daniel Mendler 

README: Add link
---
 README.org | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 3ce3eb7656..29ffa38663 100644
--- a/README.org
+++ b/README.org
@@ -154,10 +154,11 @@ expansion. =partial-completion= is important for file 
wildcard support. Multiple
 files can be opened at once with =find-file= if you enter a wildcard. You may 
also
 give the =initials= completion style a try.
 
-See also the [[https://github.com/minad/corfu/wiki][Corfu Wiki]] for 
additional configuration tips. In particular the
-Lsp-mode configuration is documented in the wiki. For more general 
documentation
-read the chapter about completion in the 
[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Completion.html][Emacs
 manual]]. If you want to create
-your own Capfs, you can find documentation about completion in the 
[[https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion.html][Elisp
 manual]].
+See also the [[https://github.com/minad/corfu/wiki][Corfu Wiki]] and the 
[[https://github.com/minad/cape][Cape manual]] for additional Capf configuration
+tips. The Lsp-mode configuration is documented in the wiki. For more general
+documentation read the chapter about completion in the 
[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Completion.html][Emacs
 manual]]. If you want
+to create your own Capfs, you can find documentation about completion in the
+[[https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion.html][Elisp
 manual]].
 
 ** Auto completion
 



[nongnu] elpa/org-auto-tangle updated (c208036480 -> c64ca020f9)

2022-07-02 Thread ELPA Syncer
elpasync pushed a change to branch elpa/org-auto-tangle.

  from  c208036480 Update org-auto-tangle.el
   new  5b6071c564 Error while building the NonGNU ELPA tarball of 
org-auto-tangle
   new  c64ca020f9 update a major version number after a major refactor by 
seven monier


Summary of changes:
 org-auto-tangle.el | 34 +++---
 1 file changed, 19 insertions(+), 15 deletions(-)



[nongnu] elpa/org-auto-tangle c64ca020f9 2/2: update a major version number after a major refactor by seven monier

2022-07-02 Thread ELPA Syncer
branch: elpa/org-auto-tangle
commit c64ca020f99952cce9798209912a8e335900a1a4
Author: lispy-dobby 
Commit: GitHub 

update a major version number after a major refactor by seven monier
---
 org-auto-tangle.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/org-auto-tangle.el b/org-auto-tangle.el
index bf4389e8f3..37e2723f27 100644
--- a/org-auto-tangle.el
+++ b/org-auto-tangle.el
@@ -2,7 +2,7 @@
 
 ;; Author: Yilkal Argaw 
 ;; URL: https://github.com/yilkalargaw/org-auto-tangle
-;; Version: 0.4.2
+;; Version: 0.5.0
 ;; Keywords: outlines
 ;; Package-Requires: ((emacs "24.1") (async "1.9.3"))
 



[nongnu] elpa/org-auto-tangle 5b6071c564 1/2: Error while building the NonGNU ELPA tarball of org-auto-tangle

2022-07-02 Thread ELPA Syncer
branch: elpa/org-auto-tangle
commit 5b6071c5649ed648c97cd2deebf74fe633f7f0d0
Author: Stefan Monnier 
Commit: yilkalargaw 

Error while building the NonGNU ELPA tarball of org-auto-tangle

Hi,

As the `Subject:` suggests, elpa.nongnu.org encountered an error while
building the tarball, because `org-auto-tangle.el` fails to include
a valid email address to send notifications.

The patch below fixes that; it also comes with an unrelated and untested
patch for `org-auto-tangle-async` which makes it use closures rather than
quoted lambdas (prompted by a parenthesis error in the previous code,
and then I got carried away :-).

Stefan
---
 org-auto-tangle.el | 32 ++--
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/org-auto-tangle.el b/org-auto-tangle.el
index 1e004edf59..bf4389e8f3 100644
--- a/org-auto-tangle.el
+++ b/org-auto-tangle.el
@@ -1,6 +1,6 @@
 ;;; org-auto-tangle.el --- Automatically and Asynchronously tangles org files 
on save -*- lexical-binding: t; -*-
 
-;; Author: Yilkal Argaw
+;; Author: Yilkal Argaw 
 ;; URL: https://github.com/yilkalargaw/org-auto-tangle
 ;; Version: 0.4.2
 ;; Keywords: outlines
@@ -47,6 +47,7 @@
 ;;; Code:
 
 (require 'async)
+(require 'cl-lib)
 (require 'org)
 
 (defvar org-auto-tangle-default nil
@@ -77,20 +78,23 @@ for a specific file, add its full path to this list.")
   "Invoke `org-babel-tangle-file' asynchronously on FILE."
   (message "Tangling %s..." (buffer-file-name))
   (async-start
-   (let ((args (list file)))
- `(lambda ()
-(require 'org)
-(let ((start-time (current-time))
-  (non-essential t)
-  (org-confirm-babel-evaluate (not (member ,file 
',org-auto-tangle-babel-safelist)))
-  (org-src-preserve-indentation ,org-src-preserve-indentation)
-  (org-babel-pre-tangle-hook ,org-babel-pre-tangle-hook)
-  (org-babel-post-tangle-hook ,org-babel-post-tangle-hook)))
-  (apply #'org-babel-tangle-file ',args)
-  (format "%.2f" (float-time (time-since start-time))
+   (let ((preserved (mapcar (lambda (v)
+  (cons v (symbol-value v)))
+'(org-src-preserve-indentation
+  org-babel-pre-tangle-hook
+  org-babel-post-tangle-hook)))
+ (evaluate (not (member file org-auto-tangle-babel-safelist
+ (lambda ()
+   (require 'org)
+   (let ((start-time (current-time))
+ (non-essential t)
+ (org-confirm-babel-evaluate evaluate))
+ (cl-progv (mapcar #'car preserved) (mapcar #'cdr preserved)
+   (org-babel-tangle-file file))
+ (format "%.2f" (float-time (time-since start-time))
(let ((message-string (format "Tangling %S completed after" file)))
- `(lambda (tangle-time)
-(message "%s %s seconds",message-string tangle-time)
+ (lambda (tangle-time)
+   (message "%s %s seconds" message-string tangle-time)
 
 (defun org-auto-tangle-tangle-if-needed ()
   "Call org-auto-tangle-async if needed.



[elpa] externals/corfu f6fa82f6d1 1/3: Fix defcustom type

2022-07-02 Thread ELPA Syncer
branch: externals/corfu
commit f6fa82f6d132e4bf850a404557965e768b80aa21
Author: Daniel Mendler 
Commit: Daniel Mendler 

Fix defcustom type
---
 corfu.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/corfu.el b/corfu.el
index c30014fd19..499020c507 100644
--- a/corfu.el
+++ b/corfu.el
@@ -135,8 +135,8 @@ delay."
  (const :tag "Instant" t)
  (number :tag "Delay in seconds")
  (cons :tag "Two Delays"
-   (choice :tag "Initial   " number))
-   (choice :tag "Subsequent" number)))
+   (choice :tag "Initial   " number)
+   (choice :tag "Subsequent" number
 
 (defcustom corfu-margin-formatters nil
   "Registry for margin formatter functions.



[elpa] externals/corfu 09757e8548 2/3: Optimize frame redisplay when completion is restarted

2022-07-02 Thread ELPA Syncer
branch: externals/corfu
commit 09757e85489592f8bf2f9b1e8087852b528f1c5b
Author: Daniel Mendler 
Commit: Daniel Mendler 

Optimize frame redisplay when completion is restarted

By deferring the frame hiding we can reuse the frame which is still visible 
for
the subsequent completion. Before this change, the frame was made invisible 
for
a split second such that one could perceive some flickering.
---
 corfu.el | 54 --
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/corfu.el b/corfu.el
index 499020c507..94fd480774 100644
--- a/corfu.el
+++ b/corfu.el
@@ -294,6 +294,9 @@ The completion backend can override this with
 (defvar corfu--frame nil
   "Popup frame.")
 
+(defvar corfu--frame-timer nil
+  "Frame hide timer.")
+
 (defconst corfu--state-vars
   '(corfu--base
 corfu--candidates
@@ -492,21 +495,20 @@ A scroll bar is displayed from LO to LO+BAR."
 str))
 lines "\n"
 
+(defun corfu--hide-frame-deferred ()
+  "Deferred frame hiding."
+  (setq corfu--frame-timer nil)
+  (when (frame-live-p corfu--frame)
+(make-frame-invisible corfu--frame)
+(with-current-buffer (window-buffer (frame-root-window corfu--frame))
+  (let ((inhibit-modification-hooks t)
+(inhibit-read-only t))
+(erase-buffer)
+
 (defun corfu--popup-hide ()
   "Hide Corfu popup."
-  (when (frame-live-p corfu--frame)
-(run-at-time
- 0 nil
- (lambda ()
-   (when (frame-live-p corfu--frame)
- ;; Redisplay such that the input becomes immediately visible before 
the popup
- ;; hiding, which is slow (Issue #48). See also corresponding 
vertico#89.
- (redisplay)
- (make-frame-invisible corfu--frame)
- (with-current-buffer (window-buffer (frame-root-window corfu--frame))
-   (let ((inhibit-modification-hooks t)
- (inhibit-read-only t))
- (erase-buffer
+  (when (and (frame-live-p corfu--frame) (not corfu--frame-timer))
+(setq corfu--frame-timer (run-at-time 0 nil 
#'corfu--hide-frame-deferred
 
 (defun corfu--popup-support-p ()
   "Return non-nil if child frames are supported."
@@ -846,6 +848,9 @@ there hasn't been any input, then quit."
(pt (- (point) beg))
(str (buffer-substring-no-properties beg end))
(initializing (not corfu--input)))
+(when corfu--frame-timer
+  (cancel-timer corfu--frame-timer)
+  (setq corfu--frame-timer nil))
 (corfu--echo-refresh)
 (cond
  ;; XXX Guard against errors during candidate generation.
@@ -938,7 +943,8 @@ See `corfu-separator' for more details."
 (funcall completion-in-region-mode--predicate))
(corfu--update)
t)))
-  (corfu-quit)))
+  (corfu-quit))
+  (when corfu-auto (corfu--auto-post-command)))
 
 (defun corfu--goto (index)
   "Go to candidate with INDEX."
@@ -1170,10 +1176,11 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
 (define-key map (vector last-command-event) replace)
 (funcall replace)))
 
-(defun corfu--auto-complete (tick)
+(defun corfu--auto-complete-deferred (&optional tick)
   "Initiate auto completion if TICK did not change."
   (setq corfu--auto-timer nil)
-  (when (and (not completion-in-region-mode) (equal tick (corfu--auto-tick)))
+  (when (and (not completion-in-region-mode)
+ (or (not tick) (equal tick (corfu--auto-tick
 (pcase (while-no-input ;; Interruptible capf query
  (run-hook-wrapped 'completion-at-point-functions 
#'corfu--capf-wrapper))
   (`(,fun ,beg ,end ,table . ,plist)
@@ -1193,15 +1200,18 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
   (when corfu--auto-timer
 (cancel-timer corfu--auto-timer)
 (setq corfu--auto-timer nil))
-  (when (and (not defining-kbd-macro)
+  (when (and (not completion-in-region-mode)
+ (not defining-kbd-macro)
  (not buffer-read-only)
  (corfu--match-symbol-p corfu-auto-commands this-command)
  (corfu--popup-support-p))
-;; NOTE: Do not use idle timer since this leads to unacceptable slowdowns,
-;; in particular if flyspell-mode is enabled.
-(setq corfu--auto-timer
-  (run-at-time corfu-auto-delay nil
-   #'corfu--auto-complete (corfu--auto-tick)
+(if (<= corfu-auto-delay 0)
+(corfu--auto-complete-deferred)
+  ;; NOTE: Do not use idle timer since this leads to unacceptable 
slowdowns,
+  ;; in particular if flyspell-mode is enabled.
+  (setq corfu--auto-timer
+(run-at-time corfu-auto-delay nil
+ #'corfu--auto-complete-deferred 
(corfu--auto-tick))
 
 (defun corfu--auto-tick ()
   "Return the current tick/status of the buffer.



[elpa] externals/corfu updated (5a8c2f50a1 -> 12a6042bfa)

2022-07-02 Thread ELPA Syncer
elpasync pushed a change to branch externals/corfu.

  from  5a8c2f50a1 README: Add link
   new  f6fa82f6d1 Fix defcustom type
   new  09757e8548 Optimize frame redisplay when completion is restarted
   new  12a6042bfa Cleanup echo message code


Summary of changes:
 corfu.el | 78 +++-
 1 file changed, 43 insertions(+), 35 deletions(-)



[elpa] externals/corfu 12a6042bfa 3/3: Cleanup echo message code

2022-07-02 Thread ELPA Syncer
branch: externals/corfu
commit 12a6042bfaab92594c2e4b320fe690209e0e2c44
Author: Daniel Mendler 
Commit: Daniel Mendler 

Cleanup echo message code
---
 corfu.el | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/corfu.el b/corfu.el
index 94fd480774..fd5bf1d618 100644
--- a/corfu.el
+++ b/corfu.el
@@ -807,14 +807,14 @@ there hasn't been any input, then quit."
  (if (= beg end) 'after-string 'display)
  (concat corfu--base cand
 
-(defun corfu--echo-refresh ()
-  "Refresh echo message to prevent flicker during redisplay."
+(defun corfu--echo-cancel (&optional msg)
+  "Cancel echo timer and refresh MSG to prevent flicker during redisplay."
   (when corfu--echo-timer
 (cancel-timer corfu--echo-timer)
 (setq corfu--echo-timer nil))
-  (corfu--echo-show corfu--echo-message))
+  (corfu--echo-show msg))
 
-(defun corfu--echo-show (&optional msg)
+(defun corfu--echo-show (msg)
   "Show MSG in echo area."
   (when (or msg corfu--echo-message)
 (setq msg (or msg "")
@@ -834,13 +834,12 @@ there hasn't been any input, then quit."
(nth corfu--index corfu--candidates
   (if (or (eq delay t) (<= delay 0))
   (corfu--echo-show (funcall fun cand))
-(when corfu--echo-timer (cancel-timer corfu--echo-timer))
+(corfu--echo-cancel)
 (setq corfu--echo-timer
   (run-at-time delay nil
(lambda ()
- (corfu--echo-show (funcall fun cand)
-(corfu--echo-show))
-(corfu--echo-show)))
+ (corfu--echo-show (funcall fun cand))
+(corfu--echo-cancel)))
 
 (defun corfu--update ()
   "Refresh Corfu UI."
@@ -851,7 +850,7 @@ there hasn't been any input, then quit."
 (when corfu--frame-timer
   (cancel-timer corfu--frame-timer)
   (setq corfu--frame-timer nil))
-(corfu--echo-refresh)
+(corfu--echo-cancel corfu--echo-message)
 (cond
  ;; XXX Guard against errors during candidate generation.
  ;; Turn off completion immediately if there are errors
@@ -1092,8 +1091,7 @@ Quit if no candidate is selected."
   (remove-hook 'pre-command-hook #'corfu--pre-command 'local)
   (remove-hook 'post-command-hook #'corfu--post-command)
   (when corfu--preview-ov (delete-overlay corfu--preview-ov))
-  (when corfu--echo-timer (cancel-timer corfu--echo-timer))
-  (corfu--echo-show)
+  (corfu--echo-cancel)
   (accept-change-group corfu--change-group)
   (mapc #'kill-local-variable corfu--state-vars))
 



[elpa] externals/corfu 4f70a0d582: Parameter set incorrectly, Fix #63

2022-07-02 Thread ELPA Syncer
branch: externals/corfu
commit 4f70a0d5829efbdc28f2e8cc20eabcd0fd657ef0
Author: Daniel Mendler 
Commit: Daniel Mendler 

Parameter set incorrectly, Fix #63
---
 corfu.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/corfu.el b/corfu.el
index fd5bf1d618..83e7ce0cea 100644
--- a/corfu.el
+++ b/corfu.el
@@ -331,8 +331,6 @@ The completion backend can override this with
 (tool-bar-lines . 0)
 (tab-bar-lines . 0)
 (no-other-frame . t)
-(no-other-window . t)
-(no-delete-other-windows . t)
 (unsplittable . t)
 (undecorated . t)
 (cursor-type . nil)
@@ -445,6 +443,9 @@ The completion backend can override this with
 (set-frame-parameter corfu--frame 'background-color new)))
 (let ((win (frame-root-window corfu--frame)))
   (set-window-buffer win buffer)
+  ;; Disallow selection of root window (#63)
+  (set-window-parameter win 'no-delete-other-windows t)
+  (set-window-parameter win 'no-other-window t)
   ;; Mark window as dedicated to prevent frame reuse (#60)
   (set-window-dedicated-p win t))
 (set-frame-size corfu--frame width height t)



[elpa] externals/company 7ef07bd3b0 2/4: Fix defcustoms syntax

2022-07-02 Thread ELPA Syncer
branch: externals/company
commit 7ef07bd3b06d2cb27cb40c5e9532347dbda8a618
Author: YugaEgo 
Commit: YugaEgo 

Fix defcustoms syntax
---
 company.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/company.el b/company.el
index 4c58707a48..a6fa0863d0 100644
--- a/company.el
+++ b/company.el
@@ -513,7 +513,7 @@ without duplicates."
  (company-sort-by-backend-importance))
   (const :tag "Prefer case sensitive prefix"
  (company-sort-prefer-same-case-prefix))
-  (repeat :tag "User defined" (function
+  (repeat :tag "User defined" function)))
 
 (defcustom company-completion-started-hook nil
   "Hook run when company starts completing.
@@ -571,7 +571,7 @@ this."
   :type '(choice (const :tag "Off" nil)
  (function :tag "Predicate function")
  (const :tag "On, if user interaction took place"
-'company-explicit-action-p)
+company-explicit-action-p)
  (const :tag "On" t)))
 
 (define-obsolete-variable-alias
@@ -594,7 +594,7 @@ triggers."
   :type '(choice (const :tag "Off" nil)
  (function :tag "Predicate function")
  (const :tag "On, if user interaction took place"
-'company-explicit-action-p)
+company-explicit-action-p)
  (const :tag "On" t))
   :package-version '(company . "0.9.14"))
 
@@ -670,7 +670,7 @@ pre-defined list.  See `company-idle-delay'.
 Alternatively, any command with a non-nil `company-begin' property is
 treated as if it was on this list."
   :type '(choice (const :tag "Any command" t)
- (const :tag "Self insert command" '(self-insert-command))
+ (const :tag "Self insert command" (self-insert-command))
  (repeat :tag "Commands" function))
   :package-version '(company . "0.8.4"))
 
@@ -1689,14 +1689,14 @@ fields without issue.
 When BG is omitted and `company-text-icons-add-background' is non-nil, a BG
 color is generated using a gradient between the active tooltip color and
 the FG color."
-  :type 'list)
+  :type '(repeat sexp))
 
 (defcustom company-text-face-extra-attributes '(:weight bold)
   "Additional attributes to add to text/dot icons faces.
 If non-nil, an anonymous face is generated.
 
 Affects `company-text-icons-margin' and `company-dot-icons-margin'."
-  :type 'list)
+  :type '(plist :tag "Face property list"))
 
 (defcustom company-text-icons-format " %s "
   "Format string for printing the text icons."



[elpa] externals/company 1490c235b9 4/4: Merge pull request #1324 from yugaego/master

2022-07-02 Thread ELPA Syncer
branch: externals/company
commit 1490c235b96acdbcc3927751473c67c1d32b2148
Merge: 4ad79cbf6b 7bd38c6938
Author: Dmitry Gutov 
Commit: GitHub 

Merge pull request #1324 from yugaego/master

CI: Run tests on latest releases
---
 .github/workflows/ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 850738abab..95d477de1f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,12 +20,12 @@ on:
 jobs:
   check:
 if: github.repository_owner == 'company-mode'
-runs-on: ubuntu-20.04
+runs-on: ubuntu-latest
 
 strategy:
   fail-fast: false
   matrix:
-emacs_version: [25.1, 25.3, 26.3, 27.2, snapshot]
+emacs_version: [25.1, 25.3, 26.3, 27.2, 28.1, snapshot]
 
 steps:
   - name: Setup Emacs



[elpa] externals/company updated (d5145006b9 -> 1490c235b9)

2022-07-02 Thread ELPA Syncer
elpasync pushed a change to branch externals/company.

  from  d5145006b9 Declare yas-prompt-functions
   new  7ef07bd3b0 Fix defcustoms syntax
   new  4ad79cbf6b Merge pull request #1325 from yugaego/fix-defcustoms
   new  7bd38c6938 CI: Run tests on latest releases
   new  1490c235b9 Merge pull request #1324 from yugaego/master


Summary of changes:
 .github/workflows/ci.yml |  4 ++--
 company.el   | 12 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)



[elpa] externals/company 7bd38c6938 1/4: CI: Run tests on latest releases

2022-07-02 Thread ELPA Syncer
branch: externals/company
commit 7bd38c6938f6d93fc091d1cef8924375df84e2f9
Author: YugaEgo 
Commit: YugaEgo 

CI: Run tests on latest releases
---
 .github/workflows/ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 850738abab..95d477de1f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,12 +20,12 @@ on:
 jobs:
   check:
 if: github.repository_owner == 'company-mode'
-runs-on: ubuntu-20.04
+runs-on: ubuntu-latest
 
 strategy:
   fail-fast: false
   matrix:
-emacs_version: [25.1, 25.3, 26.3, 27.2, snapshot]
+emacs_version: [25.1, 25.3, 26.3, 27.2, 28.1, snapshot]
 
 steps:
   - name: Setup Emacs



[elpa] externals/company 4ad79cbf6b 3/4: Merge pull request #1325 from yugaego/fix-defcustoms

2022-07-02 Thread ELPA Syncer
branch: externals/company
commit 4ad79cbf6b75bfb2e2adac4e596c7cd9e003d042
Merge: d5145006b9 7ef07bd3b0
Author: Dmitry Gutov 
Commit: GitHub 

Merge pull request #1325 from yugaego/fix-defcustoms

Fix defcustoms syntax
---
 company.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/company.el b/company.el
index 4c58707a48..a6fa0863d0 100644
--- a/company.el
+++ b/company.el
@@ -513,7 +513,7 @@ without duplicates."
  (company-sort-by-backend-importance))
   (const :tag "Prefer case sensitive prefix"
  (company-sort-prefer-same-case-prefix))
-  (repeat :tag "User defined" (function
+  (repeat :tag "User defined" function)))
 
 (defcustom company-completion-started-hook nil
   "Hook run when company starts completing.
@@ -571,7 +571,7 @@ this."
   :type '(choice (const :tag "Off" nil)
  (function :tag "Predicate function")
  (const :tag "On, if user interaction took place"
-'company-explicit-action-p)
+company-explicit-action-p)
  (const :tag "On" t)))
 
 (define-obsolete-variable-alias
@@ -594,7 +594,7 @@ triggers."
   :type '(choice (const :tag "Off" nil)
  (function :tag "Predicate function")
  (const :tag "On, if user interaction took place"
-'company-explicit-action-p)
+company-explicit-action-p)
  (const :tag "On" t))
   :package-version '(company . "0.9.14"))
 
@@ -670,7 +670,7 @@ pre-defined list.  See `company-idle-delay'.
 Alternatively, any command with a non-nil `company-begin' property is
 treated as if it was on this list."
   :type '(choice (const :tag "Any command" t)
- (const :tag "Self insert command" '(self-insert-command))
+ (const :tag "Self insert command" (self-insert-command))
  (repeat :tag "Commands" function))
   :package-version '(company . "0.8.4"))
 
@@ -1689,14 +1689,14 @@ fields without issue.
 When BG is omitted and `company-text-icons-add-background' is non-nil, a BG
 color is generated using a gradient between the active tooltip color and
 the FG color."
-  :type 'list)
+  :type '(repeat sexp))
 
 (defcustom company-text-face-extra-attributes '(:weight bold)
   "Additional attributes to add to text/dot icons faces.
 If non-nil, an anonymous face is generated.
 
 Affects `company-text-icons-margin' and `company-dot-icons-margin'."
-  :type 'list)
+  :type '(plist :tag "Face property list"))
 
 (defcustom company-text-icons-format " %s "
   "Format string for printing the text icons."



[elpa] externals/rnc-mode dfee31d832: Bump version

2022-07-02 Thread Stefan Monnier via
branch: externals/rnc-mode
commit dfee31d83208b734ed1d1fdc523565d7056db850
Author: Stefan Monnier 
Commit: Stefan Monnier 

Bump version
---
 rnc-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rnc-mode.el b/rnc-mode.el
index 33363d2057..4376a0aac8 100644
--- a/rnc-mode.el
+++ b/rnc-mode.el
@@ -4,7 +4,7 @@
 
 ;; Author: Stefan Monnier 
 ;; Keywords: xml relaxng
-;; Version: 0.2
+;; Version: 0.3
 
 ;; This file is part of GNU Emacs.
 



[elpa] externals/osm 1c5e825fbe: Disable abbrev and syntax table

2022-07-02 Thread ELPA Syncer
branch: externals/osm
commit 1c5e825fbec4c22ae3a649dec84d51803768b44a
Author: Daniel Mendler 
Commit: Daniel Mendler 

Disable abbrev and syntax table
---
 osm.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osm.el b/osm.el
index b96ac59e15..2beead74ec 100644
--- a/osm.el
+++ b/osm.el
@@ -765,7 +765,7 @@ Should be at least 7 days according to the server usage 
policies."
 
 (define-derived-mode osm-mode special-mode "Osm"
   "OpenStreetMap viewer mode."
-  :interactive nil
+  :interactive nil :abbrev-table nil :syntax-table nil
   (osm--check-libraries)
   (setq-local osm-server osm-server
   line-spacing nil



[elpa] externals/crdt updated (81b55a27b8 -> 282c48c47c)

2022-07-02 Thread ELPA Syncer
elpasync pushed a change to branch externals/crdt.

  from  81b55a27b8 Merge branch 'jimmyhmiller-master-patch-76360' into 
'master'
   new  2c68377c15 Merge branch 'master' into development
   new  1dfa6f7c30 many changes
   new  5d90bf0ce2 generate uninteresting process buffers instead
   new  1347c678c3 Use some warning instead of message
   new  d46be72920 remove base64 mangling and fix a stupid bug
   new  97427622b1 fix bug in crdt--stop-session interactive spec
   new  38fdfc5557 semver, and various fixes
   new  fae016ba25 Preliminary url support
   new  94b0c488b5 bump version number
   new  b421e4e679 Merge branch 'fix' into development
   new  3dcc9958f6 cleanup
   new  102498e84f remove tramp for now, keep it simple
   new  709059ff5e fix disconnect warn condition
   new  270a4099bb return -> cl-return
   new  10f423bbef Merge branch 'fix' into development
   new  900abacbdd Use the term "user-command-functions" instead of proxy
   new  3883736730 many changes
   new  357f4b7174 more sensible version message
   new  b222966674 fix DEL key in forms mode
   new  5e67684793 fix bug of hanging data buffer when CRDT--READ-SETTINGS 
errors
   new  e06e6e7236 add history support for CRDT-READ-SETTINGS
   new  e2b6c9ebf6 get sharing buffer from clients working
   new  932566653e TLS support by stunnel.
   new  3a78c8a615 Improve settings form when CRDT-USE-STUNNEL is nil
   new  569486e6c6 Lots of changes
   new  2bc5389ba9 add `crdt-author' to default tracked text properties
   new  28c5f6bd0e Also `crdt--refresh-users-maybe' when `crdt-stop-follow'
   new  f81f5297fa Improve naming for user and buffer list
   new  0743dd15f0 change `crdt--session-name' to `crdt--session-urlstr'
   new  6726c7f2d0 Add special cases for completions when there are 0 or 1 
candidates
   new  89e3a2699d Capitalise “Session” buffer to follow new convention
   new  9f83928758 Merge branch 'master' into development
   new  7548a9420e :name->:urlstr, and fix TLS downgrade
   new  01551d66c9 Fix default theme bug and other bugs.
   new  0a351b4ce2 Add crdt-default-tls. Don't use tls by default
   new  39c308368e Also add (kbd "d") binding for *-kill-*
   new  949f4a1afd reflect key binding addition in README.org
   new  dfc98d3525 add crdt-goto-{next,prev}-user
   new  780478a090 Fix crdt--cycle-user bug with different buffer/window
   new  df8954b9c3 feat: Option to put tuntox password in copied URL
   new  1f1e309cd7 Merge branch 'tuntox-password-in-url' into 'master'
   new  72e2b8be12 Merge branch 'master' into development
   new  dc9ec07fbd Revise README
   new  282c48c47c Revise README


Summary of changes:
 HACKING.org |  121 ++--
 README.org  |  145 +++--
 crdt.el | 1999 ++-
 3 files changed, 1434 insertions(+), 831 deletions(-)



[elpa] externals/crdt 10f423bbef 15/44: Merge branch 'fix' into development

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 10f423bbefd175f12fddf96b753101f0560fb469
Merge: 3dcc9958f6 270a4099bb
Author: Qiantan Hong 
Commit: Qiantan Hong 

Merge branch 'fix' into development
---
 crdt.el | 45 -
 1 file changed, 12 insertions(+), 33 deletions(-)

diff --git a/crdt.el b/crdt.el
index 317f9c6420..11994aed9c 100644
--- a/crdt.el
+++ b/crdt.el
@@ -35,7 +35,6 @@
 (require 'url)
 (require 'color)
 (require 'forms)
-(require 'tramp)
 
 (defconst crdt-version "0.3.0")
 (defconst crdt-protocol-version "0.3.0")
@@ -54,6 +53,10 @@
   "Default display name."
   :type 'string)
 
+(defcustom crdt-default-session-name (format "%s_session" (user-login-name))
+  "Default session name."
+  :type 'string)
+
 (defcustom crdt-confirm-disconnect t
   "Ask for confirmation when a CRDT server is to stop the connection from some 
client."
   :type 'boolean)
@@ -546,7 +549,7 @@ after synchronization is completed."
  (with-current-buffer crdt-buffer
,@body)
(unless (process-contact (crdt--session-network-process crdt--session) 
:server)
- (setq crdt-buffer (create-file-buffer (concat (crdt--tramp-prefix 
crdt--session) ,name)))
+ (setq crdt-buffer (generate-new-buffer (format "%s<%s>" ,name 
(crdt--session-name crdt--session
  (puthash ,name crdt-buffer (crdt--session-buffer-table crdt--session))
  (let ((session crdt--session))
(with-current-buffer crdt-buffer
@@ -1917,7 +1920,12 @@ of the current buffer."
  (when (and crdt-mode crdt--session)
(error "Current buffer is already shared in a CRDT session"))
  (list (let* ((session-names (crdt--get-session-names t))
-  (default-name (concat crdt-default-name ":" (buffer-name 
(current-buffer
+  (default-name (if (member crdt-default-session-name 
session-names)
+(cl-loop for i from 1
+  for name = (concat 
crdt-default-session-name "_" (number-to-string i))
+  unless (member name session-names)
+  do (cl-return name))
+crdt-default-session-name))
   (session-name (if session-names
 (completing-read "Choose a server session 
(create if not exist): "
  session-names)
@@ -2027,7 +2035,7 @@ Setup up the server with PASSWORD and assign this Emacs 
DISPLAY-NAME."
 (kill-buffer process-buffer))
   (when (and proxy-process (process-live-p proxy-process))
 (interrupt-process proxy-process)))
-(unless (memq last-command '(crdt-disconnect crdt-stop-session))
+(unless (memq this-command '(crdt-disconnect crdt-stop-session 
crdt--stop-session))
   (warn "CRDT session %s disconnected." (crdt--session-name session)
 
 (defun crdt-stop-session (&optional session)
@@ -2785,35 +2793,6 @@ Use CRDT--UNINSTALL-PROCESS-ADVICES to disable those 
advices for the rescue."
   (crdt--with-buffer-name buffer-name
 (process-send-string (get-buffer-process (current-buffer)) string)))
 
-;;; URL and TRAMP
-
-(defsubst tramp-crdt-file-name-p (filename)
-  "Check if it's a FILENAME for crdt.el."
-  (and (tramp-tramp-file-p filename)
-   (string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
"crdt")))
-
-(defconst tramp-crdt-file-name-handler-alist '()
-  "Alist of handler functions for Tramp crdt.el method.
-Operations not mentioned here will be handled by the default Emacs 
primitives.")
-
-(defun tramp-crdt-file-name-handler (operation &rest args)
-  "Invoke the crdt.el handler for OPERATION and ARGS.
-First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION."
-  (if-let ((fn (assoc operation tramp-crdt-file-name-handler-alist)))
-  (save-match-data (apply (cdr fn) args))
-(tramp-run-real-handler operation args)))
-
-(tramp-register-foreign-file-name-handler #'tramp-crdt-file-name-p 
#'tramp-crdt-file-name-handler)
-(add-to-list 'tramp-methods '("crdt"))
-
-(defun crdt--tramp-prefix (session)
-  "Compute TRAMP filename prefix for SESSION."
-  (let ((contact (process-contact (crdt--session-network-process session
-(let ((ipv6-p (string-match-p ":" (car contact ;; poor man's ipv6 test
-  (concat "/crdt:" (when ipv6-p "[") (car contact) (when ipv6-p "]")
-  (if (= (cadr contact) 6530) nil (format "#%s" (cdr contact))) 
":/"
-
 ;;; Built-in package integrations
 
  Org



[elpa] externals/crdt 5d90bf0ce2 03/44: generate uninteresting process buffers instead

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 5d90bf0ce2c74a6a548465d275df70b409258a46
Author: Qiantan Hong 
Commit: Qiantan Hong 

generate uninteresting process buffers instead
---
 crdt.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crdt.el b/crdt.el
index 3ad436ca47..55dd1ec726 100644
--- a/crdt.el
+++ b/crdt.el
@@ -1690,7 +1690,7 @@ CRDT--PROCESS should be bound to The network process for 
the client connection."
 Handle received STRING from PROCESS."
   (unless (and (process-buffer process)
(buffer-live-p (process-buffer process)))
-(set-process-buffer process (generate-new-buffer "*crdt-server*"))
+(set-process-buffer process (generate-new-buffer " *crdt-server*"))
 (with-current-buffer (process-buffer process)
   (set-marker (process-mark process) 1)))
   (with-current-buffer (process-buffer process)
@@ -1989,7 +1989,7 @@ Join with DISPLAY-NAME."
 (cl-macrolet ((start-session (&body body)
 `(let* ((network-process (make-network-process
   :name "CRDT Client"
-  :buffer (generate-new-buffer 
"*crdt-client*")
+  :buffer (generate-new-buffer " 
*crdt-client*")
   :host address
   :service port
   :filter #'crdt--network-filter



[elpa] externals/crdt b421e4e679 10/44: Merge branch 'fix' into development

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit b421e4e679740f85d7a6497c5f57a9ba315001c6
Merge: 1dfa6f7c30 94b0c488b5
Author: Qiantan Hong 
Commit: Qiantan Hong 

Merge branch 'fix' into development
---
 HACKING.org |   2 +-
 crdt.el | 281 ++--
 2 files changed, 162 insertions(+), 121 deletions(-)

diff --git a/HACKING.org b/HACKING.org
index 4d55d201c5..4f19ff9ed0 100644
--- a/HACKING.org
+++ b/HACKING.org
@@ -72,7 +72,7 @@ Every message takes the form =(type . body)=
   - Login
 + hello ::
   This message is sent from client to server, when a client connect to the 
server.
-  body takes the form =(client-name &optional response)=
+  body takes the form =(client-name protocol-version &optional response)=
 
 + leave ::
   This message is sometime sent from client to server to indicate 
disconnection, 
diff --git a/crdt.el b/crdt.el
index 2a4a8e2df1..5e91c9a3fb 100644
--- a/crdt.el
+++ b/crdt.el
@@ -35,6 +35,15 @@
 (require 'url)
 (require 'color)
 (require 'forms)
+(require 'tramp)
+
+(defconst crdt-version "0.3.0")
+(defconst crdt-protocol-version "0.3.0")
+
+(defun crdt-version ()
+  "Show the crdt.el version."
+  (interactive)
+  (message crdt-version))
 
 (defgroup crdt nil
   "Collaborative editing using Conflict-free Replicated Data Types."
@@ -104,8 +113,7 @@
   "Move pseudo marked region overlay OV to mark between POS and MARK."
   (move-overlay ov (min pos mark) (max pos mark)))
 
-
-;; CRDT ID utils
+;;; CRDT ID utils
 ;; CRDT IDs are represented by unibyte strings (for efficient comparison)
 ;; Every two bytes represent a big endian encoded integer
 ;; For base IDs, last two bytes are always representing site ID
@@ -484,16 +492,13 @@ NAME is included in the report."
   `(condition-case err
(progn ,@ body)
  (error
-  (ding)
-  (message "Error happens inside %s. This should never happen, please file 
a report to crdt.el maintainers." ',name)
-  (message " Error: %s" err)
+  (warn "CRDT mode exited in buffer %s because of error %s inside %s."
+(current-buffer) err ',name)
   (if (crdt--server-p)
-  (progn
-(message "Stop sharing the buffer because of error.")
-(crdt-stop-share-buffer))
-(progn
-  (message "Killing the buffer because of error.")
-  (kill-buffer))
+  (crdt-stop-share-buffer)
+(remhash crdt--buffer-network-name (crdt--session-buffer-table 
crdt--session))
+(crdt--refresh-buffers-maybe)
+(crdt-mode -1)
 
 (defun crdt--recover (&optional err)
   "Try to recover from a synchronization failure.
@@ -541,7 +546,7 @@ after synchronization is completed."
  (with-current-buffer crdt-buffer
,@body)
(unless (process-contact (crdt--session-network-process crdt--session) 
:server)
- (setq crdt-buffer (generate-new-buffer (format "crdt - %s" ,name)))
+ (setq crdt-buffer (create-file-buffer (concat (crdt--tramp-prefix 
crdt--session) ,name)))
  (puthash ,name crdt-buffer (crdt--session-buffer-table crdt--session))
  (let ((session crdt--session))
(with-current-buffer crdt-buffer
@@ -923,10 +928,6 @@ It informs other peers that the buffer is killed."
 
 ;;; CRDT insert/delete
 
-(defsubst crdt--base64-encode-maybe (str)
-  "Base64 encode STR if it's a string, or return NIL if STR is NIL."
-  (when str (base64-encode-string str)))
-
 (defsubst crdt--text-property-assimilate
 (template template-beg template-end beg prop &optional object)
   "Make PROP after BEG in OBJECT the same as part of TEMPLATE.
@@ -962,7 +963,7 @@ Returns a list of (insert type) messages to be sent."
   (crdt--with-insertion-information (beg end)
 (unless (crdt--split-maybe)
  (when (and not-begin
- (eq (crdt--id-site starting-id) crdt--site-id)
+ (eq (crdt--id-site starting-id) (crdt--session-local-id 
crdt--session))
  (crdt--end-of-block-p left-pos))
 ;; merge crdt id block
 (let* ((max-offset crdt--max-value)
@@ -972,7 +973,7 @@ Returns a list of (insert type) messages to be sent."
 (let ((virtual-id (substring starting-id)))
  (crdt--set-id-offset virtual-id (1+ left-offset))
  (push `(insert ,crdt--buffer-network-name ,user-id
- ,(base64-encode-string virtual-id) ,beg
+ ,virtual-id ,beg
  ,(crdt--buffer-substring beg merge-end))
 resulting-commands))
 (cl-incf left-offset (- merge-end beg))
@@ -982,10 +983,10 @@ Returns a list of (insert type) messages to be sent."
 (let* ((ending-id (if not-end (crdt--get-starting-id end) ""))
(new-id (crdt--generate-id starting-id left-offset
   endi

[elpa] externals/crdt 270a4099bb 14/44: return -> cl-return

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 270a4099bba87036da8ebe6d400baa101e9224a2
Author: Qiantan Hong 
Commit: Qiantan Hong 

return -> cl-return
---
 crdt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crdt.el b/crdt.el
index a7b8c65532..e8a9278983 100644
--- a/crdt.el
+++ b/crdt.el
@@ -1829,7 +1829,7 @@ of the current buffer."
 (cl-loop for i from 1
   for name = (concat 
crdt-default-session-name "_" (number-to-string i))
   unless (member name session-names)
-  do (return name))
+  do (cl-return name))
 crdt-default-session-name))
   (session-name (if session-names
 (completing-read "Choose a server session 
(create if not exist): "



[elpa] externals/crdt 102498e84f 12/44: remove tramp for now, keep it simple

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 102498e84f928ec9041682d832f6b42091417a98
Author: Qiantan Hong 
Commit: Qiantan Hong 

remove tramp for now, keep it simple
---
 crdt.el | 43 +++
 1 file changed, 11 insertions(+), 32 deletions(-)

diff --git a/crdt.el b/crdt.el
index 8c60f8ef51..58b9c89464 100644
--- a/crdt.el
+++ b/crdt.el
@@ -34,7 +34,6 @@
 (require 'cl-lib)
 (require 'url)
 (require 'color)
-(require 'tramp)
 
 (defconst crdt-version "0.2.5")
 (defconst crdt-protocol-version "0.2.5")
@@ -57,6 +56,10 @@
   "Default display name."
   :type 'string)
 
+(defcustom crdt-default-session-name (format "%s_session" (user-login-name))
+  "Default session name."
+  :type 'string)
+
 (defcustom crdt-ask-for-password t
   "Ask for server password everytime a CRDT server is to be started."
   :type 'boolean)
@@ -548,7 +551,7 @@ after synchronization is completed."
  (with-current-buffer crdt-buffer
,@body)
(unless (process-contact (crdt--session-network-process crdt--session) 
:server)
- (setq crdt-buffer (create-file-buffer (concat (crdt--tramp-prefix 
crdt--session) ,name)))
+ (setq crdt-buffer (generate-new-buffer (format "%s<%s>" ,name 
(crdt--session-name crdt--session
  (puthash ,name crdt-buffer (crdt--session-buffer-table crdt--session))
  (let ((session crdt--session))
(with-current-buffer crdt-buffer
@@ -1822,7 +1825,12 @@ of the current buffer."
  (when (and crdt-mode crdt--session)
(error "Current buffer is already shared in a CRDT session"))
  (list (let* ((session-names (crdt--get-session-names t))
-  (default-name (concat crdt-default-name ":" (buffer-name 
(current-buffer
+  (default-name (if (member crdt-default-session-name 
session-names)
+(cl-loop for i from 1
+  for name = (concat 
crdt-default-session-name "_" (number-to-string i))
+  unless (member name session-names)
+  do (return name))
+crdt-default-session-name))
   (session-name (if session-names
 (completing-read "Choose a server session 
(create if not exist): "
  session-names)
@@ -2672,35 +2680,6 @@ Use CRDT--UNINSTALL-PROCESS-ADVICES to disable those 
advices for the rescue."
   (crdt--with-buffer-name buffer-name
 (process-send-string (get-buffer-process (current-buffer)) string)))
 
-;;; URL and TRAMP
-
-(defsubst tramp-crdt-file-name-p (filename)
-  "Check if it's a FILENAME for crdt.el."
-  (and (tramp-tramp-file-p filename)
-   (string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
"crdt")))
-
-(defconst tramp-crdt-file-name-handler-alist '()
-  "Alist of handler functions for Tramp crdt.el method.
-Operations not mentioned here will be handled by the default Emacs 
primitives.")
-
-(defun tramp-crdt-file-name-handler (operation &rest args)
-  "Invoke the crdt.el handler for OPERATION and ARGS.
-First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION."
-  (if-let ((fn (assoc operation tramp-crdt-file-name-handler-alist)))
-  (save-match-data (apply (cdr fn) args))
-(tramp-run-real-handler operation args)))
-
-(tramp-register-foreign-file-name-handler #'tramp-crdt-file-name-p 
#'tramp-crdt-file-name-handler)
-(add-to-list 'tramp-methods '("crdt"))
-
-(defun crdt--tramp-prefix (session)
-  "Compute TRAMP filename prefix for SESSION."
-  (let ((contact (process-contact (crdt--session-network-process session
-(let ((ipv6-p (string-match-p ":" (car contact ;; poor man's ipv6 test
-  (concat "/crdt:" (when ipv6-p "[") (car contact) (when ipv6-p "]")
-  (if (= (cadr contact) 6530) nil (format "#%s" (cdr contact))) 
":/"
-
 ;;; Built-in package integrations
 
 ;; Org



[elpa] externals/crdt 2c68377c15 01/44: Merge branch 'master' into development

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 2c68377c152f12c9d59ad765415bc1a09c434b70
Merge: af43adb8e0 d5fd2bf976
Author: Qiantan Hong 
Commit: Qiantan Hong 

Merge branch 'master' into development
---
 crdt.el | 363 +---
 1 file changed, 208 insertions(+), 155 deletions(-)

diff --git a/crdt.el b/crdt.el
index 27a4259d28..6bb5a06aae 100644
--- a/crdt.el
+++ b/crdt.el
@@ -291,7 +291,7 @@ Must be used inside CRDT--WITH-INSERTION-INFORMATION."
   network-process
   network-clients
   next-client-id
-  buffer-table
+  buffer-table ; maps buffer network name to buffer
   follow-site-id)
 
 (defvar crdt--inhibit-update nil "When set, don't call CRDT--LOCAL-* on change.
@@ -463,6 +463,14 @@ Also set CRDT--PSEUDO-CURSOR-TABLE to NIL."
 
 (define-error 'crdt-sync-error "CRDT synchronization error")
 
+(defsubst crdt--server-p (&optional session)
+  "Tell if SESSION is running as a server.
+If SESSION is nil, use current CRDT--SESSION."
+  (process-contact
+   (crdt--session-network-process
+(or session crdt--session))
+   :server))
+
 (defmacro crdt--with-recover (&rest body)
   "When any error in BODY occur, signal a CRDT-SYNC-ERROR instead.
 This will hopefully trigger error recovery mechanism when further unwinding 
the stack."
@@ -505,14 +513,6 @@ If we are the server, ERR is the error we shall report to 
client."
 
 ;;; Shared buffer utils
 
-(defsubst crdt--server-p (&optional session)
-  "Tell if SESSION is running as a server.
-If SESSION is nil, use current CRDT--SESSION."
-  (process-contact
-   (crdt--session-network-process
-(or session crdt--session))
-   :server))
-
 (defmacro crdt--with-buffer-name (name &rest body)
   "Find CRDT shared buffer associated with NAME and evaluate BODY in it.
 Any narrowing is temporarily disabled during evaluation of BODY.
@@ -560,22 +560,61 @@ after synchronization is completed."
 
 ;;; Session menu
 
-(defun crdt--session-menu-goto ()
-  "Open the buffer menu for the session under point in CRDT session menu."
-  (interactive)
-  (let ((crdt--session (tabulated-list-get-id)))
-(crdt-list-buffers)))
+(defsubst crdt--get-session-names (server)
+  "Get session names for CRDT sessions (as in CRDT--SESSION-LIST).
+If SERVER is non-NIL, return the list of names for server sessions.
+Otherwise, return the list of names for client sessions."
+  (let (session-names)
+(dolist (session crdt--session-list)
+  (when (eq (crdt--server-p session) server)
+(push (crdt--session-name session) session-names)))
+(nreverse session-names)))
 
-(defun crdt--session-menu-kill ()
-  "Kill the session under point in CRDT session menu."
-  (interactive)
-  (crdt--stop-session (tabulated-list-get-id)))
+(defsubst crdt--get-session (name)
+  "Get the CRDT session object with NAME."
+  (cl-find name crdt--session-list
+   :test 'equal :key #'crdt--session-name))
+
+(defun crdt--read-session (&optional filter)
+  "Prompt for a session name and return the corresponding session.
+FILTER can be nil, 'server or 'client."
+  (crdt--get-session
+   (completing-read (format "Choose a%s session: "
+(cl-ecase filter
+  ((server) " server")
+  ((client) " client")
+  ((nil) "")))
+(cl-ecase filter
+  ((server) (crdt--get-session-names t))
+  ((client) (crdt--get-session-names nil))
+  ((nil) (mapcar #'crdt--session-name crdt--session-list)))
+nil t
+(when (and crdt--session
+   (cl-ecase filter
+ ((server) (crdt--server-p))
+ ((client) (not (crdt--server-p)))
+ ((nil) t)))
+  (crdt--session-name crdt--session)
+
+(defun crdt--read-session-maybe (&optional filter)
+  "Prompt for a session name and return the corresponding session.
+Directly return the session name under point if in the session menu.
+FILTER can be nil, 'server or 'client."
+  (if (eq major-mode 'crdt-session-menu-mode)
+  (or (tabulated-list-get-id) (signal 'quit nil))
+(if (and crdt--session
+ (cl-ecase filter
+   ((server) (crdt--server-p))
+   ((client) (not (crdt--server-p)))
+   ((nil) t)))
+crdt--session
+  (or (crdt--read-session filter) (signal 'quit nil)
 
 (defvar crdt-session-menu-mode-map
   (let ((map (make-sparse-keymap)))
-(define-key map (kbd "RET") #'crdt--session-menu-goto)
-(define-key map [mouse-1] #'crdt--session-menu-goto)
-(define-key map (kbd "k") #'crdt--session-menu-kill)
+(define-key map (kbd "RET") #'crdt-list-buffers)
+(define-key map [mouse-1] #'crdt-list-buffers)
+(define-key map (kbd "k") #'crdt--stop-session)
 map))
 
 (define-derived-mode crdt-sessio

[elpa] externals/crdt 357f4b7174 18/44: more sensible version message

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 357f4b71749d787814e63850907aeec1babfe0c7
Author: Qiantan Hong 
Commit: Qiantan Hong 

more sensible version message
---
 crdt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crdt.el b/crdt.el
index a43bbde8a2..8421298f19 100644
--- a/crdt.el
+++ b/crdt.el
@@ -42,7 +42,7 @@
 (defun crdt-version ()
   "Show the crdt.el version."
   (interactive)
-  (message crdt-version))
+  (message "crdt.el version %s" crdt-version))
 
 (defgroup crdt nil
   "Collaborative editing using Conflict-free Replicated Data Types."



[elpa] externals/crdt 94b0c488b5 09/44: bump version number

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 94b0c488b5c56c6544d722e1dec49737cd9f01df
Author: Qiantan Hong 
Commit: Qiantan Hong 

bump version number
---
 crdt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crdt.el b/crdt.el
index b04c69c20e..8c60f8ef51 100644
--- a/crdt.el
+++ b/crdt.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Qiantan Hong 
 ;; URL: https://code.librehq.com/qhong/crdt.el
 ;; Keywords: collaboration crdt
-;; Version: 0.2.4
+;; Version: 0.2.5
 
 ;; This file is part of GNU Emacs.
 



[elpa] externals/crdt 97427622b1 06/44: fix bug in crdt--stop-session interactive spec

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 97427622b1c351aaac02c03fba7330dce294fd4c
Author: Qiantan Hong 
Commit: Qiantan Hong 

fix bug in crdt--stop-session interactive spec
---
 crdt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crdt.el b/crdt.el
index b42507905e..3c27c1ad2a 100644
--- a/crdt.el
+++ b/crdt.el
@@ -1878,7 +1878,7 @@ Setup up the server with PASSWORD and assign this Emacs 
DISPLAY-NAME."
 
 (defun crdt--stop-session (session)
   "Kill the CRDT SESSION."
-  (interactive (crdt--read-session-maybe 'server))
+  (interactive (list (crdt--read-session-maybe 'server)))
   (when (if (and crdt-confirm-disconnect
  (crdt--server-p session)
  (crdt--session-network-clients session))



[elpa] externals/crdt 1347c678c3 04/44: Use some warning instead of message

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 1347c678c3a05ce649a659d9237ffe5c05819583
Author: Qiantan Hong 
Commit: Qiantan Hong 

Use some warning instead of message
---
 crdt.el | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/crdt.el b/crdt.el
index 55dd1ec726..52c7aa7444 100644
--- a/crdt.el
+++ b/crdt.el
@@ -486,16 +486,13 @@ NAME is included in the report."
   `(condition-case err
(progn ,@ body)
  (error
-  (ding)
-  (message "Error happens inside %s. This should never happen, please file 
a report to crdt.el maintainers." ',name)
-  (message " Error: %s" err)
+  (warn "CRDT mode exited in buffer %s because of error %s inside %s."
+(current-buffer) err ',name)
   (if (crdt--server-p)
-  (progn
-(message "Stop sharing the buffer because of error.")
-(crdt-stop-share-buffer))
-(progn
-  (message "Killing the buffer because of error.")
-  (kill-buffer))
+  (crdt-stop-share-buffer)
+(remhash crdt--buffer-network-name (crdt--session-buffer-table 
crdt--session))
+(crdt--refresh-buffers-maybe)
+(crdt-mode -1)
 
 (defun crdt--recover (&optional err)
   "Try to recover from a synchronization failure.
@@ -1625,8 +1622,14 @@ CRDT--PROCESS should be bound to The network process for 
the client connection."
 (with-current-buffer buffer
   (crdt-mode 0)
   (setq crdt--session nil))
-   (message "Server stopped sharing %s."
-(mapconcat #'identity buffer-names ", "))
+(let ((notify-names
+   (cl-remove-if-not
+(lambda (buffer-name)
+  (gethash buffer-name (crdt--session-buffer-table crdt--session)))
+buffer-names)))
+  (when notify-names
+(warn "Server stopped sharing %s."
+  (mapconcat #'identity buffer-names ", "
(let ((crdt--session saved-session))
  (crdt--broadcast-maybe crdt--message-string
 (when crdt--process
@@ -1919,7 +1922,7 @@ Setup up the server with PASSWORD and assign this Emacs 
DISPLAY-NAME."
 (kill-buffer process-buffer))
   (when (and proxy-process (process-live-p proxy-process))
 (interrupt-process proxy-process)))
-(message "Disconnected.")))
+(warn "CRDT session disconnected.")))
 
 (defun crdt-stop-session (&optional session)
   "Stop sharing the SESSION.



[elpa] externals/crdt 1dfa6f7c30 02/44: many changes

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 1dfa6f7c30ac043c8066c2552f6311c912db32e0
Merge: 2c68377c15 2b0c9c0dbe
Author: Qiantan Hong 
Commit: Qiantan Hong 

many changes
---
 HACKING.org |  64 +++---
 crdt.el | 670 
 2 files changed, 447 insertions(+), 287 deletions(-)

diff --git a/HACKING.org b/HACKING.org
index 9bcd78a39f..4d55d201c5 100644
--- a/HACKING.org
+++ b/HACKING.org
@@ -6,7 +6,7 @@ This packages implements the Logoot split algorithm
 ~André, Luc, et al. "Supporting adaptable granularity of changes for 
massive-scale collaborative editing." 9th IEEE International Conference on 
Collaborative Computing: Networking, Applications and Worksharing. IEEE, 2013.~
 
 The CRDT-ID blocks are implemented by text property ='crdt-id=. 
-A continous range of text with the same ='crdt-id'= property represent a 
CRDT-ID block. 
+A continous range of text with the same ='crdt-id= property represent a 
CRDT-ID block. 
 The ='crdt-id= is a a cons of =(ID-STRING . END-OF-BLOCK-P)=, 
 where =ID-STRING= represent the CRDT-ID of the leftmost character in the block.
 If =END-OF-BLOCK-P= is =NIL=, the block is a non-rightmost segment splitted 
from a larger block,
@@ -14,20 +14,36 @@ so insertion at the right of this block shouldn't be merged 
into the block by sh
 
 =ID-STRING= is a unibyte string representing a CRDT-ID (for efficient 
comparison).
 Every two bytes represent a big endian encoded integer.
-For base IDs, last two bytes are always representing site ID.
+For base IDs, last two bytes are always representing Site ID.
 Stored strings are BASE-ID:OFFSETs. So the last two bytes represent offset,
-and second last two bytes represent site ID.
+and second last two bytes represent Site ID.
+
+* Access Control
+  
+~crdt.el~ implements a capability based access control system.
+
+Each capability is a list of the form =(type transferable-p nonce . body)=
+
+  - read :: body takes the form =(buffer-name)=
+  - write :: body takes the form =(buffer-name)=
+  - command :: body takes the form =(buffer-name command-symbol)=
++ =buffer-name= can be =t=, which means that =command-symbol= is not 
+  bound to be invoked in any specific buffer.
+  - process :: body takes the form =(buffer-name)=
 
 * Protocol
 
-  Text-based version
-  (it should be easy to migrate to a binary version.  Using text for better 
debugging for now)
+Text-based version
+(it should be easy to migrate to a binary version.  Using text for better 
debugging for now)
+
+Note: Starting from =v0.3.0=, we separate /User IDs/ and /Site IDs/. 
+Site IDs are /buffer local/ and temporarily assigned to users with writable 
access.
 
-  Every message takes the form =(type . body)=
+Every message takes the form =(type . body)=
 
   - Text Editing
 + insert ::
-  body takes the form =(buffer-name crdt-id position-hint content)=
+  body takes the form =(buffer-name user-id crdt-id position-hint content)=
   - =position-hint= is the buffer position where the operation happens at 
the site
 which generates the operation.  Then we can play the trick that start 
search
 near this position at other sites to speedup CRDT ID search
@@ -40,18 +56,18 @@ and second last two bytes represent site ID.
   - Peer State
 + cursor ::
   body takes the form
-   =(buffer-name site-id point-position-hint point-crdt-id 
mark-position-hint mark-crdt-id)=
+   =(buffer-name user-id point-position-hint point-crdt-id 
mark-position-hint mark-crdt-id)=
   =*-crdt-id= can be either a CRDT ID, or
 - =nil=, which means clear the point/mark
 - =""=, which means =(point-max)=
 
 + contact ::
   body takes the form
-   =(site-id name address port)=
-  when name is =nil=, clear the contact for this =site-id=
+   =(user-id name address port)=
+  when name is =nil=, clear the contact for this =user-id=
 
 + focus ::
-  body takes the form =(site-id buffer-name)=
+  body takes the form =(user-id buffer-name)=
 
   - Login
 + hello ::
@@ -68,8 +84,8 @@ and second last two bytes represent site ID.
 
 + login ::
   It's always sent after server receives a hello message.
-  Assigns an ID to the client
-  body takes the form =(site-id session-name)=.
+  Assigns a User ID to the client
+  body takes the form =(user-id session-name)=.
 
   - Initial Synchronization
 + sync ::
@@ -115,7 +131,7 @@ and second last two bytes represent site ID.
 + overlay-add ::
   body takes the form 
   #+BEGIN_SRC
-  (buffer-name site-id logical-clock species
+  (buffer-name user-id logical-clock species
 front-advance rear-advance
 start-position-hint start-crdt-id
 end-position-hint end-crdt-id)
@@ -124,27 +140,27 @@ and second last two bytes represent site ID.
 + overlay-move ::
   body takes the form
   #+BEGIN_SRC
-  (buffer-name site-id logical-

[elpa] externals/crdt b222966674 19/44: fix DEL key in forms mode

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit b222966674616251252834213adea01f53c8d4ca
Author: Qiantan Hong 
Commit: Qiantan Hong 

fix DEL key in forms mode
---
 crdt.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/crdt.el b/crdt.el
index 8421298f19..52e6160838 100644
--- a/crdt.el
+++ b/crdt.el
@@ -1908,6 +1908,7 @@ Current user means the user corresponding to 
CRDT--PROCESS."
   (let ((map (copy-keymap forms-mode-map)))
 (define-key map (kbd "") #'forms-next-field)
 (define-key map (kbd "") #'forms-prev-field)
+(define-key map (kbd "DEL") nil) ;; without this, DEL somehow get mapped 
to forms-prev-record
 (define-key map (kbd "RET") #'exit-recursive-edit)
 (define-key map (kbd "C-g") #'abort-recursive-edit)
 (define-key map [remap forms-next-record] 'ignore)



[elpa] externals/crdt 900abacbdd 16/44: Use the term "user-command-functions" instead of proxy

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 900abacbdd3074076b4093f96d43f220290b63f5
Author: Qiantan Hong 
Commit: Qiantan Hong 

Use the term "user-command-functions" instead of proxy
---
 crdt.el | 60 +++-
 1 file changed, 43 insertions(+), 17 deletions(-)

diff --git a/crdt.el b/crdt.el
index 11994aed9c..556e035daf 100644
--- a/crdt.el
+++ b/crdt.el
@@ -301,7 +301,7 @@ Must be used inside CRDT--WITH-INSERTION-INFORMATION."
   next-client-id
   buffer-table; maps buffer network name to buffer
   follow-user-id
-  default-proxies)
+  user-command-functions)
 
 (defvar crdt--inhibit-update nil "When set, don't call CRDT--LOCAL-* on change.
 This is useful for functions that apply remote change to local buffer,
@@ -323,10 +323,10 @@ Each element is of the form (CURSOR-OVERLAY . 
REGION-OVERLAY).")
 
 (crdt--defvar-permanent-local crdt--site-id-table nil
   "A hash table that maps USER-ID to SITE-ID. Only used by the publisher of 
the buffer.")
+(crdt--defvar-permanent-local crdt--site-id-list nil
+  "A list of all allocated SITE-ID (except 0 which is reserved for publisher), 
sorted by value.")
 (crdt--defvar-permanent-local crdt--site-id-use-list nil
   "A list of all allocated SITE-ID (except 0 which is reserved for publisher), 
sorted by recent usage.")
-(crdt--defvar-permanent-local crdt--site-id-free-list nil
-  "A list of all free SITE-ID (except 0 which is reserved for publisher).")
 (crdt--defvar-permanent-local crdt--site-id nil "My SITE-ID at this buffer.")
 
 (cl-defstruct (crdt--overlay-metadata
@@ -362,6 +362,15 @@ adding/removing actively tracked overlays.")
 (defvar-local crdt--enabled-text-properties nil
   "A list of text properties that are tracked and synchronized.")
 
+(defvar-local crdt-user-command-functions nil
+  "A list that describes policies for public buffer-local commands.
+Each element should be one of
+- a symbol, which should name a command.
+  The command is be made accessible to every user.
+- a function, which should return a list of commands when
+  called with a single argument USER-ID.
+  The returned list of commands is made accessible to the user with USER-ID.")
+
 ;;; Global variables
 
 (defvar crdt--session-list nil)
@@ -1780,16 +1789,24 @@ Handle received STRING from PROCESS."
 ;;; Capabilities
 
 (defun crdt-request-site-id ()
-  (let ((new-site-id
- (if crdt--site-id-free-list
- (pop crdt--site-id-free-list)
-   (let* ((cons (last crdt--site-id-use-list 2))
-  (victim-id (cadr cons)))
- ;; todo: notify the victim
- (rplacd cons nil)
- victim-id
+  (let (new-site-id)
+(cl-loop
+  for i in crdt--site-id-list
+  for c on crdt--site-id-list
+  for j in (cdr crdt--site-id-list)
+  if (> j (1+ i))
+  do (progn
+   (setq new-site-id (1+ i))
+   (push (1+ i) (cdr c))
+   (cl-return)))
+(unless new-site-id
+  (let* ((cons (last crdt--site-id-use-list 2))
+ (victim-id (cadr cons)))
+;; todo: notify the victim
+(rplacd cons nil)
+(setq new-site-id victim-id)))
 (push new-site-id crdt--site-id-use-list)
-(pushash crdt--user-id new-site-id crdt--site-id-table)
+(puthash crdt--user-id new-site-id crdt--site-id-table)
 new-site-id))
 
 ;;; UI commands
@@ -1938,7 +1955,7 @@ of the current buffer."
  (apply #'crdt-new-session
 (crdt--read-settings
  (format "*Settings for %s*" session-name)
- `(("Port: " (number-to-string port) 
,(crdt--settings-make-ensure-type 'numberp))
+ `(("Port: " (number-to-string ,port) 
,(crdt--settings-make-ensure-type 'numberp))
("Session Name: " ,session-name 
,(crdt--settings-make-ensure-nonempty session-name))
("Password: " "")
("Display Name: " ,crdt-default-name
@@ -1957,9 +1974,18 @@ of the current buffer."
 (message "Not a CRDT shared buffer.")))
 
 (defun crdt-new-session
-(port session-name password display-name default-proxies)
-  "Start a new CRDT session on PORT with SESSION-NAME and DEFAULT-PROXIES.
-Setup up the server with PASSWORD and assign this Emacs DISPLAY-NAME."
+(port session-name password display-name user-command-functions)
+  "Start a new CRDT session on PORT with SESSION-NAME.
+Setup up the server with PASSWORD and assign this Emacs DISPLAY-NAME.
+USER-COMMAND-FUNCTIONS is a list that describes policies
+for public session-scoped commands.
+Each element should be one of
+- a symbol, which should name a command.
+  The command is be made accessible to every user, in every buffer.
+- a function, which should return a list of commands when
+  called with two arguments USER-ID and BUFFER.
+  The returned list of commands is made accessible
+  to the user with USER-ID in BUFFER."
   (let* ((networ

[elpa] externals/crdt d46be72920 05/44: remove base64 mangling and fix a stupid bug

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit d46be72920ffe9c33ac941e4023fadaa4c399b75
Author: Qiantan Hong 
Commit: Qiantan Hong 

remove base64 mangling and fix a stupid bug

IDK why base64 was there.
stupid bug: typo overlay-mode should be overlay-move
---
 crdt.el | 77 -
 1 file changed, 33 insertions(+), 44 deletions(-)

diff --git a/crdt.el b/crdt.el
index 52c7aa7444..b42507905e 100644
--- a/crdt.el
+++ b/crdt.el
@@ -924,10 +924,6 @@ It informs other peers that the buffer is killed."
 
 ;;; CRDT insert/delete
 
-(defsubst crdt--base64-encode-maybe (str)
-  "Base64 encode STR if it's a string, or return NIL if STR is NIL."
-  (when str (base64-encode-string str)))
-
 (defsubst crdt--text-property-assimilate
 (template template-beg template-end beg prop &optional object)
   "Make PROP after BEG in OBJECT the same as part of TEMPLATE.
@@ -971,7 +967,7 @@ Returns a list of (insert type) messages to be sent."
   (let ((virtual-id (substring starting-id)))
(crdt--set-id-offset virtual-id (1+ left-offset))
(push `(insert ,crdt--buffer-network-name
-   ,(base64-encode-string virtual-id) ,beg
+   ,virtual-id ,beg
,(crdt--buffer-substring beg merge-end))
   resulting-commands))
   (cl-incf left-offset (- merge-end beg))
@@ -984,7 +980,7 @@ Returns a list of (insert type) messages to be sent."
 (crdt--session-local-id 
crdt--session
 (put-text-property beg block-end 'crdt-id (cons new-id t))
 (push `(insert ,crdt--buffer-network-name
-   ,(base64-encode-string new-id) ,beg
+   ,new-id ,beg
,(crdt--buffer-substring beg block-end))
   resulting-commands)
 (setq beg block-end)
@@ -1250,10 +1246,8 @@ Always return a message otherwise."
   (setq crdt--last-mark mark)
   (save-restriction
 (widen)
-(let ((point-id-base64 (base64-encode-string (crdt--get-id point)))
-  (mark-id-base64 (when mark (base64-encode-string (crdt--get-id 
mark)
-  `(cursor ,crdt--buffer-network-name ,(crdt--session-local-id 
crdt--session)
-   ,point ,point-id-base64 ,mark ,mark-id-base64))
+`(cursor ,crdt--buffer-network-name ,(crdt--session-local-id 
crdt--session)
+ ,point ,(crdt--get-id point) ,mark ,(when mark (crdt--get-id 
mark)))
 
 (defun crdt--post-command ()
   "Post command hook used by CRDT-MODE.
@@ -1277,8 +1271,8 @@ Send message to other peers about any changes."
 
 (defun crdt--dump-ids (beg end object &optional omit-end-of-block-p 
include-content)
   "Serialize all CRDT IDs in OBJECT from BEG to END into a list.
-The list contains CONSes of the form (LENGTH CRDT-ID-BASE64 END-OF-BLOCK-P),
-or (LENGTH CRDT-ID-BASE64) if OMIT-END-OF-BLOCK-P is non-NIL,
+The list contains CONSes of the form (LENGTH CRDT-ID END-OF-BLOCK-P),
+or (LENGTH CRDT-ID) if OMIT-END-OF-BLOCK-P is non-NIL,
 in the order that they appears in the document.
 If INCLUDE-CONTENT is non-NIL, the list contains STRING instead of LENGTH."
   (let (ids (pos end))
@@ -1293,8 +1287,7 @@ If INCLUDE-CONTENT is non-NIL, the list contains STRING 
instead of LENGTH."
 (t (substring object prev-pos pos)))
 (- pos prev-pos))
   (cl-destructuring-bind (id . eob) 
(crdt--get-crdt-id-pair prev-pos object)
-(let ((id-base64 (base64-encode-string id)))
-  (if omit-end-of-block-p (list id-base64) (list 
id-base64 eob)
+(if omit-end-of-block-p (list id) (list id eob
 ids))
 (setq pos prev-pos)))
 ids))
@@ -1304,9 +1297,8 @@ If INCLUDE-CONTENT is non-NIL, the list contains STRING 
instead of LENGTH."
 into current buffer."
   (goto-char (point-min))
   (dolist (id-item ids)
-(cl-destructuring-bind (content id-base64 eob) id-item
-  (insert (propertize content 'crdt-id
-  (cons (base64-decode-string id-base64) eob))
+(cl-destructuring-bind (content id eob) id-item
+  (insert (propertize content 'crdt-id (cons id eob))
 
 (defun crdt--verify-buffer ()
   "Debug helper function.
@@ -1432,11 +1424,11 @@ The overlay is FRONT-ADVANCE and REAR-ADVANCE, and lies 
between BEG and END."
   `(overlay-add ,crdt--buffer-network-name ,id ,clock
 ,species ,front-advance ,rear-advance
 ,beg ,(if front-advance
-  (base64-encode-string (crdt--get-id beg))
-(crdt--base64-encode-maybe (crdt--get-id (1- beg
+  (crdt--get-id beg)
+(crdt--get-id (1- beg

[elpa] externals/crdt 3dcc9958f6 11/44: cleanup

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 3dcc9958f69ff83803c51e85e2d19b688d112caa
Author: Qiantan Hong 
Commit: Qiantan Hong 

cleanup
---
 crdt.el | 23 +--
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/crdt.el b/crdt.el
index 5e91c9a3fb..317f9c6420 100644
--- a/crdt.el
+++ b/crdt.el
@@ -1789,24 +1789,6 @@ Handle received STRING from PROCESS."
 (pushash crdt--user-id new-site-id crdt--site-id-table)
 new-site-id))
 
-(defun crdt-proxy-ambient-read (message)
-  (memq (car message) '(get)))
-
-(defun crdt-proxy-ambient-overlay (message)
-  (memq (car message) '(overlay-add overlay-move overlay-remove overlay-put)))
-
-(defun crdt-proxy-ambient-write (message)
-  (memq (car message) '(insert delete)))
-
-(defun crdt-proxy-ambient-remote-command (message)
-  (memq (car message) '(command)))
-
-(defun crdt-proxy-ambient-variable (message)
-  (memq (car message) '(var)))
-
-(defun crdt-proxy-ambient-process (message)
-  (memq (car message) '(process process-mark)))
-
 ;;; UI commands
 
 (defvar crdt--ephemeral-advices nil)
@@ -1951,10 +1933,7 @@ of the current buffer."
  `(("Port: " (number-to-string port) 
,(crdt--settings-make-ensure-type 'numberp))
("Session Name: " ,session-name 
,(crdt--settings-make-ensure-nonempty session-name))
("Password: " "")
-   ("Display Name: " ,crdt-default-name)
-   ("Default Proxies: "
-"(crdt-proxy-ambient-read crdt-proxy-ambient-write 
crdt-proxy-ambient-remote-command)"
-,(crdt--settings-make-ensure-type 'listp)
+   ("Display Name: " ,crdt-default-name
 
 (cl-defun crdt-stop-share-buffer (&optional (session crdt--session)
  (network-name crdt--buffer-network-name))



[elpa] externals/crdt fae016ba25 08/44: Preliminary url support

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit fae016ba25b9118eed12183a4e705a2b938b9e5a
Author: Qiantan Hong 
Commit: Qiantan Hong 

Preliminary url support
---
 crdt.el | 45 +++--
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/crdt.el b/crdt.el
index 9878786a71..b04c69c20e 100644
--- a/crdt.el
+++ b/crdt.el
@@ -34,6 +34,7 @@
 (require 'cl-lib)
 (require 'url)
 (require 'color)
+(require 'tramp)
 
 (defconst crdt-version "0.2.5")
 (defconst crdt-protocol-version "0.2.5")
@@ -547,7 +548,7 @@ after synchronization is completed."
  (with-current-buffer crdt-buffer
,@body)
(unless (process-contact (crdt--session-network-process crdt--session) 
:server)
- (setq crdt-buffer (generate-new-buffer (format "crdt - %s" ,name)))
+ (setq crdt-buffer (create-file-buffer (concat (crdt--tramp-prefix 
crdt--session) ,name)))
  (puthash ,name crdt-buffer (crdt--session-buffer-table crdt--session))
  (let ((session crdt--session))
(with-current-buffer crdt-buffer
@@ -1942,17 +1943,12 @@ If SESSION is nil, stop sharing the current session."
(list (crdt--read-session-maybe 'server)))
   (crdt--stop-session (or session crdt--session)))
 
-(defun crdt-copy-url (&optional session-name)
-  "Copy the url for the session with SESSION-NAME.
+(defun crdt-copy-url (&optional session)
+  "Copy the url for the SESSION.
 Currently this only work if a tuntox proxy is used."
   (interactive
-   (list (completing-read "Choose a server session: "
-  (crdt--get-session-names t) nil t
-  (when (and crdt--session (crdt--server-p))
-(crdt--session-name crdt--session)
-  (let* ((session (if session-name
- (crdt--get-session session-name)
-crdt--session))
+   (list (crdt--read-session-maybe 'server)))
+  (let* ((session (or session crdt--session))
  (network-process (crdt--session-network-process session))
  (tuntox-process (process-get network-process 'tuntox-process)))
 (if tuntox-process
@@ -2676,6 +2672,35 @@ Use CRDT--UNINSTALL-PROCESS-ADVICES to disable those 
advices for the rescue."
   (crdt--with-buffer-name buffer-name
 (process-send-string (get-buffer-process (current-buffer)) string)))
 
+;;; URL and TRAMP
+
+(defsubst tramp-crdt-file-name-p (filename)
+  "Check if it's a FILENAME for crdt.el."
+  (and (tramp-tramp-file-p filename)
+   (string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
"crdt")))
+
+(defconst tramp-crdt-file-name-handler-alist '()
+  "Alist of handler functions for Tramp crdt.el method.
+Operations not mentioned here will be handled by the default Emacs 
primitives.")
+
+(defun tramp-crdt-file-name-handler (operation &rest args)
+  "Invoke the crdt.el handler for OPERATION and ARGS.
+First arg specifies the OPERATION, second arg is a list of arguments to
+pass to the OPERATION."
+  (if-let ((fn (assoc operation tramp-crdt-file-name-handler-alist)))
+  (save-match-data (apply (cdr fn) args))
+(tramp-run-real-handler operation args)))
+
+(tramp-register-foreign-file-name-handler #'tramp-crdt-file-name-p 
#'tramp-crdt-file-name-handler)
+(add-to-list 'tramp-methods '("crdt"))
+
+(defun crdt--tramp-prefix (session)
+  "Compute TRAMP filename prefix for SESSION."
+  (let ((contact (process-contact (crdt--session-network-process session
+(let ((ipv6-p (string-match-p ":" (car contact ;; poor man's ipv6 test
+  (concat "/crdt:" (when ipv6-p "[") (car contact) (when ipv6-p "]")
+  (if (= (cadr contact) 6530) nil (format "#%s" (cdr contact))) 
":/"
+
 ;;; Built-in package integrations
 
 ;; Org



[elpa] externals/crdt 569486e6c6 25/44: Lots of changes

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 569486e6c60ea2d71783aa53f213c7950d57de80
Author: Qiantan Hong 
Commit: Qiantan Hong 

Lots of changes

** DONE Track authorship in-buffer via properties
   ~crdt-visualize-author-mode~ UI
** DONE Make interactive changes to crdt-version and crdt-connect
** DONE Stop leaking ip address
** DONE Investigate why xref-find-definitions causes error
** DONE Figure out the code for colouring selection colours from
   ‘default’s :background

- gracefully degrade when TLS handshake fail (I hope it works)
- remove session name settings
---
 HACKING.org |  32 +++--
 crdt.el | 407 +++-
 2 files changed, 228 insertions(+), 211 deletions(-)

diff --git a/HACKING.org b/HACKING.org
index b593ec0d01..3313573ac9 100644
--- a/HACKING.org
+++ b/HACKING.org
@@ -42,31 +42,32 @@ Every message takes the form =(type . body)=
   body takes the form =(buffer-name user-id position-hint . crdt-id-list)=
   - =crdt-id-list= is generated from =CRDT--DUMP-IDS= from the deleted text
 
-  - Peer State
 + cursor ::
   body takes the form
=(buffer-name user-id point-position-hint point-crdt-id 
mark-position-hint mark-crdt-id)=
   =*-crdt-id= can be either a CRDT ID, or
   - =nil=, which means clear the point/mark
   - =""=, which means =(point-max)=
+  
+  - Contact information
 
 + contact ::
-  body takes the form
-   =(user-id name address port)=
-  when name is =nil=, clear the contact for this =user-id=
+  body takes the form =(user-id slot value)=
+  - =slot= can be one of
+#+BEGIN_SRC emacs-lisp
+  name host service focus
+#+END_SRC
 
-+ focus ::
-  body takes the form =(user-id buffer-name)=
++ leave ::
+  body takes the form =(user-id)=
+  
+  This message is sometime sent from client to server to indicate 
disconnection, 
+  if the underlying proxy doesn't indicate disconnection properly.
 
   - Login
 + hello ::
   This message is sent from client to server, when a client connect to the 
server.
-  body takes the form =(client-name protocol-version &optional response)=
-
-+ leave ::
-  This message is sometime sent from client to server to indicate 
disconnection, 
-  if the underlying proxy doesn't handle it properly.
-  body takes the form =()=
+  body takes the form =(protocol-version &optional response)=
 
 + challenge ::
   body takes the form =(salt)=
@@ -74,7 +75,7 @@ Every message takes the form =(type . body)=
 + login ::
   It's always sent after server receives a hello message.
   Assigns a User ID to the client
-  body takes the form =(user-id session-name)=.
+  body takes the form =(user-id)=.
 
   - Initial Synchronization
 + sync ::
@@ -332,15 +333,12 @@ Q: What if Emacs GCs?
 - =nil=, which means clear the point/mark
 
 + contact :: same as primary protocol.
-
-+ focus :: same as primary protocol.
++ leave :: same as primary protocol.
 
   - Login
 Note that we don't include challenge/response authentication mecahnism.
 
 + hello :: same as primary protocol.
-+ leave :: same as primary protocol.
-
 + login :: same as primary protocol.
 
   - Initial Synchronization
diff --git a/crdt.el b/crdt.el
index 639d4b8d81..6b5800bdac 100644
--- a/crdt.el
+++ b/crdt.el
@@ -35,14 +35,18 @@
 (require 'url)
 (require 'color)
 (require 'forms)
+(require 'nadvice)
+(require 'gnutls)
 
 (defconst crdt-version "0.3.0")
 (defconst crdt-protocol-version "0.3.0")
 
-(defun crdt-version ()
+(defun crdt-version (&optional message)
   "Show the crdt.el version."
-  (interactive)
-  (message "crdt.el version %s" crdt-version))
+  (interactive (list t))
+  (if message
+  (message "crdt.el version %s" crdt-version)
+crdt-version))
 
 (defgroup crdt nil
   "Collaborative editing using Conflict-free Replicated Data Types."
@@ -53,10 +57,6 @@
   "Default display name."
   :type 'string)
 
-(defcustom crdt-default-session-name (format "%s_session" (user-login-name))
-  "Default session name."
-  :type 'string)
-
 (defcustom crdt-confirm-disconnect t
   "Ask for confirmation when a CRDT server is to stop the connection from some 
client."
   :type 'boolean)
@@ -81,14 +81,12 @@
   :type 'file)
 
 (defcustom crdt-tls-certificate
-  (concat (file-name-as-directory (if (featurep 'xdg) (xdg-data-home) "~/"))
-  "crdt-tls.pem")
+  (concat user-emacs-directory "crdt-tls.pem")
   "Path to TLS certificate file used for TLS-secured server."
   :type 'file)
 
 (defcustom crdt-tls-private-key
-  (concat (file-name-as-directory (if (featurep 'xdg) (xdg-data-home) "~/"))
-  "crdt-tls-key.pem")
+  (concat user-emacs-directory "crdt-tls.pem")
   "Path to TLS private key file used for TLS-secured server."
   :type 'file)
 
@@ -117,25 +115,31 @@ See `crdt-new-session'.'"
   "Override local

[elpa] externals/crdt 38fdfc5557 07/44: semver, and various fixes

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 38fdfc55575f906fcf1f0a8eb9180bce2cd79d17
Author: Qiantan Hong 
Commit: Qiantan Hong 

semver, and various fixes
---
 HACKING.org |  2 +-
 crdt.el | 50 +-
 2 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/HACKING.org b/HACKING.org
index 9bcd78a39f..af7c2031dc 100644
--- a/HACKING.org
+++ b/HACKING.org
@@ -56,7 +56,7 @@ and second last two bytes represent site ID.
   - Login
 + hello ::
   This message is sent from client to server, when a client connect to the 
server.
-  body takes the form =(client-name &optional response)=
+  body takes the form =(client-name protocol-version &optional response)=
 
 + leave ::
   This message is sometime sent from client to server to indicate 
disconnection, 
diff --git a/crdt.el b/crdt.el
index 3c27c1ad2a..9878786a71 100644
--- a/crdt.el
+++ b/crdt.el
@@ -35,6 +35,14 @@
 (require 'url)
 (require 'color)
 
+(defconst crdt-version "0.2.5")
+(defconst crdt-protocol-version "0.2.5")
+
+(defun crdt-version ()
+  "Show the crdt.el version."
+  (interactive)
+  (message crdt-version))
+
 (defgroup crdt nil
   "Collaborative editing using Conflict-free Replicated Data Types."
   :prefix "crdt-"
@@ -111,8 +119,7 @@
   "Move pseudo marked region overlay OV to mark between POS and MARK."
   (move-overlay ov (min pos mark) (max pos mark)))
 
-
-;; CRDT ID utils
+;;; CRDT ID utils
 ;; CRDT IDs are represented by unibyte strings (for efficient comparison)
 ;; Every two bytes represent a big endian encoded integer
 ;; For base IDs, last two bytes are always representing site ID
@@ -1591,9 +1598,19 @@ CRDT--PROCESS should be bound to The network process for 
the client connection."
 
 (define-crdt-message-handler error (buffer-name &rest err)
   (unless (crdt--server-p)
-(crdt--with-buffer-name buffer-name
-  (message "Server side error %s." err)
-  (crdt--recover
+(if buffer-name
+(crdt--with-buffer-name buffer-name
+  (message "Server side error %s." err)
+  (crdt--recover))
+  (cl-block nil
+(message "Server side error %s." err)
+(when (eq (car err) 'version)
+  (if (version< crdt-protocol-version (cadr err))
+  (warn "Server uses newer crdt.el protocol (%s>%s). Please update 
your crdt.el to connect."
+(cadr err) crdt-protocol-version)
+(warn "Server uses older crdt.el protocol (%s<%s). Please ask to 
update server."
+  (cadr err) crdt-protocol-version)))
+(crdt-disconnect)
 
 (define-crdt-message-handler add (&rest buffer-names)
   (dolist (buffer-name buffer-names)
@@ -1645,7 +1662,7 @@ CRDT--PROCESS should be bound to The network process for 
the client connection."
  (process-contact (crdt--session-network-process 
crdt--session) :host)
  (process-contact (crdt--session-network-process 
crdt--session) :service)
   (crdt--broadcast-maybe (crdt--format-message
-  `(hello ,(crdt--session-local-name crdt--session)
+  `(hello ,(crdt--session-local-name 
crdt--session) ,crdt-protocol-version
   ,(gnutls-hash-mac 'SHA1 password 
hash)))
 
 (define-crdt-message-handler contact (site-id display-name &optional host 
service)
@@ -1707,7 +1724,11 @@ Handle received STRING from PROCESS."
 (crdt-process-message message string))
 (cl-block nil
   (when (eq (car message) 'hello)
-(cl-destructuring-bind (name &optional response) (cdr 
message)
+(cl-destructuring-bind (name protocol-version &optional 
response) (cdr message)
+  (when (version< protocol-version crdt-protocol-version)
+(process-send-string process
+ (crdt--format-message `(error nil 
version ,crdt-protocol-version)))
+(cl-return))
   (when (or (not (process-get process 'password)) ; server 
password is empty
 (and response (string-equal response 
(process-get process 'challenge
 (process-put process 'authenticated t)
@@ -1719,7 +1740,7 @@ Handle received STRING from PROCESS."
  (gnutls-hash-mac 'SHA1 (substring 
(process-get process 'password)) challenge))
 (process-send-string process (crdt--format-message 
`(challenge ,challenge))
 ((crdt-unrecognized-message invalid-read-syntax)
- (message "%s error when processing message %s from %s:%s, 
disconnecting." err message
+ (warn "%s error when processing message %s from %s:%s, 
disconnecting." err message
   (process-contact process :host) (process-contact process 
:servic

[elpa] externals/crdt 6726c7f2d0 30/44: Add special cases for completions when there are 0 or 1 candidates

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 6726c7f2d07092b04964bb13b1cf4bb5c8ce29b9
Author: Qiantan Hong 
Commit: Qiantan Hong 

Add special cases for completions when there are 0 or 1 candidates
---
 crdt.el | 56 
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/crdt.el b/crdt.el
index 31bb761cf1..c3aea42877 100644
--- a/crdt.el
+++ b/crdt.el
@@ -688,26 +688,35 @@ Otherwise, return the list of names for client sessions."
   (cl-find name crdt--session-list
:test 'equal :key #'crdt--session-urlstr))
 
+(defsubst crdt--completing-read (prompt collection &optional initial-input)
+  "Like (completing-read PROMPT COLLECTION nil t INITIAL-INPUT).
+Do better when there are 0 or 1 candidates."
+  (if collection
+  (if (cdr collection)
+  (completing-read prompt collection nil t initial-input)
+(car collection))
+(signal 'quit "No candidates")))
+
 (defun crdt--read-session (&optional filter)
   "Prompt for a session name and return the corresponding session.
 FILTER can be nil, 'server or 'client."
   (crdt--get-session
-   (completing-read (format "Choose a%s session: "
-(cl-ecase filter
-  ((server) " server")
-  ((client) " client")
-  ((nil) "")))
-(cl-ecase filter
-  ((server) (crdt--get-session-names t))
-  ((client) (crdt--get-session-names nil))
-  ((nil) (mapcar #'crdt--session-urlstr 
crdt--session-list)))
-nil t
-(when (and crdt--session
-   (cl-ecase filter
- ((server) (crdt--server-p))
- ((client) (not (crdt--server-p)))
- ((nil) t)))
-  (crdt--session-urlstr crdt--session)
+   (crdt--completing-read
+(format "Choose a%s session: "
+(cl-ecase filter
+  ((server) " server")
+  ((client) " client")
+  ((nil) "")))
+(cl-ecase filter
+  ((server) (crdt--get-session-names t))
+  ((client) (crdt--get-session-names nil))
+  ((nil) (mapcar #'crdt--session-urlstr crdt--session-list)))
+(when (and crdt--session
+   (cl-ecase filter
+ ((server) (crdt--server-p))
+ ((client) (not (crdt--server-p)))
+ ((nil) t)))
+  (crdt--session-urlstr crdt--session)
 
 (defun crdt--read-session-maybe (&optional filter)
   "Prompt for a session name and return the corresponding session.
@@ -782,12 +791,12 @@ If DISPLAY-BUFFER is provided, display the output there."
 
 (defun crdt--read-buffer (session)
   "Prompt for a buffer network name in SESSION."
-  (completing-read "Choose a buffer: "
-   (hash-table-keys (crdt--session-buffer-table session))
-   nil t
-   (when (and (eq crdt--session session)
-  crdt--buffer-network-name)
- crdt--buffer-network-name)))
+  (crdt--completing-read
+   "Choose a buffer: "
+   (hash-table-keys (crdt--session-buffer-table session))
+   (when (and (eq crdt--session session)
+  crdt--buffer-network-name)
+ crdt--buffer-network-name)))
 
 (defun crdt--read-buffer-maybe (session)
   "Prompt for a buffer network name in SESSION.
@@ -876,8 +885,7 @@ Directly return the buffer network name under point if in 
the buffer menu."
(push (format "%s %s" k (crdt--contact-metadata-name v)) candidates))
  (crdt--session-contact-table session))
 (let ((name
-   (completing-read "Choose a user: "
-candidates nil t)))
+   (crdt--completing-read "Choose a user: " candidates)))
   (string-to-number (car (split-string name))
 
 (defun crdt--read-user-maybe (session)



[elpa] externals/crdt 5e67684793 20/44: fix bug of hanging data buffer when CRDT--READ-SETTINGS errors

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 5e67684793e92730ade3933b4a830050ccd21782
Author: Qiantan Hong 
Commit: Qiantan Hong 

fix bug of hanging data buffer when CRDT--READ-SETTINGS errors
---
 crdt.el | 85 ++---
 1 file changed, 44 insertions(+), 41 deletions(-)

diff --git a/crdt.el b/crdt.el
index 52e6160838..8c9ef77a7c 100644
--- a/crdt.el
+++ b/crdt.el
@@ -1923,49 +1923,52 @@ Current user means the user corresponding to 
CRDT--PROCESS."
 (defun crdt--read-settings (buffer-name settings-list)
   (with-current-buffer (get-buffer-create buffer-name)
 (let ((enable-local-eval t)
-  (data-buffer (get-buffer-create (concat " " buffer-name
-  (let ((standard-output (current-buffer)))
-(prin1
- `(setq forms-file t
-forms-number-of-fields ,(length settings-list)
-forms-format-list
-'(,(let ((overriding-local-map crdt-read-settings-map))
- (substitute-command-keys
-  (concat "\\[forms-next-field]:Next Field, 
\\[forms-prev-field]:Prev Field\n"
-  "\\[exit-recursive-edit]:OK, 
\\[abort-recursive-edit]:Cancel\n")))
-  ,@(cl-loop for i from 1
-  for entry in settings-list
-  nconc (list (car entry) i "\n"))
-  (crdt--call-with-ephemeral-advice
-   'forms--help 'ignore
-   (lambda ()
- (crdt--call-with-ephemeral-advice
-  'find-file-noselect
-  (lambda (orig-func file)
-(if (eq file t)
-(with-current-buffer data-buffer
-  (cl-loop for entry in settings-list
-do (insert (cadr entry))
-do (insert "\t"))
-  (backward-delete-char 1)
-  (current-buffer))
-  (funcall orig-func file)))
-  #'forms-mode)))
+  (data-buffer (generate-new-buffer (concat " " buffer-name
   (unwind-protect
(progn
- (use-local-map crdt-read-settings-map)
- (display-buffer (current-buffer)
- '(display-buffer-below-selected
-   (window-height . fit-window-to-buffer)))
- (select-window (get-buffer-window (current-buffer)))
- (recursive-edit)
- (forms--update)
- (cl-mapcar (lambda (entry data)
-  (funcall (or (caddr entry) #'identity) data))
-settings-list forms--the-record-list))
-(forms-exit-no-save)
-(unless (< (length (window-list)) 2)
-  (delete-window (get-buffer-window (current-buffer
+ (let ((standard-output (current-buffer)))
+   (prin1
+`(setq forms-file t
+   forms-number-of-fields ,(length settings-list)
+   forms-format-list
+   '(,(let ((overriding-local-map crdt-read-settings-map))
+(substitute-command-keys
+ (concat "\\[forms-next-field]:Next Field, 
\\[forms-prev-field]:Prev Field\n"
+ "\\[exit-recursive-edit]:OK, 
\\[abort-recursive-edit]:Cancel\n")))
+ ,@(cl-loop for i from 1
+ for entry in settings-list
+ nconc (list (car entry) i "\n"))
+ (crdt--call-with-ephemeral-advice
+  'forms--help 'ignore
+  (lambda ()
+(crdt--call-with-ephemeral-advice
+ 'find-file-noselect
+ (lambda (orig-func file)
+   (if (eq file t)
+   (with-current-buffer data-buffer
+ (cl-loop for entry in settings-list
+   do (insert (cadr entry))
+   do (insert "\t"))
+ (backward-delete-char 1)
+ (current-buffer))
+ (funcall orig-func file)))
+ #'forms-mode)))
+ (unwind-protect
+  (progn
+(use-local-map crdt-read-settings-map)
+(display-buffer (current-buffer)
+'(display-buffer-below-selected
+  (window-height . fit-window-to-buffer)))
+(select-window (get-buffer-window (current-buffer)))
+(recursive-edit)
+(forms--update)
+(cl-mapcar (lambda (entry data)
+ (funcall (or (caddr entry) #'identity) data))
+   settings-list forms--the-record-list))
+   (forms-exit-no-save)
+   (unless (< (length (window-list)) 2)
+ (del

[elpa] externals/crdt 9f83928758 32/44: Merge branch 'master' into development

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 9f839287583fe8422a6bf113f6de41a63ecaa00a
Merge: 89e3a2699d 81b55a27b8
Author: Qiantan Hong 
Commit: Qiantan Hong 

Merge branch 'master' into development
---
 README.org | 93 +-
 crdt.el| 19 +++--
 2 files changed, 61 insertions(+), 51 deletions(-)

diff --git a/README.org b/README.org
index 0a3d68100d..639e4a83ee 100644
--- a/README.org
+++ b/README.org
@@ -16,6 +16,13 @@ Highlights:
 
 ~crdt.el~ is now on GNU ELPA! Just =M-x package-install crdt=.
 
+*Caution!!!* Please make sure that you and your peers are on the same 
~crdt.el~ version!
+It turns out to be one of the most common causes of ~crdt.el~ not working.
+Because currently the network protocol is not stablized, behavior when using 
mismatched versions is unexpectable.
+- Strictly speaking, it should works when =crdt-protocol-version= are defined 
and the same on all peers.
+  But why not save some hassle and keep everyone on the latest version.
+- To upgrade, just =M-x package-reinstall crdt=, then preferably restart Emacs.
+
 ** Start a shared session
 
 A shared session is a place that can contains multiple buffers (or files),
@@ -33,49 +40,6 @@ optional password and your display name (default to your 
current =(user-full-nam
 ** Join a session
 
 =M-x crdt-connect=, then enter address, port, and your display name.
-
-** What if we don't have a public IP?
-
-There're various workaround.
-
-- You can use [[https://gitlab.com/gjedeer/tuntox][tuntox]] to proxy your 
connection over the [[https://tox.chat][Tox]] protocol.
-  =crdt.el= has experimental built-in integration for =tuntox=.
-  To enable it, you need to install =tuntox=,
-  set up the custom variable =crdt-tuntox-executable= accordingly (the path to 
your =tuntox= binary),
-  and set the custom variable =crdt-use-tuntox=. 
-  Setting it to =t= make =crdt.el= always create =tuntox= proxy for new server 
sessions, 
-  and setting it to ='confirm= make =crdt.el= ask you every time when creating 
new sessions.
-  After starting a session with =tuntox= proxy,
-  you can =M-x crdt-copy-url= to copy a URL recognizable by =M-x crdt-connect= 
and share it to your friends.
-  Be aware that according to my experience, =tuntox= takes significant time to 
establish a connection (sometimes up to half a minute),
-  however it gets much faster after the connection is established.
-
-- You can use Teredo to get a public routable IPv6 address. 
-  One free software implementation is Miredo. Get it from your
-  favorite package manager or from [[https://www.remlab.net/miredo/][their 
website]].
-  A typical usage is (run as root)
-  #+BEGIN_SRC
-# /usr/local/sbin/miredo
-# ifconfig teredo
-  #+END_SRC
-  The =ifconfig= command should print the information of your IPv6 address.
-  Now your traffic go through IPv6, and once you start a =crdt.el= session,
-  your friends should be able to join using the IPv6 address.
-  For more information, see the user guide on the Miredo website.
-
-- You can use SSH port forwarding if you have a VPS with public IP.
-  Example usage:
-  #+BEGIN_SRC 
-$ ssh -R EXAMPLE.COM:6530:127.0.0.1:6530 EXAMPLE.COM
-  #+END_SRC
-  This make your =crdt.el= session on local port =6530= accessible from
-  =EXAMPLE.COM:6530=.
-  
-  Note that you need to set the following =/etc/ssh/sshd_config= option on 
-  your VPS
-  #+BEGIN_SRC 
-GatewayPorts yes
-  #+END_SRC
   
 ** List active users
 
@@ -125,3 +89,46 @@ Just go ahead and share you comint REPL buffer! Tested: 
~shell~ and ~cmuscheme~.
 By default, when sharing a comint buffer, ~crdt.el~ temporarily reset input 
history (as in =M-n= =M-p=)
 so others don't spy into your =.bash_history= and alike.
 You can customize this behavior using variable 
=crdt-comint-share-input-history=.
+
+** What if we don't have a public IP?
+
+There're various workaround.
+
+- You can use [[https://gitlab.com/gjedeer/tuntox][tuntox]] to proxy your 
connection over the [[https://tox.chat][Tox]] protocol.
+  =crdt.el= has experimental built-in integration for =tuntox=.
+  To enable it, you need to install =tuntox=,
+  set up the custom variable =crdt-tuntox-executable= accordingly (the path to 
your =tuntox= binary),
+  and set the custom variable =crdt-use-tuntox=. 
+  Setting it to =t= make =crdt.el= always create =tuntox= proxy for new server 
sessions, 
+  and setting it to ='confirm= make =crdt.el= ask you every time when creating 
new sessions.
+  After starting a session with =tuntox= proxy,
+  you can =M-x crdt-copy-url= to copy a URL recognizable by =M-x crdt-connect= 
and share it to your friends.
+  Be aware that according to my experience, =tuntox= takes significant time to 
establish a connection (sometimes up to half a minute),
+  however it gets much faster after the connection is established.
+
+- You can use Teredo to get a public routable IPv6 address. 
+  One free software implementation is Miredo. Get it from your
+  favorite package

[elpa] externals/crdt 7548a9420e 33/44: :name->:urlstr, and fix TLS downgrade

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 7548a9420ee7597778c437aaabe1046ecef42551
Author: Qiantan Hong 
Commit: Qiantan Hong 

:name->:urlstr, and fix TLS downgrade
---
 crdt.el | 87 -
 1 file changed, 48 insertions(+), 39 deletions(-)

diff --git a/crdt.el b/crdt.el
index 2adc2485a3..72a17d221a 100644
--- a/crdt.el
+++ b/crdt.el
@@ -350,6 +350,8 @@ Must be used inside CRDT--WITH-INSERTION-INFORMATION."
   ;; itself before it gets its user-id. It should be remapped to
   ;; the right key as soon as client knows its user-id
   urlstr
+  roger-p ;; set to t when network filter hear any data
+  ;; to indicate that TLS handshake (if any) must have completed
   user-menu-buffer
   buffer-menu-buffer
   network-process
@@ -1921,6 +1923,8 @@ Handle received STRING from PROCESS."
   (with-current-buffer (process-buffer process)
 (unless crdt--session
   (setq crdt--session (process-get process 'crdt-session)))
+(when (> (length string) 0)
+  (setf (crdt--session-roger-p crdt--session) t))
 (save-excursion
   (goto-char (process-mark process))
   (insert string)
@@ -1984,16 +1988,16 @@ Handle received STRING from PROCESS."
 (defun crdt--client-process-sentinel (process _message)
   (unless (eq (process-status process) 'open)
 (let ((session (process-get process 'crdt-session)))
-  (if session
-  (progn
-(when (process-get process 'tuntox-process)
-  (process-send-string
-   process
-   (crdt--format-message `(leave ,(crdt--session-local-id 
session)
-(ding)
-(crdt--stop-session session))
-;; This should only happens when we are in the middle of TLS handshake
-(signal 'file-error "Failed to establish TLS connection.")
+  (when session
+(if (and (not (crdt--session-roger-p session))
+ (process-get proc 'crdt--downgrade-continuation))
+;; This should only happens when we are in the middle of TLS 
handshake
+(funcall (process-get proc 'crdt--downgrade-continuation))
+  (when (process-get process 'tuntox-process)
+(process-send-string
+ process
+ (crdt--format-message `(leave ,(crdt--session-local-id 
session)
+  (crdt--stop-session session))
 
 ;;; UI commands
 
@@ -2277,7 +2281,7 @@ Each element should be one of
   :next-user-id 1
   :local-name display-name
   :host "localhost" :service port
-  :name (format "localhost:%s" port)
+  :urlstr (format "localhost:%s" port)
   :network-process network-process
   :permissions permissions))
  (tuntox-p (or (eq crdt-use-tuntox t)
@@ -2420,48 +2424,49 @@ Join with DISPLAY-NAME."
   ("eins" (setf (url-portspec url) 6540))
   ("ein" (setf (url-portspec url) 6530))
   ("tuntox" (setf (url-portspec url) 6530
-  (let ((url-type (url-type url)))
+  (let ((url-type (url-type url))
+(new-session (crdt--make-session :local-clock 0 :local-name 
display-name)))
 (cl-flet ((start-session (&rest process-args)
 (let* ((network-process (apply #'make-network-process
:name "CRDT Client"
:buffer (generate-new-buffer " 
*crdt-client*")
:filter #'crdt--network-filter
:sentinel 
#'crdt--client-process-sentinel
-   process-args))
-   (new-session
-(crdt--make-session :name (url-recreate-url url)
-:local-clock 0 :local-name 
display-name
-:network-process network-process)))
+   process-args)))
+  (setf (crdt--session-urlstr new-session) (url-recreate-url 
url)
+(crdt--session-network-process new-session) 
network-process)
   (process-put network-process 'crdt-session new-session)
-  (push new-session crdt--session-list)
   (process-send-string
network-process
(crdt--format-message
 `(hello ,crdt-protocol-version)))
-  (let ((crdt--session new-session))
-(crdt-list-buffers))
   network-process)))
   (cond ((equal url-type "ein")
  (start-session :host (url-host url) :service (url-portspec url)))
 ((equal url-type "eins")
- (condition-case c
- (let ((proc
-(start-session :host

[elpa] externals/crdt 0a351b4ce2 35/44: Add crdt-default-tls. Don't use tls by default

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 0a351b4ce2753fe0b84a7c67d5331c49864231b2
Author: Qiantan Hong 
Commit: Qiantan Hong 

Add crdt-default-tls. Don't use tls by default
---
 crdt.el | 47 ---
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/crdt.el b/crdt.el
index 00ba38162e..cd98990acf 100644
--- a/crdt.el
+++ b/crdt.el
@@ -64,6 +64,10 @@
 (defvar crdt--log-network-traffic nil
   "Debug switch to log network traffic to *Messages*.")
 
+(defvar crdt--inhibit-recover nil
+  "Debug switch to disable error recovery mechanism.
+This includes `crdt--with-recover' and `crdt--with-should-not-error'.")
+
 (defcustom crdt-tuntox-executable "tuntox"
   "Path to the tuntox binary."
   :type 'file)
@@ -90,10 +94,14 @@
   "Path to TLS private key file used for TLS-secured server."
   :type 'file)
 
-(defcustom crdt-use-stunnel t
+(defcustom crdt-use-stunnel nil
   "Start stunnel proxy for CRDT servers."
   :type '(choice boolean (const confirm)))
 
+(defcustom crdt-default-tls nil
+  "Connecting with TLS (eins) protocol by default."
+  :type 'boolean)
+
 (defcustom crdt-read-settings-help-string
   (concat "\\[forms-next-field]:Next Field, \\[forms-prev-field]:Prev Field\n"
   "\\[forms-next-record]:History Next, \\[forms-prev-record]:History 
Prev\n"
@@ -582,24 +590,28 @@ If SESSION is nil, use current CRDT--SESSION."
   "When any error in BODY occur, signal a CRDT-SYNC-ERROR instead.
 This will hopefully trigger error recovery mechanism when further unwinding 
the stack."
   (declare (indent 1) (debug (sexp def-body)))
-  `(condition-case nil
-   (progn ,@ body)
- (error (signal 'crdt-sync-error nil
+  `(if crdt--inhibit-recover
+   (progn ,@body)
+ (condition-case nil
+ (progn ,@ body)
+   (error (signal 'crdt-sync-error nil)
 
 (defmacro crdt--with-should-not-error (name &rest body)
   "When any error in BODY occur, print a report and stop CRDT in this buffer.
 NAME is included in the report."
   (declare (indent 1) (debug (sexp def-body)))
-  `(condition-case err
-   (progn ,@ body)
- (error
-  (warn "CRDT mode exited in buffer %s because of error %s inside %s."
-(current-buffer) err ',name)
-  (if (crdt--server-p)
-  (crdt-stop-share-buffer)
-(remhash crdt--buffer-network-name (crdt--session-buffer-table 
crdt--session))
-(crdt--refresh-buffers-maybe)
-(crdt-mode -1)
+  `(if crdt--inhibit-recover
+   (progn ,@body)
+ (condition-case err
+ (progn ,@ body)
+   (error
+(warn "CRDT mode exited in buffer %s because of error %s inside %s."
+  (current-buffer) err ',name)
+(if (crdt--server-p)
+(crdt-stop-share-buffer)
+  (remhash crdt--buffer-network-name (crdt--session-buffer-table 
crdt--session))
+  (crdt--refresh-buffers-maybe)
+  (crdt-mode -1))
 
 (defun crdt--recover (&optional err)
   "Try to recover from a synchronization failure.
@@ -2406,7 +2418,12 @@ Join with DISPLAY-NAME."
(setq parsed-url (url-generic-parse-url url))
(when (or (not (url-type parsed-url))
  (string-equal (url-type parsed-url) 
"localhost")) ; for ease of local debugging
- (setq parsed-url (url-generic-parse-url (concat 
"eins://" url
+ (let ((inferred-protocol
+(cond ((eq (url-portspec parsed-url) 6530) 
"ein")
+  ((eq (url-portspec parsed-url) 6540) 
"eins")
+  (crdt-default-tls "eins")
+  (t "ein"
+   (setq parsed-url (url-generic-parse-url (concat 
inferred-protocol "://" url)
(when (not (url-portspec parsed-url))
  (pcase (url-type parsed-url)
("eins" (setf (url-portspec parsed-url) 6540))



[elpa] externals/crdt 28c5f6bd0e 27/44: Also `crdt--refresh-users-maybe' when `crdt-stop-follow'

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 28c5f6bd0ea24fccbab7bde5d29d3ee27a74033e
Author: Qiantan Hong 
Commit: Qiantan Hong 

Also `crdt--refresh-users-maybe' when `crdt-stop-follow'
---
 crdt.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crdt.el b/crdt.el
index c24f916487..7a40e0a95f 100644
--- a/crdt.el
+++ b/crdt.el
@@ -1006,7 +1006,8 @@ user menu almost always indicate supposed changes in 
buffer menu."
(crdt--contact-metadata-name
 (gethash (crdt--session-follow-user-id crdt--session)
  (crdt--session-contact-table crdt--session
-  (setf (crdt--session-follow-user-id crdt--session) nil))
+  (setf (crdt--session-follow-user-id crdt--session) nil)
+  (crdt--refresh-users-maybe))
 
 (defun crdt--kill-buffer-hook ()
   "Kill buffer hook for CRDT shared buffers.



[elpa] externals/crdt 3a78c8a615 24/44: Improve settings form when CRDT-USE-STUNNEL is nil

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 3a78c8a6155a2ae8414d2a7686f8540b1cb7dd6d
Author: Qiantan Hong 
Commit: Qiantan Hong 

Improve settings form when CRDT-USE-STUNNEL is nil

also remove some debug printing
---
 crdt.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crdt.el b/crdt.el
index b92ded9422..639d4b8d81 100644
--- a/crdt.el
+++ b/crdt.el
@@ -2164,7 +2164,8 @@ Create a new one if such a CRDT session doesn't exist."
 (crdt-read-settings
  (format "*Settings for %s*" session-name)
  `(("Port: " "6530" ,(crdt--settings-make-ensure-type 
'numberp))
-   ("Secure Port: " "6540" ,(crdt--settings-make-ensure-type 
'numberp))
+   ("Secure Port: " ,(if crdt-use-stunnel "6540" "--")
+,(when crdt-use-stunnel 
(crdt--settings-make-ensure-type 'numberp)))
("Session Name: " ,session-name 
,(crdt--settings-make-ensure-nonempty session-name))
("Password: " "")
("Display Name: " ,crdt-default-name)
@@ -2426,7 +2427,6 @@ Join with DISPLAY-NAME."
  (gnutls-boot-parameters
   :type 'gnutls-x509pki
   :hostname (url-host url))
-   (message "%s" (process-status proc))
(unless (eq (process-status proc) 'open)
  (signal 'file-error "Failed to establish TLS 
connection."))
proc)



[elpa] externals/crdt e06e6e7236 21/44: add history support for CRDT-READ-SETTINGS

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit e06e6e7236bc896f364addc8d5fb731c1d79e597
Author: Qiantan Hong 
Commit: Qiantan Hong 

add history support for CRDT-READ-SETTINGS
---
 crdt.el | 135 
 1 file changed, 77 insertions(+), 58 deletions(-)

diff --git a/crdt.el b/crdt.el
index 8c9ef77a7c..1b08215de4 100644
--- a/crdt.el
+++ b/crdt.el
@@ -76,6 +76,13 @@
   "Start tuntox proxy for CRDT servers."
   :type '(choice boolean (const confirm)))
 
+(defcustom crdt-read-settings-help-string
+  (concat "\\[forms-next-field]:Next Field, \\[forms-prev-field]:Prev Field\n"
+  "\\[forms-next-record]:History Next, \\[forms-prev-record]:History 
Prev\n"
+  "\\[exit-recursive-edit]:OK, \\[abort-recursive-edit]:Cancel\n")
+  "Help string for `crdt-read-settings'."
+  :type 'string)
+
 (defcustom crdt-default-session-command-functions
   '((crdt-get-write-access)
 crdt-xref-command-function)
@@ -1902,73 +1909,85 @@ Current user means the user corresponding to 
CRDT--PROCESS."
   (unless (memq symbol crdt--ephemeral-advices)
 (advice-remove symbol wrapped-advice)
 
-(forms--mode-commands)
-
 (defvar crdt-read-settings-map
-  (let ((map (copy-keymap forms-mode-map)))
+  (let ((map (make-sparse-keymap)))
 (define-key map (kbd "") #'forms-next-field)
 (define-key map (kbd "") #'forms-prev-field)
-(define-key map (kbd "DEL") nil) ;; without this, DEL somehow get mapped 
to forms-prev-record
-(define-key map (kbd "RET") #'exit-recursive-edit)
-(define-key map (kbd "C-g") #'abort-recursive-edit)
-(define-key map [remap forms-next-record] 'ignore)
-(define-key map [remap forms-prev-record] 'ignore)
-(define-key map [remap forms-first-record] 'ignore)
-(define-key map [remap forms-last-record] 'ignore)
+(define-key map "\C-m" #'exit-recursive-edit)
+(define-key map "\C-g" #'abort-recursive-edit)
+(define-key map "\M-n" 'forms-next-record)
+(define-key map "\M-p" 'forms-prev-record)
+(define-key map (kbd "M->") 'forms-first-record)
+(define-key map (kbd "M-<") 'forms-last-record)
 (define-key map [remap forms-insert-record] 'ignore)
-(define-key map [remap forms-jump-record] 'ignore)
+;; (define-key map [remap forms-jump-record] 'ignore)
 (define-key map [remap forms-exit] 'ignore)
 map))
 
-(defun crdt--read-settings (buffer-name settings-list)
+(defun crdt-read-settings (buffer-name settings-list)
+  "Display a form in a buffer for editing some settings.
+Use the buffer with BUFFER-NAME to display the form (create if
+not exist).  Use the buffer with BUFFER-NAME prepended by a space
+to store history (create if not exist).
+SETTINGS-LIST should be a list with elements of the form
+ (PROMPT DEFAULT-CONTENT &optional FUNCTION).  FUNCTION, if
+non-nil, is called on the user entered string to get the settings
+value.  Returns a list of settings values correpsonding to
+SETTINGS-LIST."
   (with-current-buffer (get-buffer-create buffer-name)
 (let ((enable-local-eval t)
-  (data-buffer (generate-new-buffer (concat " " buffer-name
+  (data-buffer (get-buffer-create (concat " " buffer-name)))
+  (default-content-string
+   (cl-loop for entry in settings-list
+ concat (cadr entry)
+ concat "\t")))
+  (aset default-content-string (1- (length default-content-string)) ?\n)
+  (let ((standard-output (current-buffer)))
+(prin1
+ `(setq forms-file t
+forms-number-of-fields ,(length settings-list)
+forms-format-list
+'(,(let ((overriding-local-map crdt-read-settings-map))
+ (substitute-command-keys
+  crdt-read-settings-help-string))
+  ,@(cl-loop for i from 1
+  for entry in settings-list
+  nconc (list (car entry) i "\n"))
+  (crdt--call-with-ephemeral-advice
+   'forms--help 'ignore
+   (lambda ()
+ (crdt--call-with-ephemeral-advice
+  'find-file-noselect
+  (lambda (orig-func file)
+(if (eq file t)
+(with-current-buffer data-buffer
+  (save-excursion
+(goto-char (point-max))
+(forward-line -1)
+(unless (looking-at-p (regexp-quote 
default-content-string))
+  (goto-char (point-max))
+  (insert default-content-string)))
+  (current-buffer))
+  (funcall orig-func file)))
+  #'forms-mode)))
   (unwind-protect
(progn
- (let ((standard-output (current-buffer)))
-   (prin1
-`(setq forms-file t
-   forms-number-of-fields ,(length settings-list)
-   forms-format-list
-   '(,(let ((overriding-local-map crdt-read

[elpa] externals/crdt 282c48c47c 44/44: Revise README

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 282c48c47cab2dacabc57386f32d97f90615e6b7
Author: Qiantan Hong 
Commit: Qiantan Hong 

Revise README
---
 README.org | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 939511baa5..9e7fbb6f11 100644
--- a/README.org
+++ b/README.org
@@ -23,7 +23,7 @@ Highlights:
 of ~crdt.el~ not working.  Because currently the network protocol is
 not stablized, behavior when using mismatched versions is
 unexpectable.
-- Strictly speaking, it should works when =crdt-protocol-version= are
+- Strictly speaking, it should work when =crdt-protocol-version= are
   defined (added after version =0.2.5=) and the same on all peers.
   But why not save some hassle and keep everyone on the latest
   version.
@@ -46,9 +46,17 @@ If a new session is to be created, you need to enter port 
(default to
 6530), optional password and your display name (default to your
 current =(user-full-name)=).
 
+Experimental settings: "Secure Port" specifies TLS port, and "Command
+Functions" specifies user permissions. It's ok to just use the default
+values.
+
 ** Join a session
 
 =M-x crdt-connect=, then enter address, port, and your display name.
+
+If the server has provided the permission (this is the default case),
+connected user may also add their buffers to the session via
+=M-x crdt-share-buffer=.
   
 ** List active users
 



[elpa] externals/crdt f81f5297fa 28/44: Improve naming for user and buffer list

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit f81f5297fa866ed102b01c33dde091d5ff8d4108
Author: Qiantan Hong 
Commit: Qiantan Hong 

Improve naming for user and buffer list
---
 crdt.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/crdt.el b/crdt.el
index 7a40e0a95f..67d252bdcd 100644
--- a/crdt.el
+++ b/crdt.el
@@ -831,8 +831,7 @@ Directly return the buffer network name under point if in 
the buffer menu."
 (error "Not a CRDT shared buffer"))
   (unless (and (crdt--session-buffer-menu-buffer crdt--session) 
(buffer-live-p (crdt--session-buffer-menu-buffer crdt--session)))
 (setf (crdt--session-buffer-menu-buffer crdt--session)
-  (generate-new-buffer (concat (crdt--session-name crdt--session)
-   " buffers")))
+  (generate-new-buffer (format "*CRDT Buffers %s*" 
(crdt--session-name crdt--session
 (crdt--assimilate-session (crdt--session-buffer-menu-buffer 
crdt--session)))
   (let ((display-buffer (crdt--session-buffer-menu-buffer crdt--session)))
 (crdt-refresh-buffers display-buffer)
@@ -949,7 +948,7 @@ Only server can perform this action."
 (error "Not a CRDT shared buffer"))
   (unless (and (crdt--session-user-menu-buffer crdt--session) 
(buffer-live-p (crdt--session-user-menu-buffer crdt--session)))
 (setf (crdt--session-user-menu-buffer crdt--session)
-  (generate-new-buffer (concat (crdt--session-name crdt--session) 
" users")))
+  (generate-new-buffer (format "*CRDT Users %s*" 
(crdt--session-name crdt--session
 (crdt--assimilate-session (crdt--session-user-menu-buffer 
crdt--session)))
   (let ((display-buffer (crdt--session-user-menu-buffer crdt--session)))
 (crdt-refresh-users display-buffer)



[elpa] externals/crdt 780478a090 39/44: Fix crdt--cycle-user bug with different buffer/window

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 780478a090bba3a5ce927db1ca7dcc3bd7a801f8
Author: Qiantan Hong 
Commit: Qiantan Hong 

Fix crdt--cycle-user bug with different buffer/window
---
 crdt.el | 65 +
 1 file changed, 33 insertions(+), 32 deletions(-)

diff --git a/crdt.el b/crdt.el
index cfedcc59f3..baa79b2bbf 100644
--- a/crdt.el
+++ b/crdt.el
@@ -917,25 +917,22 @@ Directly return the user name under point if in the user 
menu."
   (crdt--read-user session)
   (signal 'quit nil)))
 
-(defun crdt-goto-user (session user-id &optional noswitch)
-  "Goto the cursor location of user with USER-ID in SESSION.
-If NOSWITCH is non-nil, don't switch window."
+(defun crdt-goto-user (session user-id)
+  "Goto the cursor location of user with USER-ID in SESSION."
   (interactive (let ((session (crdt--read-session-maybe)))
  (list session (crdt--read-user-maybe session
-  (let ((crdt--session session))
+  (let ((crdt--session session)
+(switch-window-function
+ (if (eq major-mode 'crdt-user-menu-mode) 
#'switch-to-buffer-other-window #'switch-to-buffer)))
 (if (eq user-id (crdt--session-local-id crdt--session))
-(unless noswitch
-  (funcall (if (eq major-mode 'crdt-user-menu-mode)
-   #'switch-to-buffer-other-window
- #'switch-to-buffer)
-   (gethash (crdt--session-focused-buffer-name crdt--session) 
(crdt--session-buffer-table crdt--session
+(funcall switch-window-function
+ (gethash (crdt--session-focused-buffer-name crdt--session) 
(crdt--session-buffer-table crdt--session)))
   (unless
   (cl-block nil
 (let* ((metadata (or (gethash user-id (crdt--session-contact-table 
crdt--session)) (cl-return)))
(buffer-name (or (crdt--contact-metadata-focus metadata) 
(cl-return
   (crdt--with-buffer-name-pull (buffer-name)
-   (unless noswitch
-  (switch-to-buffer-other-window (current-buffer)))
+(funcall switch-window-function (current-buffer))
(ignore-errors (goto-char (overlay-start (car (gethash user-id 
crdt--pseudo-cursor-table)
t)))
 (message "Doesn't have position information for this user yet.")
@@ -955,27 +952,31 @@ When moving into/out of ourselves, push/pop a global 
marker instead."
   (unless crdt--session
 (error "Not a CRDT shared buffer"))
   (crdt--session-ensure-user-menu-buffer crdt--session)
-  (let ((mark (point-marker)))
-(with-current-buffer (crdt--session-user-menu-buffer crdt--session)
-  (when (= (point) (point-max))
-(forward-line -1))
-  (when (eq (tabulated-list-get-id) (crdt--session-local-id crdt--session))
-(setf (crdt--session-my-location-marker crdt--session) mark)
-(add-to-history 'global-mark-ring mark global-mark-ring-max t))
-  (if prev
-  (unless (= (forward-line -1) 0)
-(goto-char (point-max))
-(forward-line -1))
-(forward-line)
-(when (= (point) (point-max))
-  (goto-char (point-min
-  (let ((window (get-buffer-window (current-buffer) t)))
-(when window (set-window-point window (point
-  (if (eq (tabulated-list-get-id) (crdt--session-local-id crdt--session))
-  (if (eq (car global-mark-ring) (crdt--session-my-location-marker 
crdt--session))
-  (pop-global-mark)
-(goto-char (crdt--session-my-location-marker crdt--session)))
-(crdt-goto-user crdt--session (tabulated-list-get-id) t)
+  (let* ((mark (point-marker))
+ (user-id
+  (with-current-buffer (crdt--session-user-menu-buffer crdt--session)
+(when (= (point) (point-max))
+  (forward-line -1))
+(when (eq (tabulated-list-get-id) (crdt--session-local-id 
crdt--session))
+  (setf (crdt--session-my-location-marker crdt--session) mark)
+  (add-to-history 'global-mark-ring mark global-mark-ring-max t))
+(if prev
+(unless (= (forward-line -1) 0)
+  (goto-char (point-max))
+  (forward-line -1))
+  (forward-line)
+  (when (= (point) (point-max))
+(goto-char (point-min
+(let ((window (get-buffer-window (current-buffer) t)))
+  (when window (set-window-point window (point
+(if (eq (tabulated-list-get-id) (crdt--session-local-id 
crdt--session))
+(when (crdt--session-my-location-marker crdt--session)
+  (if (eq (car global-mark-ring) 
(crdt--session-my-location-marker crdt--session))
+  (pop-global-mark)
+(goto-char (crdt--session-my-location-marker 
crdt--session)))
+  nil)
+  (tabulated-list-get-id)
+(when

[elpa] externals/crdt 39c308368e 36/44: Also add (kbd "d") binding for *-kill-*

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 39c308368ef0567e065c8768993f46a7861e3840
Author: Qiantan Hong 
Commit: Qiantan Hong 

Also add (kbd "d") binding for *-kill-*
---
 crdt.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crdt.el b/crdt.el
index cd98990acf..d3768a481d 100644
--- a/crdt.el
+++ b/crdt.el
@@ -754,6 +754,7 @@ FILTER can be nil, 'server or 'client."
 (define-key map (kbd "RET") #'crdt-list-buffers)
 (define-key map [mouse-1] #'crdt-list-buffers)
 (define-key map (kbd "k") #'crdt--stop-session)
+(define-key map (kbd "d") #'crdt--stop-session)
 map))
 
 (define-derived-mode crdt-session-menu-mode tabulated-list-mode
@@ -839,6 +840,7 @@ Directly return the buffer network name under point if in 
the buffer menu."
 (define-key map (kbd "RET") #'crdt-switch-to-buffer-other-window)
 (define-key map [mouse-1] #'crdt-switch-to-buffer-other-window)
 (define-key map (kbd "k") #'crdt-stop-share-buffer)
+(define-key map (kbd "d") #'crdt-stop-share-buffer)
 map))
 
 (define-derived-mode crdt-buffer-menu-mode tabulated-list-mode
@@ -953,6 +955,7 @@ Only server can perform this action."
 (define-key map (kbd "RET") #'crdt-goto-user)
 (define-key map [mouse-1] #'crdt-goto-user)
 (define-key map (kbd "k") #'crdt-kill-user)
+(define-key map (kbd "d") #'crdt-kill-user)
 (define-key map (kbd "f") #'crdt-follow-user)
 map))
 



[elpa] externals/crdt 0743dd15f0 29/44: change `crdt--session-name' to `crdt--session-urlstr'

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 0743dd15f0b2ae626cd3bf6e49e0ab4b86cff38b
Author: Qiantan Hong 
Commit: Qiantan Hong 

change `crdt--session-name' to `crdt--session-urlstr'
---
 crdt.el | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/crdt.el b/crdt.el
index 67d252bdcd..31bb761cf1 100644
--- a/crdt.el
+++ b/crdt.el
@@ -349,7 +349,7 @@ Must be used inside CRDT--WITH-INSERTION-INFORMATION."
   ;; Special case: key nil may be mapped to a metadata for a client
   ;; itself before it gets its user-id. It should be remapped to
   ;; the right key as soon as client knows its user-id
-  name
+  urlstr
   user-menu-buffer
   buffer-menu-buffer
   network-process
@@ -649,7 +649,7 @@ until synchronization is completed, otherwise run body 
asynchronously."
  (with-current-buffer crdt-buffer
,@body)
(unless (crdt--server-p)
- (setq crdt-buffer (generate-new-buffer (format "%s<%s>" ,name 
(crdt--session-name crdt--session
+ (setq crdt-buffer (generate-new-buffer (format "%s<%s>" ,name 
(crdt--session-urlstr crdt--session
  (puthash ,name crdt-buffer (crdt--session-buffer-table crdt--session))
  (let ((session crdt--session))
(with-current-buffer crdt-buffer
@@ -680,13 +680,13 @@ Otherwise, return the list of names for client sessions."
   (let (session-names)
 (dolist (session crdt--session-list)
   (when (eq (crdt--server-p session) server)
-(push (crdt--session-name session) session-names)))
+(push (crdt--session-urlstr session) session-names)))
 (nreverse session-names)))
 
 (defsubst crdt--get-session (name)
   "Get the CRDT session object with NAME."
   (cl-find name crdt--session-list
-   :test 'equal :key #'crdt--session-name))
+   :test 'equal :key #'crdt--session-urlstr))
 
 (defun crdt--read-session (&optional filter)
   "Prompt for a session name and return the corresponding session.
@@ -700,14 +700,14 @@ FILTER can be nil, 'server or 'client."
 (cl-ecase filter
   ((server) (crdt--get-session-names t))
   ((client) (crdt--get-session-names nil))
-  ((nil) (mapcar #'crdt--session-name crdt--session-list)))
+  ((nil) (mapcar #'crdt--session-urlstr 
crdt--session-list)))
 nil t
 (when (and crdt--session
(cl-ecase filter
  ((server) (crdt--server-p))
  ((client) (not (crdt--server-p)))
  ((nil) t)))
-  (crdt--session-name crdt--session)
+  (crdt--session-urlstr crdt--session)
 
 (defun crdt--read-session-maybe (&optional filter)
   "Prompt for a session name and return the corresponding session.
@@ -758,7 +758,7 @@ If DISPLAY-BUFFER is provided, display the output there."
 (setq tabulated-list-entries nil)
 (mapc (lambda (session)
 (push
- (list session (vector (crdt--session-name session)
+ (list session (vector (crdt--session-urlstr session)
(if (crdt--server-p session) "Server" 
"Client")
(crdt--session-local-name session)
(mapconcat (lambda (v) (format "%s" v))
@@ -831,7 +831,7 @@ Directly return the buffer network name under point if in 
the buffer menu."
 (error "Not a CRDT shared buffer"))
   (unless (and (crdt--session-buffer-menu-buffer crdt--session) 
(buffer-live-p (crdt--session-buffer-menu-buffer crdt--session)))
 (setf (crdt--session-buffer-menu-buffer crdt--session)
-  (generate-new-buffer (format "*CRDT Buffers %s*" 
(crdt--session-name crdt--session
+  (generate-new-buffer (format "*CRDT Buffers %s*" 
(crdt--session-urlstr crdt--session
 (crdt--assimilate-session (crdt--session-buffer-menu-buffer 
crdt--session)))
   (let ((display-buffer (crdt--session-buffer-menu-buffer crdt--session)))
 (crdt-refresh-buffers display-buffer)
@@ -948,7 +948,7 @@ Only server can perform this action."
 (error "Not a CRDT shared buffer"))
   (unless (and (crdt--session-user-menu-buffer crdt--session) 
(buffer-live-p (crdt--session-user-menu-buffer crdt--session)))
 (setf (crdt--session-user-menu-buffer crdt--session)
-  (generate-new-buffer (format "*CRDT Users %s*" 
(crdt--session-name crdt--session
+  (generate-new-buffer (format "*CRDT Users %s*" 
(crdt--session-urlstr crdt--session
 (crdt--assimilate-session (crdt--session-user-menu-buffer 
crdt--session)))
   (let ((display-buffer (crdt--session-user-menu-buffer crdt--session)))
 (crdt-refresh-users display-buffer)
@@ -2157,7 +2157,7 @@ Create a new one if such a CRDT session doesn't exist."
 

[elpa] externals/crdt 709059ff5e 13/44: fix disconnect warn condition

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 709059ff5e0846f2c8f44b479e6083c6d0128dc8
Author: Qiantan Hong 
Commit: Qiantan Hong 

fix disconnect warn condition
---
 crdt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crdt.el b/crdt.el
index 58b9c89464..a7b8c65532 100644
--- a/crdt.el
+++ b/crdt.el
@@ -1941,7 +1941,7 @@ Setup up the server with PASSWORD and assign this Emacs 
DISPLAY-NAME."
 (kill-buffer process-buffer))
   (when (and proxy-process (process-live-p proxy-process))
 (interrupt-process proxy-process)))
-(unless (memq last-command '(crdt-disconnect crdt-stop-session))
+(unless (memq this-command '(crdt-disconnect crdt-stop-session 
crdt--stop-session))
   (warn "CRDT session %s disconnected." (crdt--session-name session)
 
 (defun crdt-stop-session (&optional session)



[elpa] externals/crdt dfc98d3525 38/44: add crdt-goto-{next, prev}-user

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit dfc98d35257e812922da103a0a54e96fb155490d
Author: Qiantan Hong 
Commit: Qiantan Hong 

add crdt-goto-{next,prev}-user
---
 README.org | 123 -
 crdt.el|  72 ++--
 2 files changed, 134 insertions(+), 61 deletions(-)

diff --git a/README.org b/README.org
index 1dcd4edca5..5d07211b38 100644
--- a/README.org
+++ b/README.org
@@ -1,9 +1,11 @@
 * Introduction
 
-~crdt.el~ is a real-time collaborative editing environment for Emacs using 
Conflict-free Replicated Data Types.
+~crdt.el~ is a real-time collaborative editing environment for Emacs
+using Conflict-free Replicated Data Types.
 
 Highlights:
-- [[https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type][CRDT]], 
darling child of collaborative editing researches...
+- [[https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type][CRDT]],
+  darling child of collaborative editing researches...
 - Share multiple buffer in one session
 - See other users' cursor and region
 - Synchronize Org mode folding status
@@ -16,26 +18,30 @@ Highlights:
 
 ~crdt.el~ is now on GNU ELPA! Just =M-x package-install crdt=.
 
-*Caution!!!* Please make sure that you and your peers are on the same 
~crdt.el~ version!
-It turns out to be one of the most common causes of ~crdt.el~ not working.
-Because currently the network protocol is not stablized, behavior when using 
mismatched versions is unexpectable.
+*Caution!!!* Please make sure that you and your peers are on the same
+~crdt.el~ version!  It turns out to be one of the most common causes
+of ~crdt.el~ not working.  Because currently the network protocol is
+not stablized, behavior when using mismatched versions is
+unexpectable.
 - Strictly speaking, it should works when =crdt-protocol-version= are defined 
and the same on all peers.
   But why not save some hassle and keep everyone on the latest version.
 - To upgrade, just =M-x package-reinstall crdt=, then preferably restart Emacs.
 
 ** Start a shared session
 
-A shared session is a place that can contains multiple buffers (or files),
-and multiple users can join to collaboratively edit those buffers (or files).
-Think about a meeting room with some people working together on some papers.
+A shared session is a place that can contains multiple buffers (or
+files), and multiple users can join to collaboratively edit those
+buffers (or files).  Think about a meeting room with some people
+working together on some papers.
 
 In some buffer, =M-x crdt-share-buffer=. Then enter session name.
 This add the current buffer to the existing session with that name.
-If no such exists, it creates a new session with the provided session name,
-and initially contains the current buffer as a shared buffer.
+If no such exists, it creates a new session with the provided session
+name, and initially contains the current buffer as a shared buffer.
 
-If a new session is to be created, you need to enter port (default to 6530),
-optional password and your display name (default to your current 
=(user-full-name)=).
+If a new session is to be created, you need to enter port (default to
+6530), optional password and your display name (default to your
+current =(user-full-name)=).
 
 ** Join a session
 
@@ -43,10 +49,16 @@ optional password and your display name (default to your 
current =(user-full-nam
   
 ** List active users
 
-In a CRDT shared buffer (either server or client), =M-x crdt-list-users=.
+In a CRDT shared buffer (either server or client), =M-x
+crdt-list-users=.
 
-In the displayed user list, press ~RET~ on an entry to goto that user's cursor 
position.
-Press ~f~ to follow that user, and press ~f~ again or =M-x crdt-stop-follow= 
to stop following.
+In the displayed user list, press ~RET~ on an entry to goto that
+user's cursor position.  Press ~f~ to follow that user, and press ~f~
+again or =M-x crdt-stop-follow= to stop following.
+
+You can also use =M-x crdt-goto-next-user= and =M-x
+crdt-goto-prev-user= to cycle through users' cursor positions from any
+CRDT shared buffer (don't need to be in the user list buffer).
 
 ** List all sessions, and buffer in current session
 
@@ -57,10 +69,12 @@ press ~RET~ in the session list to see buffers in the 
selected session.
 
 ** Stop sharing
 
-=M-x crdt-stop-session= stops a session you've started and disconnect all 
other users from it.
-This will ask for your confirmation, customize =crdt-confirm-stop-session= if 
you want to disable it.
+=M-x crdt-stop-session= stops a session you've started and disconnect
+all other users from it.  This will ask for your confirmation,
+customize =crdt-confirm-stop-session= if you want to disable it.
 
-You can also press ~k~ or ~d~ in the session list (show it by =M-x 
crdt-list-sessions=).
+You can also press ~k~ or ~d~ in the session list (show it by =M-x
+crdt-list-sessions=).
 
 =M-x crdt-stop-share-buffer= removes current buffer from its CRDT
 ses

[elpa] externals/crdt 01551d66c9 34/44: Fix default theme bug and other bugs.

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 01551d66c9fccd66860a5fa2226f1f2db53118eb
Author: Qiantan Hong 
Commit: Qiantan Hong 

Fix default theme bug and other bugs.
---
 crdt.el | 57 ++---
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/crdt.el b/crdt.el
index 72a17d221a..00ba38162e 100644
--- a/crdt.el
+++ b/crdt.el
@@ -135,11 +135,14 @@ See `crdt-new-session'.'"
 
 (defun crdt--get-region-color (user-id)
   "Get region color for USER-ID."
-  (apply #'color-rgb-to-hex
- (cl-mapcar
-  (lambda (a b) (+ (* a crdt-region-alpha) (* b (- 1.0 
crdt-region-alpha
-  (nth (mod user-id (length crdt-cursor-colors)) crdt-cursor-colors)
-  (color-name-to-rgb (face-attribute 'default :background)
+  (let ((background-rgb (color-name-to-rgb (face-attribute 'default 
:background
+(if background-rgb
+(apply #'color-rgb-to-hex
+   (cl-mapcar
+(lambda (a b) (+ (* a crdt-region-alpha) (* b (- 1.0 
crdt-region-alpha
+(nth (mod user-id (length crdt-cursor-colors)) 
crdt-cursor-colors)
+background-rgb))
+  (crdt--get-cursor-color user-id
 
 (defun crdt--move-cursor (ov pos)
   "Move pseudo cursor overlay OV to POS."
@@ -1990,9 +1993,9 @@ Handle received STRING from PROCESS."
 (let ((session (process-get process 'crdt-session)))
   (when session
 (if (and (not (crdt--session-roger-p session))
- (process-get proc 'crdt--downgrade-continuation))
+ (process-get process 'crdt--downgrade-continuation))
 ;; This should only happens when we are in the middle of TLS 
handshake
-(funcall (process-get proc 'crdt--downgrade-continuation))
+(funcall (process-get process 'crdt--downgrade-continuation))
   (when (process-get process 'tuntox-process)
 (process-send-string
  process
@@ -2397,19 +2400,19 @@ Join with DISPLAY-NAME."
(crdt-read-settings
 "*CRDT Connect Settings*"
 `(("URL: " "" ,(lambda (url)
-   (let (parsed-url)
- (when (eq (length url) 0)
-   (error "Please input a valid URL"))
- (setq parsed-url (url-generic-parse-url url))
- (when (or (not (url-type parsed-url))
-   (string-equal (url-type parsed-url) 
"localhost")) ; for ease of local debugging
-   (setq parsed-url (url-generic-parse-url (concat 
"eins://" url
- (when (not (url-portspec parsed-url))
-   (pcase (url-type parsed-url)
- ("eins" (setf (url-portspec parsed-url) 6540))
- ("ein" (setf (url-portspec parsed-url) 6530))
- ("tuntox" (setf (url-portspec parsed-url) 6530
- parsed-url)))
+ (let (parsed-url)
+   (when (eq (length url) 0)
+ (error "Please input a valid URL"))
+   (setq parsed-url (url-generic-parse-url url))
+   (when (or (not (url-type parsed-url))
+ (string-equal (url-type parsed-url) 
"localhost")) ; for ease of local debugging
+ (setq parsed-url (url-generic-parse-url (concat 
"eins://" url
+   (when (not (url-portspec parsed-url))
+ (pcase (url-type parsed-url)
+   ("eins" (setf (url-portspec parsed-url) 6540))
+   ("ein" (setf (url-portspec parsed-url) 6530))
+   ("tuntox" (setf (url-portspec parsed-url) 6530
+   parsed-url)))
   ("Display Name: " ,crdt-default-name 
,(crdt--settings-make-ensure-nonempty crdt-default-name)
   (unless (url-p url)
 (when (eq (length url) 0)
@@ -2456,13 +2459,13 @@ Join with DISPLAY-NAME."
  (cons 'gnutls-x509pki
(gnutls-boot-parameters
 :type 'gnutls-x509pki
-:hostname (url-host url)
- (when (= (url-portspec url) 6540)
-   (process-put proc 'crdt--downgrade-continuation
-(lambda ()
-  (process-put proc 
'crdt--downgrade-continuation nil)
-  (downgrade
- proc))
+:hostname (url-host url))
+ (when (= (url-portspec url) 6540)
+   (process-put proc 'crdt--downgrade-continuation
+(lambda ()
+ 

[elpa] externals/crdt 932566653e 23/44: TLS support by stunnel.

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 932566653ee2c2e03a22cff018590e9b95e1eeaf
Author: Qiantan Hong 
Commit: Qiantan Hong 

TLS support by stunnel.
---
 crdt.el | 193 +++-
 1 file changed, 143 insertions(+), 50 deletions(-)

diff --git a/crdt.el b/crdt.el
index c25dfed32e..b92ded9422 100644
--- a/crdt.el
+++ b/crdt.el
@@ -76,6 +76,26 @@
   "Start tuntox proxy for CRDT servers."
   :type '(choice boolean (const confirm)))
 
+(defcustom crdt-stunnel-executable "stunnel"
+  "Path to the stunnel binary."
+  :type 'file)
+
+(defcustom crdt-tls-certificate
+  (concat (file-name-as-directory (if (featurep 'xdg) (xdg-data-home) "~/"))
+  "crdt-tls.pem")
+  "Path to TLS certificate file used for TLS-secured server."
+  :type 'file)
+
+(defcustom crdt-tls-private-key
+  (concat (file-name-as-directory (if (featurep 'xdg) (xdg-data-home) "~/"))
+  "crdt-tls-key.pem")
+  "Path to TLS private key file used for TLS-secured server."
+  :type 'file)
+
+(defcustom crdt-use-stunnel t
+  "Start stunnel proxy for CRDT servers."
+  :type '(choice boolean (const confirm)))
+
 (defcustom crdt-read-settings-help-string
   (concat "\\[forms-next-field]:Next Field, \\[forms-prev-field]:Prev Field\n"
   "\\[forms-next-record]:History Next, \\[forms-prev-record]:History 
Prev\n"
@@ -2144,6 +2164,7 @@ Create a new one if such a CRDT session doesn't exist."
 (crdt-read-settings
  (format "*Settings for %s*" session-name)
  `(("Port: " "6530" ,(crdt--settings-make-ensure-type 
'numberp))
+   ("Secure Port: " "6540" ,(crdt--settings-make-ensure-type 
'numberp))
("Session Name: " ,session-name 
,(crdt--settings-make-ensure-nonempty session-name))
("Password: " "")
("Display Name: " ,crdt-default-name)
@@ -2164,9 +2185,59 @@ Create a new one if such a CRDT session doesn't exist."
   (message "Only server can stop sharing a buffer.")))
 (message "Not a CRDT shared buffer.")))
 
+(defun crdt-generate-certificate (save-path &optional certtool-executable 
log-file)
+  "Generate a self-signed certificate with private key.
+Store the .pem file to SAVE-PATH.  If CERTTOOL-EXECUTABLE is
+provided, it should be a path to a GnuTLS executable, which will
+be used.  Otherwise, search for gnutls-certtool, then certtool,
+in (EXEC-PATH).  Write diagnostic outputs to LOG-FILE.  If
+LOG-FILE is nil, append .log to SAVE-PATH and use that instead."
+  (setq save-path (expand-file-name save-path))
+  (setq log-file
+(if log-file (expand-file-name log-file)
+  (concat save-path ".log")))
+  (unless certtool-executable
+(setq certtool-executable
+  (or (locate-file "gnutls-certtool" (exec-path) exec-suffixes 1)
+  (locate-file "certtool" (exec-path) exec-suffixes 1
+  (unless certtool-executable
+(signal 'file-error "Cannot locate GnuTLS certificate tool executable."))
+  (with-temp-file save-path
+(let ((save-buffer (current-buffer)))
+  (unless (= 0 (call-process certtool-executable nil (list save-buffer 
log-file) nil "-p"))
+(error "Failed to generate private key"))
+  (write-region nil nil save-path)
+  (with-temp-buffer
+(insert "tls_www_server")
+(unless (= 0 (call-process-region
+  nil nil certtool-executable nil (list save-buffer 
log-file) nil
+  "-s" "--load-privkey" save-path "--template=/dev/stdin"))
+  (error "Failed to generate certificate"))
+
+(defun crdt-start-stunnel (port secure-port)
+  "Start a stunnel proxy that forwards SECURE-PORT to PORT.
+Return the stunnel proxy process."
+  (unless (file-exists-p crdt-tls-certificate)
+(if (yes-or-no-p (format "%s does not exist. Generate a self-signing 
certificate? "
+ crdt-tls-certificate))
+(crdt-generate-certificate crdt-tls-certificate)
+  (error "TLS certificate %s does not exist" crdt-tls-certificate)))
+  (let ((stunnel-process
+ (make-process :name "Stunnel Proxy"
+   :buffer (generate-new-buffer "*Stunnel Proxy*")
+   :command '("stunnel" "/dev/stdin"
+(display-buffer (process-buffer stunnel-process))
+(process-send-string stunnel-process
+ (format 
"foreground=yes\ncert=%s\nkey=%s\n[ein]\naccept=%d\nconnect=%d\n"
+ crdt-tls-certificate crdt-tls-certificate 
secure-port port))
+(process-send-eof stunnel-process)
+stunnel-process))
+
 (defun crdt-new-session
-(port session-name password display-name permissions)
+(port secure-port session-name password display-name permissions)
   "Start a new CRDT session on PORT with SESSION-NAME.
+When CRDT-USE-STUNNEL is non nil, also start a stunnel proxy on SECURE-PORT,
+otherwise SECURE-PORT is ignored.
 Setup up the server wit

[elpa] externals/crdt 3883736730 17/44: many changes

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 388373673060130b36f2dd47767073d4766969eb
Author: Qiantan Hong 
Commit: Qiantan Hong 

many changes
---
 HACKING.org |  66 -
 crdt.el | 437 ++--
 2 files changed, 279 insertions(+), 224 deletions(-)

diff --git a/HACKING.org b/HACKING.org
index 4f19ff9ed0..3bd19c85a3 100644
--- a/HACKING.org
+++ b/HACKING.org
@@ -18,19 +18,6 @@ For base IDs, last two bytes are always representing Site ID.
 Stored strings are BASE-ID:OFFSETs. So the last two bytes represent offset,
 and second last two bytes represent Site ID.
 
-* Access Control
-  
-~crdt.el~ implements a capability based access control system.
-
-Each capability is a list of the form =(type transferable-p nonce . body)=
-
-  - read :: body takes the form =(buffer-name)=
-  - write :: body takes the form =(buffer-name)=
-  - command :: body takes the form =(buffer-name command-symbol)=
-+ =buffer-name= can be =t=, which means that =command-symbol= is not 
-  bound to be invoked in any specific buffer.
-  - process :: body takes the form =(buffer-name)=
-
 * Protocol
 
 Text-based version
@@ -42,6 +29,8 @@ Site IDs are /buffer local/ and temporarily assigned to users 
with writable acce
 Every message takes the form =(type . body)=
 
   - Text Editing
+A peer must obtain a =site-id= before performing the following operations,
+by remote calling =crdt-get-write-access=. See [[Remote Command]].
 + insert ::
   body takes the form =(buffer-name user-id crdt-id position-hint content)=
   - =position-hint= is the buffer position where the operation happens at 
the site
@@ -50,7 +39,7 @@ Every message takes the form =(type . body)=
   - =content= is the string to be inserted
 
 + delete ::
-  body takes the form =(buffer-name position-hint . crdt-id-list)=
+  body takes the form =(buffer-name user-id position-hint . crdt-id-list)=
   - =crdt-id-list= is generated from =CRDT--DUMP-IDS= from the deleted text
 
   - Peer State
@@ -58,8 +47,8 @@ Every message takes the form =(type . body)=
   body takes the form
=(buffer-name user-id point-position-hint point-crdt-id 
mark-position-hint mark-crdt-id)=
   =*-crdt-id= can be either a CRDT ID, or
-- =nil=, which means clear the point/mark
-- =""=, which means =(point-max)=
+  - =nil=, which means clear the point/mark
+  - =""=, which means =(point-max)=
 
 + contact ::
   body takes the form
@@ -113,6 +102,9 @@ Every message takes the form =(type . body)=
   This message is sent from server to client to notice that some messages 
from the
   client is not processed due to error =(error-symbol . error-datum)=.
   Normally client should follow initial synchronization procedure to 
reinitialize the buffer.
+  - =buffer-name= can also be =nil=, which signifies that it's a session 
error.
+The only reasonable thing to do is to disconnect in this scenario.
+Currently, this happens when client/server protocol version doesn't 
match.
 
   - Buffer Service
 + add ::
@@ -151,26 +143,36 @@ Every message takes the form =(type . body)=
 + overlay-remove ::
   body takes the form =(buffer-name user-id logical-clock)=
 
-  - Remote Command
+  - <>
++ fcap ::
+  body takes the form =(buffer-name command-symbol nonce in-states 
out-states)=
+  This grants a "functional capability" to a peer.
+  Nonce is a random number to prevent forging capability.
+  - =buffer-name= can also be =nil=, which means this is a session-scoped 
command,
+not bound to any specific buffer.
+  - =in-states= is a list of state symbols that the command depends on.
+=out-states= is a list of state symbols that the command modifies and 
should be synchronized
+to the caller.
+See [[Allowed state symbols]].
+
 + command ::
   body takes the form
   #+BEGIN_SRC
-  (buffer-name spawn-user-id
-   user-id logical-clock state-list
-   command-symbol . args)
+  (buffer-name user-id logical-clock
+   spawn-user-id state-list nonce command-symbol . args)
   #+END_SRC
-   - =spawn-user-id= represents the site where the interactive command is 
originally invoked
- + It can be different from =user-id= because a remote command can 
call a remote command!
-   This is especially useful when client makes a remote call, 
-   but the call on the server request some interactive input,
-   and such interactive call are remote-called back into the client.
-   - =state-list= is an alist of bindings.
-(except that we use 1 element list for the CDRs, to save a dot in the 
serialized string)
-(CDRs can also be 2 element list of the form =(crdt-id pos-hint)=)
-Allowed symbols are 
-#+BEGIN_SRC
-buffer point mark mark-active transient-mark-mode last-command-event
-#+END_SR

[elpa] externals/crdt dc9ec07fbd 43/44: Revise README

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit dc9ec07fbd1021a5209b009cc72310ba32b15038
Author: Qiantan Hong 
Commit: Qiantan Hong 

Revise README
---
 README.org | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index 5d07211b38..939511baa5 100644
--- a/README.org
+++ b/README.org
@@ -23,9 +23,12 @@ Highlights:
 of ~crdt.el~ not working.  Because currently the network protocol is
 not stablized, behavior when using mismatched versions is
 unexpectable.
-- Strictly speaking, it should works when =crdt-protocol-version= are defined 
and the same on all peers.
-  But why not save some hassle and keep everyone on the latest version.
-- To upgrade, just =M-x package-reinstall crdt=, then preferably restart Emacs.
+- Strictly speaking, it should works when =crdt-protocol-version= are
+  defined (added after version =0.2.5=) and the same on all peers.
+  But why not save some hassle and keep everyone on the latest
+  version.
+- To upgrade, just =M-x package-reinstall crdt=, then preferably
+  restart Emacs. To check your ~crdt.el~ version, =M-x crdt-version=.
 
 ** Start a shared session
 



[elpa] externals/crdt 949f4a1afd 37/44: reflect key binding addition in README.org

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 949f4a1afd84079a590dec8fc20af7d14a1294d3
Author: Qiantan Hong 
Commit: Qiantan Hong 

reflect key binding addition in README.org
---
 README.org | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/README.org b/README.org
index 639e4a83ee..1dcd4edca5 100644
--- a/README.org
+++ b/README.org
@@ -60,19 +60,20 @@ press ~RET~ in the session list to see buffers in the 
selected session.
 =M-x crdt-stop-session= stops a session you've started and disconnect all 
other users from it.
 This will ask for your confirmation, customize =crdt-confirm-stop-session= if 
you want to disable it.
 
-You can also press ~k~ in the session list (show it by =M-x 
crdt-list-sessions=).
+You can also press ~k~ or ~d~ in the session list (show it by =M-x 
crdt-list-sessions=).
 
-=M-x crdt-stop-share-buffer= removes current buffer from its CRDT session 
-(this operation is only allowed at server side). Or press ~k~ in the buffer 
list.
+=M-x crdt-stop-share-buffer= removes current buffer from its CRDT
+session (this operation is only allowed at server side). You can also
+press ~k~ or ~d~ in the buffer list.
 
 ** Disconnect from a session
 
 =M-x crdt-disconnect=, then choose a session to disconnect from.
 
-You can also press ~k~ in the session list (show it by =M-x 
crdt-list-sessions=).
+You can also press ~k~ or ~d~ in the session list (show it by =M-x 
crdt-list-sessions=).
 
 The server Emacs has the privilege to disconnect a user from a session.
-To do so, press ~k~ on an entry in the user list (show it by =M-x 
crdt-list-users=).
+To do so, press ~k~ or ~d~ on an entry in the user list (show it by =M-x 
crdt-list-users=).
 
 ** Visualizing author of parts of the document
 Turn on =crdt-visualize-author-mode=. Colored underlines are added to each 
part of the document,



[elpa] externals/crdt 89e3a2699d 31/44: Capitalise “Session” buffer to follow new convention

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 89e3a2699d7da326abb3598876a652cfd0db5f4a
Author: Leo Vivier 
Commit: Leo Vivier 

Capitalise “Session” buffer to follow new convention
---
 crdt.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crdt.el b/crdt.el
index c3aea42877..9cc3844c91 100644
--- a/crdt.el
+++ b/crdt.el
@@ -2344,7 +2344,7 @@ Each element should be one of
 (when (and proxy-process (process-live-p proxy-process))
   (interrupt-process proxy-process
 (unless (memq this-command '(crdt-disconnect crdt-stop-session 
crdt--stop-session))
-  (warn "CRDT session %s disconnected." (crdt--session-urlstr session)
+  (warn "CRDT Session %s disconnected." (crdt--session-urlstr session)
 
 (defun crdt-stop-session (&optional session)
   "Stop sharing the SESSION.



[elpa] externals/crdt 2bc5389ba9 26/44: add `crdt-author' to default tracked text properties

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 2bc5389ba96db51d79a476cd9b2282a21e98fbe6
Author: Qiantan Hong 
Commit: Qiantan Hong 

add `crdt-author' to default tracked text properties
---
 crdt.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/crdt.el b/crdt.el
index 6b5800bdac..c24f916487 100644
--- a/crdt.el
+++ b/crdt.el
@@ -81,12 +81,12 @@
   :type 'file)
 
 (defcustom crdt-tls-certificate
-  (concat user-emacs-directory "crdt-tls.pem")
+  (locate-user-emacs-file "crdt-tls.pem")
   "Path to TLS certificate file used for TLS-secured server."
   :type 'file)
 
 (defcustom crdt-tls-private-key
-  (concat user-emacs-directory "crdt-tls.pem")
+  (locate-user-emacs-file "crdt-tls.pem")
   "Path to TLS private key file used for TLS-secured server."
   :type 'file)
 
@@ -115,7 +115,7 @@ See `crdt-new-session'.'"
   "Override local commands with corresponding remote commands when available."
   :type 'boolean)
 
-(defcustom crdt-region-alpha 0.5
+(defcustom crdt-region-alpha 0.2
   "Alpha value for highlighting selections."
   :type 'float)
 
@@ -428,7 +428,7 @@ and CRDT--DISABLE-OVERLAY-SPECIES to modify this variable
 as those functions handle bookkeeping of
 adding/removing actively tracked overlays.")
 
-(defvar-local crdt--enabled-text-properties nil
+(defvar-local crdt--enabled-text-properties '(crdt-author)
   "A list of text properties that are tracked and synchronized.")
 
 ;;; Global variables



[elpa] externals/crdt 72e2b8be12 42/44: Merge branch 'master' into development

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 72e2b8be126d735404fb34272aae1808327e0832
Merge: 780478a090 1f1e309cd7
Author: Qiantan Hong 
Commit: Qiantan Hong 

Merge branch 'master' into development
---
 crdt.el | 56 
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/crdt.el b/crdt.el
index baa79b2bbf..752e9cde34 100644
--- a/crdt.el
+++ b/crdt.el
@@ -127,6 +127,13 @@ See `crdt-new-session'.'"
   "Alpha value for highlighting selections."
   :type 'float)
 
+(defcustom crdt-tuntox-password-in-url nil
+  "Whether or not to include the session password in the tuntox connection URL.
+Useful if you plan to share your session URL over a trusted secure channel. 
Your
+password will be in plaintext in the URL, so take care when sharing URLs with
+this option enabled."
+  :type 'boolean)
+
 ;;; Pseudo cursor/region utils
 
 (defvar crdt-cursor-colors
@@ -2359,15 +2366,18 @@ Each element should be one of
 (process-put network-process 'crdt-session new-session)
 (push new-session crdt--session-list)
 (if tuntox-p ; TODO: factor this out like `crdt-start-stunnel'
-(let ((proxy-process
-   (make-process :name "Tuntox Proxy"
- :buffer (generate-new-buffer "*Tuntox Proxy*")
- :command
- `(,crdt-tuntox-executable
-   "-C" ,(expand-file-name crdt-tuntox-key-path)
-   "-f" "/dev/stdin" ; do the filtering for safety 
sake
-   ,@ (when (and password (> (length password) 0))
-`("-s" ,password))
+(let* ((password-p (and password (> (length password) 0)))
+   (proxy-process
+(make-process :name "Tuntox Proxy"
+  :buffer (generate-new-buffer "*Tuntox Proxy*")
+  :command
+  `(,crdt-tuntox-executable
+"-C" ,(expand-file-name crdt-tuntox-key-path)
+"-f" "/dev/stdin" ; do the filtering for 
safety sake
+,@ (when password-p
+ `("-s" ,password))
+  (when password-p
+(process-put proxy-process 'password password))
   (display-buffer (process-buffer proxy-process))
   (process-put network-process 'tuntox-process proxy-process)
   (process-send-string proxy-process (format "127.0.0.1:%s\n" port)) ; 
only allow connection to our port
@@ -2435,16 +2445,20 @@ Currently this only work if a tuntox proxy is used."
  (network-process (crdt--session-network-process session))
  (tuntox-process (process-get network-process 'tuntox-process)))
 (if tuntox-process
-(progn
-  (kill-new (format "tuntox://%s:%s"
-(with-current-buffer (process-buffer 
tuntox-process)
-  (save-excursion
-(goto-char (point-min))
-(search-forward "Using Tox ID: ")
-(let ((start (point)))
-  (end-of-line)
-  (buffer-substring-no-properties start 
(point)
-(process-contact network-process :service)))
+(let ((url-base (format "tuntox://%s:%s"
+(with-current-buffer (process-buffer 
tuntox-process)
+  (save-excursion
+(goto-char (point-min))
+(search-forward "Using Tox ID: ")
+(let ((start (point)))
+  (end-of-line)
+  (buffer-substring-no-properties start 
(point)
+(process-contact network-process :service
+  (kill-new (if (and crdt-tuntox-password-in-url (process-get 
tuntox-process 'password))
+(format "%s?pwd=%s"
+url-base
+(process-get tuntox-process 'password))
+  url-base))
   (message "URL copied."))
   (message "No known URL to copy, find out your public IP address 
yourself!"
 
@@ -2545,7 +2559,9 @@ Join with DISPLAY-NAME."
  (let ((port (read-from-minibuffer (format "tuntox proxy port 
(default %s): "
(1+ (url-portspec url)))
nil nil t nil (format "%s" (1+ 
(url-portspec url)
-   (password (read-passwd "tuntox password (empty for no 
password): ")))
+   (password (or (when (url-filename url)
+   (cadr (s

[elpa] externals/crdt e2b6c9ebf6 22/44: get sharing buffer from clients working

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit e2b6c9ebf61d16053c770a43fee842468ca3e1af
Author: Qiantan Hong 
Commit: Qiantan Hong 

get sharing buffer from clients working
---
 HACKING.org |  23 +-
 crdt.el | 713 +++-
 2 files changed, 422 insertions(+), 314 deletions(-)

diff --git a/HACKING.org b/HACKING.org
index 3bd19c85a3..b593ec0d01 100644
--- a/HACKING.org
+++ b/HACKING.org
@@ -30,7 +30,7 @@ Every message takes the form =(type . body)=
 
   - Text Editing
 A peer must obtain a =site-id= before performing the following operations,
-by remote calling =crdt-get-write-access=. See [[Remote Command]].
+by remote calling =crdt-get-write-access=. See [[Remote Function]].
 + insert ::
   body takes the form =(buffer-name user-id crdt-id position-hint content)=
   - =position-hint= is the buffer position where the operation happens at 
the site
@@ -143,26 +143,24 @@ Every message takes the form =(type . body)=
 + overlay-remove ::
   body takes the form =(buffer-name user-id logical-clock)=
 
-  - <>
+  - <>
 + fcap ::
-  body takes the form =(buffer-name command-symbol nonce in-states 
out-states)=
+  body takes the form =(fcap-symbol nonce in-states out-states . 
interactive-form)=
   This grants a "functional capability" to a peer.
   Nonce is a random number to prevent forging capability.
-  - =buffer-name= can also be =nil=, which means this is a session-scoped 
command,
-not bound to any specific buffer.
-  - =in-states= is a list of state symbols that the command depends on.
-=out-states= is a list of state symbols that the command modifies and 
should be synchronized
+  - =in-states= is a list of state symbols that the function depends on.
+=out-states= is a list of state symbols that the function modifies and 
should be synchronized
 to the caller.
 See [[Allowed state symbols]].
 
-+ command ::
++ funcall ::
   body takes the form
   #+BEGIN_SRC
-  (buffer-name user-id logical-clock
-   spawn-user-id state-list nonce command-symbol . args)
+  (user-id logical-clock spawn-user-id 
+state-list nonce fcap-symbol . args)
   #+END_SRC
   - =spawn-user-id= represents the site where the interactive command is 
originally invoked
-+ It can be different from =user-id= because a remote command can call 
a remote command!
++ It can be different from =user-id= because a remote function can 
call a remote function!
   This is especially useful when client makes a remote call, 
   but the call on the server request some interactive input,
   and such interactive call are remote-called back into the client.
@@ -171,7 +169,8 @@ Every message takes the form =(type . body)=
(CDRs can also be 2 element list of the form =(crdt-id pos-hint)=)
<> are 
#+BEGIN_SRC
-   buffer point mark mark-active transient-mark-mode last-command-event
+   window window-point buffer buffer-content point
+   mark mark-active transient-mark-mode last-command-event
#+END_SRC
 
 + return ::
diff --git a/crdt.el b/crdt.el
index 1b08215de4..c25dfed32e 100644
--- a/crdt.el
+++ b/crdt.el
@@ -83,12 +83,19 @@
   "Help string for `crdt-read-settings'."
   :type 'string)
 
-(defcustom crdt-default-session-command-functions
-  '((crdt-get-write-access)
-crdt-xref-command-function)
-  "A list that describes default policies for public session-scoped commands.
+(defcustom crdt-default-session-permissions
+  '(crdt-write-access-fcaps
+crdt-create-buffer-fcaps
+crdt-comint-fcaps
+crdt-xscheme-fcaps
+crdt-xref-fcaps)
+  "A list that describes default policies for public session-scoped functions.
 See `crdt-new-session'.'"
-  :type '(list (or function (list function
+  :type '(list (or function symbol)))
+
+(defcustom crdt-override-command t
+  "Override local commands with corresponding remote commands when available."
+  :type 'boolean)
 
 ;;; Pseudo cursor/region utils
 
@@ -301,6 +308,16 @@ Must be used inside CRDT--WITH-INSERTION-INFORMATION."
 (:constructor crdt--make-contact-metadata (display-name 
focused-buffer-name host service)))
   display-name host service focused-buffer-name)
 
+(cl-defstruct (crdt-remote-fcap
+(:constructor crdt--make-remote-fcap
+  (name nonce in-states out-states 
interactive-form)))
+  name nonce in-states out-states interactive-form)
+
+(cl-defstruct (crdt-local-fcap
+(:constructor crdt--make-local-fcap
+  (name nonce in-states out-states proxy)))
+  name nonce in-states out-states proxy)
+
 (cl-defstruct (crdt--session (:constructor crdt--make-session))
   local-id  ; Local user-id
   local-clock   ; Local logical clock
@@ -313,11 +330,11 @@ Must be used inside CRD

[elpa] externals/crdt 1f1e309cd7 41/44: Merge branch 'tuntox-password-in-url' into 'master'

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit 1f1e309cd7b67f1eaba6954395d19fbdfbed29e5
Merge: 81b55a27b8 df8954b9c3
Author: Qiantan Hong 
Commit: Qiantan Hong 

Merge branch 'tuntox-password-in-url' into 'master'

feat: Option to put tuntox password in copied URL

See merge request qhong/crdt.el!2
---
 crdt.el | 56 
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/crdt.el b/crdt.el
index 001f517713..8838b16091 100644
--- a/crdt.el
+++ b/crdt.el
@@ -83,6 +83,13 @@
   "Start tuntox proxy for CRDT servers."
   :type '(choice boolean (const confirm)))
 
+(defcustom crdt-tuntox-password-in-url nil
+  "Whether or not to include the session password in the tuntox connection URL.
+Useful if you plan to share your session URL over a trusted secure channel. 
Your
+password will be in plaintext in the URL, so take care when sharing URLs with
+this option enabled."
+  :type 'boolean)
+
 ;;; Pseudo cursor/region utils
 
 (defvar crdt-cursor-region-colors
@@ -1887,15 +1894,18 @@ Setup up the server with PASSWORD and assign this Emacs 
DISPLAY-NAME."
 (when crdt-ask-for-password
   (read-from-minibuffer "Set password (empty for no 
authentication): "
 (if tuntox-p
-(let ((proxy-process
-   (make-process :name "Tuntox Proxy"
- :buffer (generate-new-buffer "*Tuntox Proxy*")
- :command
- `(,crdt-tuntox-executable
-   "-C" ,(expand-file-name crdt-tuntox-key-path)
-   "-f" "/dev/stdin" ; do the filtering for safety 
sake
-   ,@ (when (and password (> (length password) 0))
-`("-s" ,password))
+(let* ((password-p (and password (> (length password) 0)))
+   (proxy-process
+(make-process :name "Tuntox Proxy"
+  :buffer (generate-new-buffer "*Tuntox Proxy*")
+  :command
+  `(,crdt-tuntox-executable
+"-C" ,(expand-file-name crdt-tuntox-key-path)
+"-f" "/dev/stdin" ; do the filtering for 
safety sake
+,@ (when password-p
+ `("-s" ,password))
+  (when password-p
+(process-put proxy-process 'password password))
   (process-put network-process 'tuntox-process proxy-process)
   (process-send-string proxy-process (format "127.0.0.1:%s\n" port)) ; 
only allow connection to our port
   (process-send-eof proxy-process)
@@ -1958,16 +1968,20 @@ Currently this only work if a tuntox proxy is used."
  (network-process (crdt--session-network-process session))
  (tuntox-process (process-get network-process 'tuntox-process)))
 (if tuntox-process
-(progn
-  (kill-new (format "tuntox://%s:%s"
-(with-current-buffer (process-buffer 
tuntox-process)
-  (save-excursion
-(goto-char (point-min))
-(search-forward "Using Tox ID: ")
-(let ((start (point)))
-  (end-of-line)
-  (buffer-substring-no-properties start 
(point)
-(process-contact network-process :service)))
+(let ((url-base (format "tuntox://%s:%s"
+(with-current-buffer (process-buffer 
tuntox-process)
+  (save-excursion
+(goto-char (point-min))
+(search-forward "Using Tox ID: ")
+(let ((start (point)))
+  (end-of-line)
+  (buffer-substring-no-properties start 
(point)
+(process-contact network-process :service
+  (kill-new (if (and crdt-tuntox-password-in-url (process-get 
tuntox-process 'password))
+(format "%s?pwd=%s"
+url-base
+(process-get tuntox-process 'password))
+  url-base))
   (message "URL copied."))
   (message "No known URL to copy, find out your public IP address 
yourself!"
 
@@ -2036,7 +2050,9 @@ Join with DISPLAY-NAME."
  (setq port (read-from-minibuffer (format "tuntox proxy port 
(default %s): "
   (1+ (url-portspec url)))
   nil nil t nil (format "%s" (1+ 
(url-portspec url)
- (let ((password (read-passwd "tuntox password (empty for no 
pa

[elpa] externals/crdt df8954b9c3 40/44: feat: Option to put tuntox password in copied URL

2022-07-02 Thread ELPA Syncer
branch: externals/crdt
commit df8954b9c378ac0d76564f61e9266ca66c4bce4d
Author: Jonathan Ming <61-jming...@users.noreply.code.librehq.com>
Commit: Qiantan Hong 

feat: Option to put tuntox password in copied URL
---
 crdt.el | 56 
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/crdt.el b/crdt.el
index 001f517713..8838b16091 100644
--- a/crdt.el
+++ b/crdt.el
@@ -83,6 +83,13 @@
   "Start tuntox proxy for CRDT servers."
   :type '(choice boolean (const confirm)))
 
+(defcustom crdt-tuntox-password-in-url nil
+  "Whether or not to include the session password in the tuntox connection URL.
+Useful if you plan to share your session URL over a trusted secure channel. 
Your
+password will be in plaintext in the URL, so take care when sharing URLs with
+this option enabled."
+  :type 'boolean)
+
 ;;; Pseudo cursor/region utils
 
 (defvar crdt-cursor-region-colors
@@ -1887,15 +1894,18 @@ Setup up the server with PASSWORD and assign this Emacs 
DISPLAY-NAME."
 (when crdt-ask-for-password
   (read-from-minibuffer "Set password (empty for no 
authentication): "
 (if tuntox-p
-(let ((proxy-process
-   (make-process :name "Tuntox Proxy"
- :buffer (generate-new-buffer "*Tuntox Proxy*")
- :command
- `(,crdt-tuntox-executable
-   "-C" ,(expand-file-name crdt-tuntox-key-path)
-   "-f" "/dev/stdin" ; do the filtering for safety 
sake
-   ,@ (when (and password (> (length password) 0))
-`("-s" ,password))
+(let* ((password-p (and password (> (length password) 0)))
+   (proxy-process
+(make-process :name "Tuntox Proxy"
+  :buffer (generate-new-buffer "*Tuntox Proxy*")
+  :command
+  `(,crdt-tuntox-executable
+"-C" ,(expand-file-name crdt-tuntox-key-path)
+"-f" "/dev/stdin" ; do the filtering for 
safety sake
+,@ (when password-p
+ `("-s" ,password))
+  (when password-p
+(process-put proxy-process 'password password))
   (process-put network-process 'tuntox-process proxy-process)
   (process-send-string proxy-process (format "127.0.0.1:%s\n" port)) ; 
only allow connection to our port
   (process-send-eof proxy-process)
@@ -1958,16 +1968,20 @@ Currently this only work if a tuntox proxy is used."
  (network-process (crdt--session-network-process session))
  (tuntox-process (process-get network-process 'tuntox-process)))
 (if tuntox-process
-(progn
-  (kill-new (format "tuntox://%s:%s"
-(with-current-buffer (process-buffer 
tuntox-process)
-  (save-excursion
-(goto-char (point-min))
-(search-forward "Using Tox ID: ")
-(let ((start (point)))
-  (end-of-line)
-  (buffer-substring-no-properties start 
(point)
-(process-contact network-process :service)))
+(let ((url-base (format "tuntox://%s:%s"
+(with-current-buffer (process-buffer 
tuntox-process)
+  (save-excursion
+(goto-char (point-min))
+(search-forward "Using Tox ID: ")
+(let ((start (point)))
+  (end-of-line)
+  (buffer-substring-no-properties start 
(point)
+(process-contact network-process :service
+  (kill-new (if (and crdt-tuntox-password-in-url (process-get 
tuntox-process 'password))
+(format "%s?pwd=%s"
+url-base
+(process-get tuntox-process 'password))
+  url-base))
   (message "URL copied."))
   (message "No known URL to copy, find out your public IP address 
yourself!"
 
@@ -2036,7 +2050,9 @@ Join with DISPLAY-NAME."
  (setq port (read-from-minibuffer (format "tuntox proxy port 
(default %s): "
   (1+ (url-portspec url)))
   nil nil t nil (format "%s" (1+ 
(url-portspec url)
- (let ((password (read-passwd "tuntox password (empty for no 
password): ")))
+ (let ((password (or (when (url-filename url)
+  

[elpa] externals/denote 12008dbcbf 11/27: Untabify a line

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 12008dbcbf9b702e5e065d978cf4a8033dbc039e
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Untabify a line
---
 denote-link.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/denote-link.el b/denote-link.el
index 83f6026c5a..e07c2089be 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -594,7 +594,7 @@ backend."
  (path (file-name-nondirectory (car path-id)))
  (p (file-name-sans-extension path))
  (id (cdr path-id))
-(desc (or description (concat "denote:" id
+ (desc (or description (concat "denote:" id
 (cond
  ((eq format 'html) (format "%s" 
p desc))
  ((eq format 'latex) (format "\\href{%s}{%s}" (replace-regexp-in-string 
"[\\{}$%&_#~^]" "\\&" path) desc))



[elpa] externals/denote updated (2193501cef -> 25e86bf0bc)

2022-07-02 Thread ELPA Syncer
elpasync pushed a change to branch externals/denote.

  from  2193501cef Change default value of denote-link-use-org-id
   new  8c724d54cf Support subdirectories
   new  fa395f7aef Update Acknowledgements for subdir support
   new  ab2a6e538a Use 'when' instead of 'if' for single condition
   new  58637a0035 Tweak doc string
   new  2aaf0f56d1 Add regexp to match only note file names
   new  d2f14291bf Move let bound filter into its own function
   new  01618516ff Refine denote--file-name-relative-to-denote-directory
   new  c020d25a21 Fix denote-link--ol-resolve-link-to-target
   new  add8f657bb Merge pull request #25 from ggjp/subdir-support
   new  eb3ea19637 Document subdir support as part of dev version
   new  12008dbcbf Untabify a line
   new  53e6ca2299 Tweak filename fontification to work with subdirs
   new  e5d6ad589b Support subdirectories in 
denote--link-find-file-at-button
   new  66e455ef84 Fix denote--current-file-is-note-p for subdirectories
   new  303f39e150 Merge pull request #26 from ggjp/subdir-support
   new  3934b167d2 Placate the compiler for minor warnings
   new  c68a8e224a Tweak denote--get-note-path-by-id for style
   new  123fb2b670 Put all faces in denote-faces.el
   new  e1aeb459ea Refine how faces are applied (extends 123fb2b)
   new  eb7b38fe16 Merge branch 'main' into subdir-support
   new  554859c0c8 Keep Acknowledgements up-to-date after eb7b38f
   new  5f8b585349 Merge branch 'main' into subdir-support
   new  070d4412ee Set org-id-extra-files to all files in all 
subdirectories.
   new  6dfb9376ca Merge pull request #28 from ggjp/subdir-support
   new  0116edc2f8 Remove sharp quote from lambda for simplicity
   new  ce791f5e42 Keep filename intact for backlink creation
   new  25e86bf0bc Update Acknowledgements in the manual


Summary of changes:
 README.org |  15 +--
 denote-dired.el|  60 ++--
 denote-faces.el| 113 +
 denote-link.el |  42 ++--
 denote-retrieve.el |   7 ++--
 denote.el  |  53 -
 6 files changed, 197 insertions(+), 93 deletions(-)
 create mode 100644 denote-faces.el



[elpa] externals/denote e5d6ad589b 13/27: Support subdirectories in denote--link-find-file-at-button

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit e5d6ad589badbc5b9f7ab23da76c68fdcdafb206
Author: Jean-Philippe Gagné Guay 
Commit: Jean-Philippe Gagné Guay 

Support subdirectories in denote--link-find-file-at-button

Clicking on a link in a non org note should work.
---
 denote-link.el | 14 +++---
 denote.el  |  6 ++
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/denote-link.el b/denote-link.el
index 3305bddfe1..d75823b15b 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -386,11 +386,12 @@ format is always [[denote:IDENTIFIER]]."
 
 (defun denote-link--find-file-at-button (button)
   "Visit file referenced by BUTTON."
-  (let ((id (denote-link--id-from-string
- (buffer-substring-no-properties
-  (button-start button)
-  (button-end button)
-(funcall denote-link-buton-action (file-name-completion id 
(denote-directory)
+  (let* ((id (denote-link--id-from-string
+  (buffer-substring-no-properties
+   (button-start button)
+   (button-end button
+ (file (denote--get-note-path-by-id id)))
+(funcall denote-link-buton-action file)))
 
 ;;;###autoload
 (defun denote-link-buttonize-buffer (&optional beg end)
@@ -557,8 +558,7 @@ and the identifier."
  (id (if (and (stringp search) (not (string-empty-p search)))
  (substring link 0 (match-beginning 0))
link))
- (path (cl-find-if (lambda (f) (string-prefix-p id 
(file-name-nondirectory f)))
-   (denote--directory-files :absolute
+ (path (denote--get-note-path-by-id id)))
 (cond
  (path-id
   (cons (format "%s" path) (format "%s" id)))
diff --git a/denote.el b/denote.el
index f57ce463e0..21a8ce19ac 100644
--- a/denote.el
+++ b/denote.el
@@ -352,6 +352,12 @@ names that are relative to the variable 
`denote-directory'."
(lambda (s) (denote--file-name-relative-to-denote-directory s))
files
 
+(defun denote--get-note-path-by-id(id)
+  "Given an ID, return the absolute path of the corresponding note
+in `denote-directory'."
+  (cl-find-if (lambda (f) (string-prefix-p id (file-name-nondirectory f)))
+  (denote--directory-files :absolute)))
+
 (defun denote--directory-files-matching-regexp (regexp &optional 
no-check-current)
   "Return list of files matching REGEXP.
 With optional NO-CHECK-CURRENT do not test if the current file is



[elpa] externals/denote 8c724d54cf 01/27: Support subdirectories

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 8c724d54cf44bfb29e3a150890547bc79215606d
Author: Jean-Philippe Gagné Guay 
Commit: Protesilaos Stavrou 

Support subdirectories

- In denote-directory-files, replace directory-files with
directory-files-recursively.
- The new function denote--file-name-relative-to-denote-directory is
used to fix the backlinks buffer and other parts of the code.
- Adjust denote-link--expand-identifiers and
denote-retrieve--read-file-prompt.
---
 denote-link.el | 18 +++---
 denote-retrieve.el |  7 ---
 denote.el  | 24 +++-
 3 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/denote-link.el b/denote-link.el
index 66b886640e..8970bbbc3b 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -312,9 +312,13 @@ format is always [[denote:IDENTIFIER]]."
 
 (defun denote-link--expand-identifiers (regexp)
   "Expend identifiers matching REGEXP into file paths."
-  (delq nil (mapcar (lambda (i)
-  (file-name-completion i (denote-directory)))
-(denote-link--collect-identifiers regexp
+  (let ((files (denote--directory-files))
+(found-files))
+(dolist (file files)
+  (dolist (i (denote-link--collect-identifiers regexp))
+(if (string-prefix-p i (file-name-nondirectory file))
+(push file found-files
+found-files))
 
 (defvar denote-link--find-file-history nil
   "History for `denote-link-find-file'.")
@@ -442,16 +446,16 @@ Use optional TITLE for a prettier heading."
   (l (length heading)))
 (insert (format "%s\n%s\n\n" heading (make-string l ?-
   (mapc (lambda (f)
-  (insert (file-name-nondirectory f))
+  (insert f)
   (make-button (point-at-bol) (point-at-eol) :type 
'denote-link-backlink-button)
   (newline))
 files)
-  (goto-char (point-min))
+  (goto-char (point-min)))
   ;; NOTE 2022-06-15: Technically this is not Dired.  Maybe we
   ;; should abstract the fontification into a general purpose
   ;; minor-mode.
-  (when denote-link-fontify-backlinks
-(denote-dired-mode 1)))
+  ;(when denote-link-fontify-backlinks
+;(denote-dired-mode 1)))
 (denote-link--display-buffer buf)))
 
 ;;;###autoload
diff --git a/denote-retrieve.el b/denote-retrieve.el
index c12907f872..a340d8fac0 100644
--- a/denote-retrieve.el
+++ b/denote-retrieve.el
@@ -90,7 +90,8 @@ Optional GROUP is a regexp construct for
 
 (defun denote-retrieve--read-file-prompt ()
   "Prompt for regular file in variable `denote-directory'."
-  (read-file-name "Select note: " (denote-directory) nil nil nil 
#'denote--only-note-p))
+  (read-file-name "Select note: " (denote-directory) nil nil nil
+  #'(lambda (f) (or (denote--only-note-p f) (file-directory-p 
f)
 
 (defun denote-retrieve--files-in-output (files)
   "Return list of FILES from `find' output."
@@ -109,14 +110,14 @@ The xrefs are returned as an alist."
 Parse `denote-retrieve--xrefs'."
   (sort
(mapcar (lambda (x)
- (file-name-nondirectory (car x)))
+ (denote--file-name-relative-to-denote-directory (car x)))
xrefs)
#'string-lessp))
 
 (defun denote-retrieve--proces-grep (identifier)
   "Process lines matching IDENTIFIER and return list of files."
   (let* ((default-directory (denote-directory))
- (file (file-name-nondirectory (buffer-file-name
+ (file (denote--file-name-relative-to-denote-directory 
(buffer-file-name
 (denote-retrieve--files-in-output
  (delete file (denote-retrieve--files-in-xrefs
(denote-retrieve--xrefs identifier))
diff --git a/denote.el b/denote.el
index 346986e12e..b785672a9a 100644
--- a/denote.el
+++ b/denote.el
@@ -310,6 +310,13 @@ FILE is relative to the variable `denote-directory'."
(string-match-p (concat "\\b" denote--id-regexp) file)
(not (string-match-p "[#~]\\'" file
 
+(defun denote--file-name-relative-to-denote-directory (file)
+  "Return file name of FILE relative to the variable `denote-directory'.
+FILE must be an absolute path."
+  (if (and (file-name-absolute-p file)
+   (string-prefix-p (denote-directory) file))
+(substring-no-properties file (length (denote-directory)
+
 (defun denote--current-file-is-note-p ()
   "Return non-nil if current file likely is a Denote note."
   (and (or (string-match-p denote--id-regexp (buffer-file-name))
@@ -322,11 +329,18 @@ FILE is relative to the variable `denote-directory'."
   "List note files, assuming flat directory.
 If optional ABSOLUTE, show full paths, else only show base file
 names that are relative to the variable `denote-directory'."
-  (let ((default-directory (denote-directory)))
-(seq-remove
- (lambda (f)
-   (not (denote--only-note-p f)))
- (directory-files default-directory absolute 
directory-files-no-dot-files-rege

[elpa] externals/denote 303f39e150 15/27: Merge pull request #26 from ggjp/subdir-support

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 303f39e15052f0755953b4bd50b5648dd2e06889
Merge: 53e6ca2299 66e455ef84
Author: Protesilaos Stavrou 
Commit: GitHub 

Merge pull request #26 from ggjp/subdir-support

Fix links in non org notes
---
 denote-link.el | 14 +++---
 denote.el  |  8 +++-
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/denote-link.el b/denote-link.el
index 3305bddfe1..d75823b15b 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -386,11 +386,12 @@ format is always [[denote:IDENTIFIER]]."
 
 (defun denote-link--find-file-at-button (button)
   "Visit file referenced by BUTTON."
-  (let ((id (denote-link--id-from-string
- (buffer-substring-no-properties
-  (button-start button)
-  (button-end button)
-(funcall denote-link-buton-action (file-name-completion id 
(denote-directory)
+  (let* ((id (denote-link--id-from-string
+  (buffer-substring-no-properties
+   (button-start button)
+   (button-end button
+ (file (denote--get-note-path-by-id id)))
+(funcall denote-link-buton-action file)))
 
 ;;;###autoload
 (defun denote-link-buttonize-buffer (&optional beg end)
@@ -557,8 +558,7 @@ and the identifier."
  (id (if (and (stringp search) (not (string-empty-p search)))
  (substring link 0 (match-beginning 0))
link))
- (path (cl-find-if (lambda (f) (string-prefix-p id 
(file-name-nondirectory f)))
-   (denote--directory-files :absolute
+ (path (denote--get-note-path-by-id id)))
 (cond
  (path-id
   (cons (format "%s" path) (format "%s" id)))
diff --git a/denote.el b/denote.el
index f57ce463e0..26f0168c34 100644
--- a/denote.el
+++ b/denote.el
@@ -327,7 +327,7 @@ FILE must be an absolute path."
   "Return non-nil if current file likely is a Denote note."
   (and (or (string-match-p denote--id-regexp (buffer-file-name))
(string-match-p denote--id-regexp (buffer-name)))
-   (string= (expand-file-name default-directory) (denote-directory
+   (string-prefix-p (denote-directory) (expand-file-name 
default-directory
 
  Keywords
 
@@ -352,6 +352,12 @@ names that are relative to the variable 
`denote-directory'."
(lambda (s) (denote--file-name-relative-to-denote-directory s))
files
 
+(defun denote--get-note-path-by-id(id)
+  "Given an ID, return the absolute path of the corresponding note
+in `denote-directory'."
+  (cl-find-if (lambda (f) (string-prefix-p id (file-name-nondirectory f)))
+  (denote--directory-files :absolute)))
+
 (defun denote--directory-files-matching-regexp (regexp &optional 
no-check-current)
   "Return list of files matching REGEXP.
 With optional NO-CHECK-CURRENT do not test if the current file is



[elpa] externals/denote c68a8e224a 17/27: Tweak denote--get-note-path-by-id for style

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit c68a8e224af4f3ba31fdbc22fd746882372b1797
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Tweak denote--get-note-path-by-id for style
---
 denote.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/denote.el b/denote.el
index ac59b77955..824d04d89a 100644
--- a/denote.el
+++ b/denote.el
@@ -358,8 +358,10 @@ names that are relative to the variable 
`denote-directory'."
 
 (defun denote--get-note-path-by-id (id)
   "Return the absolute path of ID note in variable `denote-directory'."
-  (cl-find-if (lambda (f) (string-prefix-p id (file-name-nondirectory f)))
-  (denote--directory-files :absolute)))
+  (cl-find-if
+   (lambda (f)
+ (string-prefix-p id (file-name-nondirectory f)))
+   (denote--directory-files :absolute)))
 
 (defun denote--directory-files-matching-regexp (regexp &optional 
no-check-current)
   "Return list of files matching REGEXP.



[elpa] externals/denote fa395f7aef 02/27: Update Acknowledgements for subdir support

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit fa395f7aef6c9b26060be63b10677c7a5551d247
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Update Acknowledgements for subdir support

This is part of a work-in-progress effort to make Denote work with
subdirectories.

The pull request on the GitHub mirror:
.

Relevant discussion, also on the mirror:
.
---
 README.org | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index 9652d9c8b1..85dfd81163 100644
--- a/README.org
+++ b/README.org
@@ -1933,10 +1933,10 @@ Denote is meant to be a collective effort.  Every bit 
of help matters.
 + Author/maintainer :: Protesilaos Stavrou.
 
 + Contributions to code or the manual :: Damien Cassou, Jack Baty,
-  Kaushal Modi.
+  Jean-Philippe Gagné Guay, Kaushal Modi.
 
 + Ideas and/or user feedback :: Colin McLear, Damien Cassou, Frank
-  Ehmsen, Jack Baty, Kaushal Modi, Sven Seebeck, Ypot.
+  Ehmsen, Jack Baty, Kaushal Modi, M. Hadi Timachi, Sven Seebeck, Ypot.
 
 Special thanks to Peter Povinec who helped refine the file-naming
 scheme, which is the cornerstone of this project.



[elpa] externals/denote c020d25a21 08/27: Fix denote-link--ol-resolve-link-to-target

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit c020d25a21e5b76da86f18780512e57c07b31f23
Author: Jean-Philippe Gagné Guay 
Commit: Jean-Philippe Gagné Guay 

Fix denote-link--ol-resolve-link-to-target

Clicking on a link in a note should open the linked note, even if it
is in a parent directory or a subdirectory.
---
 denote-link.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/denote-link.el b/denote-link.el
index 9b92a24468..83f6026c5a 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -553,11 +553,12 @@ inserts links with just the identifier."
 With optional PATH-ID return a cons cell consisting of the path
 and the identifier."
   (let* ((search (and (string-match "::\\(.*\\)\\'" link)
- (match-string 1 link)))
-(id (if (and (stringp search) (not (string-empty-p search)))
+  (match-string 1 link)))
+ (id (if (and (stringp search) (not (string-empty-p search)))
  (substring link 0 (match-beginning 0))
link))
- (path (expand-file-name (file-name-completion id 
(denote-directory)
+ (path (cl-find-if (lambda (f) (string-prefix-p id 
(file-name-nondirectory f)))
+   (denote--directory-files :absolute
 (cond
  (path-id
   (cons (format "%s" path) (format "%s" id)))



[elpa] externals/denote d2f14291bf 06/27: Move let bound filter into its own function

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit d2f14291bf0787c2294fb71b66429dfc4957293c
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Move let bound filter into its own function

Makes it easier to read.
---
 denote.el | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/denote.el b/denote.el
index 9c4abb2f55..58ea9ed912 100644
--- a/denote.el
+++ b/denote.el
@@ -329,17 +329,21 @@ FILE must be an absolute path."
 
  Keywords
 
+(defun denote--directory-files-recursively (directory)
+  "Return expanded files in DIRECTORY recursively."
+  (mapcar
+   (lambda (s) (expand-file-name s))
+   (seq-remove
+(lambda (f)
+  (not (denote--only-note-p f)))
+(directory-files-recursively directory directory-files-no-dot-files-regexp 
t
+
 (defun denote--directory-files (&optional absolute)
   "List note files.
 If optional ABSOLUTE, show full paths, else only show base file
 names that are relative to the variable `denote-directory'."
   (let* ((default-directory (denote-directory))
- (files (mapcar
- (lambda (s) (expand-file-name s))
- (seq-remove
-  (lambda (f)
-(not (denote--only-note-p f)))
-  (directory-files-recursively default-directory 
directory-files-no-dot-files-regexp t)
+ (files (denote--directory-files-recursively default-directory)))
 (if absolute
 files
   (mapcar



[elpa] externals/denote ab2a6e538a 03/27: Use 'when' instead of 'if' for single condition

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit ab2a6e538afd1c7643c98c8defacb57587ee4a50
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Use 'when' instead of 'if' for single condition
---
 denote-link.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/denote-link.el b/denote-link.el
index 8970bbbc3b..9b92a24468 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -316,8 +316,8 @@ format is always [[denote:IDENTIFIER]]."
 (found-files))
 (dolist (file files)
   (dolist (i (denote-link--collect-identifiers regexp))
-(if (string-prefix-p i (file-name-nondirectory file))
-(push file found-files
+(when (string-prefix-p i (file-name-nondirectory file))
+  (push file found-files
 found-files))
 
 (defvar denote-link--find-file-history nil



[elpa] externals/denote 554859c0c8 21/27: Keep Acknowledgements up-to-date after eb7b38f

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 554859c0c8e40fb360a427ac42a2e82c99a6c312
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Keep Acknowledgements up-to-date after eb7b38f
---
 README.org | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 16c1874d9c..ed1247062d 100644
--- a/README.org
+++ b/README.org
@@ -1942,7 +1942,8 @@ Denote is meant to be a collective effort.  Every bit of 
help matters.
   Jean-Philippe Gagné Guay, Kaushal Modi.
 
 + Ideas and/or user feedback :: Colin McLear, Damien Cassou, Frank
-  Ehmsen, Jack Baty, Kaushal Modi, Peter Prevos, Sven Seebeck, Ypot.
+  Ehmsen, Jack Baty, Kaushal Modi, M. Hadi Timachi, Peter Prevos, Sven
+  Seebeck, Ypot.
 
 Special thanks to Peter Povinec who helped refine the file-naming
 scheme, which is the cornerstone of this project.



[elpa] externals/denote 3934b167d2 16/27: Placate the compiler for minor warnings

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 3934b167d2b03aec7c890f7f8bf54469234090cb
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Placate the compiler for minor warnings
---
 denote.el | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/denote.el b/denote.el
index 26f0168c34..ac59b77955 100644
--- a/denote.el
+++ b/denote.el
@@ -94,6 +94,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl-lib))
+
 (defgroup denote ()
   "Simple notes with an efficient file-naming scheme."
   :group 'files)
@@ -352,9 +354,10 @@ names that are relative to the variable 
`denote-directory'."
(lambda (s) (denote--file-name-relative-to-denote-directory s))
files
 
-(defun denote--get-note-path-by-id(id)
-  "Given an ID, return the absolute path of the corresponding note
-in `denote-directory'."
+(declare-function cl-find-if "cl-seq" (cl-pred cl-list &rest cl-keys))
+
+(defun denote--get-note-path-by-id (id)
+  "Return the absolute path of ID note in variable `denote-directory'."
   (cl-find-if (lambda (f) (string-prefix-p id (file-name-nondirectory f)))
   (denote--directory-files :absolute)))
 



[elpa] externals/denote 53e6ca2299 12/27: Tweak filename fontification to work with subdirs

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 53e6ca2299f387f400a32f4e0ec45bb992a022a8
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Tweak filename fontification to work with subdirs

This is part of the development process that revolves around pull
request 24 over at the GitHub mirror:
.
---
 denote-dired.el | 2 +-
 denote-link.el  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/denote-dired.el b/denote-dired.el
index e925baf141..54a83c0805 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -398,7 +398,7 @@ appropriate."
   :group 'denote-dired)
 
 (defconst denote-dired-font-lock-keywords
-  `((,denote--file-regexp
+  `((,(concat "\\(?:.*/\\)?" denote--file-regexp)
  (1 'denote-dired-field-date)
  (2 'denote-dired-field-time)
  (3 'denote-dired-field-delimiter)
diff --git a/denote-link.el b/denote-link.el
index e07c2089be..3305bddfe1 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -450,12 +450,12 @@ Use optional TITLE for a prettier heading."
   (make-button (point-at-bol) (point-at-eol) :type 
'denote-link-backlink-button)
   (newline))
 files)
-  (goto-char (point-min)))
+  (goto-char (point-min))
   ;; NOTE 2022-06-15: Technically this is not Dired.  Maybe we
   ;; should abstract the fontification into a general purpose
   ;; minor-mode.
-  ;(when denote-link-fontify-backlinks
-;(denote-dired-mode 1)))
+  (when denote-link-fontify-backlinks
+(denote-dired-mode 1)))
 (denote-link--display-buffer buf)))
 
 ;;;###autoload



[elpa] externals/denote 123fb2b670 18/27: Put all faces in denote-faces.el

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 123fb2b67088e98f675373b5d02b75f4d4a36f79
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Put all faces in denote-faces.el

This will help us decouple the backlinks' buffer from denote-dired-mode.
---
 denote-dired.el | 61 +++---
 denote-faces.el | 92 +
 2 files changed, 102 insertions(+), 51 deletions(-)

diff --git a/denote-dired.el b/denote-dired.el
index 54a83c0805..b607e3d02a 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -354,60 +354,19 @@ appropriate."
 
  Extra fontification
 
-(defface denote-dired-field-date
-  'class color) (min-colors 88) (background light))
- :foreground "#00538b")
-(((class color) (min-colors 88) (background dark))
- :foreground "#00d3d0")
-(t :inherit font-lock-variable-name-face))
-  "Face for file name date in `dired-mode' buffers."
-  :group 'denote-dired)
-
-(defface denote-dired-field-time
-  '((t :inherit denote-dired-field-date))
-  "Face for file name time in `dired-mode' buffers."
-  :group 'denote-dired)
-
-(defface denote-dired-field-title
-  '((t ))
-  "Face for file name title in `dired-mode' buffers."
-  :group 'denote-dired)
-
-(defface denote-dired-field-extension
-  '((t :inherit shadow))
-  "Face for file extension type in `dired-mode' buffers."
-  :group 'denote-dired)
-
-(defface denote-dired-field-keywords
-  '((default :inherit bold)
-(((class color) (min-colors 88) (background light))
- :foreground "#8f0075")
-(((class color) (min-colors 88) (background dark))
- :foreground "#f78fe7")
-(t :inherit font-lock-builtin-face))
-  "Face for file name keywords in `dired-mode' buffers."
-  :group 'denote-dired)
-
-(defface denote-dired-field-delimiter
-  'class color) (min-colors 88) (background light))
- :foreground "gray70")
-(((class color) (min-colors 88) (background dark))
- :foreground "gray30")
-(t :inherit shadow))
-  "Face for file name delimiters in `dired-mode' buffers."
-  :group 'denote-dired)
+(require 'denote-faces)
 
 (defconst denote-dired-font-lock-keywords
-  `((,(concat "\\(?:.*/\\)?" denote--file-regexp)
- (1 'denote-dired-field-date)
- (2 'denote-dired-field-time)
- (3 'denote-dired-field-delimiter)
- (4 'denote-dired-field-title)
- (5 'denote-dired-field-delimiter)
- (6 'denote-dired-field-keywords)
- (7 'denote-dired-field-extension))
+  `((,denote--file-regexp
+ (1 'denote-faces-date)
+ (2 'denote-faces-time)
+ (3 'denote-faces-delimiter)
+ (4 'denote-faces-title)
+ (5 'denote-faces-delimiter)
+ (6 'denote-faces-keywords)
+ (7 'denote-faces-extension))
 ("_"
- (0 'denote-dired-field-delimiter t)))
+ (0 'denote-faces-delimiter t)))
   "Keywords for fontification.")
 
 ;;;###autoload
diff --git a/denote-faces.el b/denote-faces.el
new file mode 100644
index 00..2a5e32f1d4
--- /dev/null
+++ b/denote-faces.el
@@ -0,0 +1,92 @@
+;;; denote-faces.el --- Faces and fontification rules for Denote -*- 
lexical-binding: t -*-
+
+;; Copyright (C) 2022  Free Software Foundation, Inc.
+
+;; Author: Protesilaos Stavrou 
+;; Maintainer: Denote Development <~protesilaos/den...@lists.sr.ht>
+;; URL: https://git.sr.ht/~protesilaos/denote
+;; Version: 0.1.0
+;; Package-Requires: ((emacs "27.2"))
+
+;; This file is NOT part of GNU Emacs.
+
+;; This program 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 your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+;;
+;; Used internally by Denote to fontify file names in Dired, the
+;; backlinks' buffer, and related.
+
+;;; Code:
+
+(defgroup denote-faces ()
+  "Faces for Denote."
+  :group 'denote)
+
+(defface denote-faces-subdirectory
+  '((t :inherit bold))
+  "Face for subdirectory of file name.
+This should only ever needed in the backlinks' buffer (or
+equivalent), not in Dired."
+  :group 'denote-faces)
+
+(defface denote-faces-date
+  'class color) (min-colors 88) (background light))
+ :foreground "#00538b")
+(((class color) (min-colors 88) (background dark))
+ :foreground "#00d3d0")
+(t :inherit font-lock-variable-name-face))
+  "Face for file name date in Dired buffers.
+This is the part of the identifier that covers the year, month,
+and day."
+  :group 'denote-faces)
+
+(defface denote-faces-time
+  '((t :inherit denote-faces-date))
+  "Face for file n

[elpa] externals/denote 5f8b585349 22/27: Merge branch 'main' into subdir-support

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 5f8b58534921efb31c5557dd2528f4a304ef0740
Merge: 554859c0c8 2193501cef
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Merge branch 'main' into subdir-support
---
 README.org | 7 +--
 denote-link.el | 8 
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index ed1247062d..b03068261a 100644
--- a/README.org
+++ b/README.org
@@ -647,9 +647,12 @@ When ~denote-link~ is called with a prefix argument (=C-u= 
by default)
 it formats links like =[[denote:IDENTIFIER]]=.  The user might prefer
 its simplicity.
 
+[ Default value of ~denote-link-use-org-id~ changed as part of
+  {{{development-version}}} ]
+
 #+vindex: denote-link-use-org-id
-When the user option ~denote-link-use-org-id~ is set to non-nil (default
-is nil), inserted links in Org notes that target other Org notes will
+When the user option ~denote-link-use-org-id~ is set to non-nil (the
+default), inserted links in Org notes that target other Org notes will
 use the standard =id:= type so the format is =[[id:IDENTIFIER][TITLE]]=
 (the title is omitted is ~denote-link~ is called with a prefix argument,
 as explained above).  When, however, an Org note links to a note in
diff --git a/denote-link.el b/denote-link.el
index 7cf4ded930..b1c97959f2 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -200,8 +200,8 @@ and/or the documentation string of `display-buffer'."
alist)
   :group 'denote-link)
 
-(defcustom denote-link-use-org-id nil
-  "When non-nil use the ID link type in Org files if appropriate.
+(defcustom denote-link-use-org-id t
+  "When non-nil use the ID link type in Org files, if appropriate.
 
 Newly created links from Org notes which target other Org notes
 will use the standard `id:' hyperlink type instead of the custom
@@ -213,9 +213,9 @@ other tools in the Org ecosystem.
 
 When the value is nil, Denote links rely on the custom `denote:'
 hyperlink type (which should behave the same as the standard
-`file:' type).
+`file:' link).
 
-Other files types beside Org always use the `denote:' links."
+Other file types beside Org always use the `denote:' links."
   :type 'boolean
   :group 'denote-link)
 ;;;###autoload (put 'denote-link-use-org-id 'safe-local-variable 'booleanp)



[elpa] externals/denote add8f657bb 09/27: Merge pull request #25 from ggjp/subdir-support

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit add8f657bb69f75c60945a13e7d2ed03fc4fc196
Merge: 01618516ff c020d25a21
Author: Protesilaos Stavrou 
Commit: GitHub 

Merge pull request #25 from ggjp/subdir-support

Fix denote-link--ol-resolve-link-to-target
---
 denote-link.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/denote-link.el b/denote-link.el
index 9b92a24468..83f6026c5a 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -553,11 +553,12 @@ inserts links with just the identifier."
 With optional PATH-ID return a cons cell consisting of the path
 and the identifier."
   (let* ((search (and (string-match "::\\(.*\\)\\'" link)
- (match-string 1 link)))
-(id (if (and (stringp search) (not (string-empty-p search)))
+  (match-string 1 link)))
+ (id (if (and (stringp search) (not (string-empty-p search)))
  (substring link 0 (match-beginning 0))
link))
- (path (expand-file-name (file-name-completion id 
(denote-directory)
+ (path (cl-find-if (lambda (f) (string-prefix-p id 
(file-name-nondirectory f)))
+   (denote--directory-files :absolute
 (cond
  (path-id
   (cons (format "%s" path) (format "%s" id)))



[elpa] externals/denote 0116edc2f8 25/27: Remove sharp quote from lambda for simplicity

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 0116edc2f8fbafb98fa1161d3933ac844931f9cf
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Remove sharp quote from lambda for simplicity

The Elisp manual explains:

The read syntax ‘#'’ is a short-hand for using ‘function’.  The
following forms are all equivalent:

  (lambda (x) (* x x))
  (function (lambda (x) (* x x)))
  #'(lambda (x) (* x x))

Evaluate:

(info "(elisp) Anonymous Functions")
---
 denote-retrieve.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/denote-retrieve.el b/denote-retrieve.el
index a340d8fac0..b3479c210d 100644
--- a/denote-retrieve.el
+++ b/denote-retrieve.el
@@ -91,7 +91,7 @@ Optional GROUP is a regexp construct for
 (defun denote-retrieve--read-file-prompt ()
   "Prompt for regular file in variable `denote-directory'."
   (read-file-name "Select note: " (denote-directory) nil nil nil
-  #'(lambda (f) (or (denote--only-note-p f) (file-directory-p 
f)
+  (lambda (f) (or (denote--only-note-p f) (file-directory-p 
f)
 
 (defun denote-retrieve--files-in-output (files)
   "Return list of FILES from `find' output."



[elpa] externals/denote 6dfb9376ca 24/27: Merge pull request #28 from ggjp/subdir-support

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 6dfb9376ca3a74ee590bf5a6c4edb522b791eeb8
Merge: 5f8b585349 070d4412ee
Author: Protesilaos Stavrou 
Commit: GitHub 

Merge pull request #28 from ggjp/subdir-support

Set org-id-extra-files to all files in all subdirectories.
---
 denote.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index bafba9c65c..039a8ffd7f 100644
--- a/denote.el
+++ b/denote.el
@@ -260,7 +260,7 @@ We consider those characters illigal for our purposes.")
 (unless (file-directory-p path)
   (make-directory path t))
 (when (require 'org-id nil :noerror)
-  (setq org-id-extra-files (directory-files path nil "\.org$")))
+  (setq org-id-extra-files (directory-files-recursively path "\.org$")))
 (file-name-as-directory path)))
 
 (defun denote--extract (regexp str &optional group)



[elpa] externals/denote 2aaf0f56d1 05/27: Add regexp to match only note file names

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 2aaf0f56d1bb415c9ba2fa9dc0bae705ac34df02
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Add regexp to match only note file names
---
 denote.el | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index c31b673c58..9c4abb2f55 100644
--- a/denote.el
+++ b/denote.el
@@ -227,6 +227,10 @@ is suspended: we use whatever the user wants."
   (concat denote--file-title-regexp "\\([0-9A-Za-z_-]*\\)\\(\\.?.*\\)")
   "Regular expression to match the entire file name'.")
 
+(defconst denote--file-only-note-regexp
+  (concat denote--file-regexp "\\.\\(org\\|md\\|txt\\)")
+  "Regular expression to match the entire file name of a note file.")
+
 (defconst denote--punctuation-regexp "[][{}!@#$%^&*()_=+'\"?,.\|;:~`‘’“”/]*"
   "Regular expression of punctionation that should be removed.
 We consider those characters illigal for our purposes.")
@@ -307,7 +311,7 @@ trailing hyphen."
 FILE is relative to the variable `denote-directory'."
   (and (not (file-directory-p file))
(file-regular-p file)
-   (string-match-p (concat "\\b" denote--id-regexp) file)
+   (string-match-p denote--file-only-note-regexp file)
(not (string-match-p "[#~]\\'" file
 
 (defun denote--file-name-relative-to-denote-directory (file)



[elpa] externals/denote e1aeb459ea 19/27: Refine how faces are applied (extends 123fb2b)

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit e1aeb459eaab740f439e69d3811f6306a03adc62
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Refine how faces are applied (extends 123fb2b)
---
 denote-dired.el | 17 ++---
 denote-faces.el | 21 +
 denote-link.el  |  9 +++--
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/denote-dired.el b/denote-dired.el
index b607e3d02a..23bd006ff9 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -356,27 +356,14 @@ appropriate."
 
 (require 'denote-faces)
 
-(defconst denote-dired-font-lock-keywords
-  `((,denote--file-regexp
- (1 'denote-faces-date)
- (2 'denote-faces-time)
- (3 'denote-faces-delimiter)
- (4 'denote-faces-title)
- (5 'denote-faces-delimiter)
- (6 'denote-faces-keywords)
- (7 'denote-faces-extension))
-("_"
- (0 'denote-faces-delimiter t)))
-  "Keywords for fontification.")
-
 ;;;###autoload
 (define-minor-mode denote-dired-mode
   "Fontify all Denote-style file names in Dired."
   :global nil
   :group 'denote-dired
   (if denote-dired-mode
-  (font-lock-add-keywords nil denote-dired-font-lock-keywords t)
-(font-lock-remove-keywords nil denote-dired-font-lock-keywords))
+  (font-lock-add-keywords nil denote-faces-file-name-keywords t)
+(font-lock-remove-keywords nil denote-faces-file-name-keywords))
   (font-lock-flush (point-min) (point-max)))
 
 (defun denote-dired--modes-dirs-as-dirs ()
diff --git a/denote-faces.el b/denote-faces.el
index 2a5e32f1d4..6b7a9b4583 100644
--- a/denote-faces.el
+++ b/denote-faces.el
@@ -30,6 +30,8 @@
 
 ;;; Code:
 
+(require 'denote)
+
 (defgroup denote-faces ()
   "Faces for Denote."
   :group 'denote)
@@ -88,5 +90,24 @@ and seconds."
   "Face for file name delimiters in Dired buffers."
   :group 'denote-faces)
 
+(defconst denote-faces-file-name-keywords
+  `((,denote--file-regexp
+ (1 'denote-faces-date)
+ (2 'denote-faces-time)
+ (3 'denote-faces-delimiter)
+ (4 'denote-faces-title)
+ (5 'denote-faces-delimiter)
+ (6 'denote-faces-keywords)
+ (7 'denote-faces-extension))
+("_"
+ (0 'denote-faces-delimiter t)))
+  "Keywords for fontification of file names.")
+
+(defconst denote-faces-file-name-with-subdir-keywords
+  (append denote-faces-file-name-keywords
+  '(("\\(^.*/\\)?"
+ (0 'denote-faces-subdirectory
+  "Keywords for fontification of file names with a directory.")
+
 (provide 'denote-faces)
 ;;; denote-faces.el ends here
diff --git a/denote-link.el b/denote-link.el
index d75823b15b..7cf4ded930 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -424,8 +424,6 @@ positions, limit the process to the region in-between."
   "Action for BUTTON to `find-file'."
   (funcall denote-link-buton-action (buffer-substring (button-start button) 
(button-end button
 
-(declare-function denote-dired-mode "denote-dired")
-
 (defun denote-link--display-buffer (buf)
   "Run `display-buffer' on BUF.
 Expand `denote-link-backlinks-display-buffer-action'."
@@ -433,6 +431,8 @@ Expand `denote-link-backlinks-display-buffer-action'."
buf
`(,@denote-link-backlinks-display-buffer-action)))
 
+(require 'denote-faces)
+
 (defun denote-link--prepare-backlinks (id files &optional title)
   "Create backlinks' buffer for ID including FILES.
 Use optional TITLE for a prettier heading."
@@ -452,11 +452,8 @@ Use optional TITLE for a prettier heading."
   (newline))
 files)
   (goto-char (point-min))
-  ;; NOTE 2022-06-15: Technically this is not Dired.  Maybe we
-  ;; should abstract the fontification into a general purpose
-  ;; minor-mode.
   (when denote-link-fontify-backlinks
-(denote-dired-mode 1)))
+(font-lock-add-keywords nil 
denote-faces-file-name-with-subdir-keywords t)))
 (denote-link--display-buffer buf)))
 
 ;;;###autoload



[elpa] externals/denote 58637a0035 04/27: Tweak doc string

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 58637a0035aed5e700e6eb7c6581a11782004eb1
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Tweak doc string
---
 denote.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index b785672a9a..c31b673c58 100644
--- a/denote.el
+++ b/denote.el
@@ -326,7 +326,7 @@ FILE must be an absolute path."
  Keywords
 
 (defun denote--directory-files (&optional absolute)
-  "List note files, assuming flat directory.
+  "List note files.
 If optional ABSOLUTE, show full paths, else only show base file
 names that are relative to the variable `denote-directory'."
   (let* ((default-directory (denote-directory))



[elpa] externals/denote eb7b38fe16 20/27: Merge branch 'main' into subdir-support

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit eb7b38fe1610385eb38a1de54fdec9c513173d56
Merge: e1aeb459ea e59b606e19
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Merge branch 'main' into subdir-support
---
 README.org | 48 
 denote.el  | 39 +++
 2 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/README.org b/README.org
index 989f5da832..16c1874d9c 100644
--- a/README.org
+++ b/README.org
@@ -432,10 +432,10 @@ This is how it looks for Org mode (~denote-file-type~ is 
nil):
 
 #+begin_src org
 :PROPERTIES:
-:ID:  20220610T202537
+:ID:  20220630T160934
 :END:
 ,#+title:  This is a sample note
-,#+date:   2022-06-10
+,#+date:   [2022-06-30 Thu 16:09]
 ,#+filetags:   denote  testing
 #+end_src
 
@@ -449,9 +449,9 @@ For Markdown with YAML, the front matter looks like this
 #+begin_src md
 ---
 title:  "This is a sample note"
-date:   2022-06-10
+date:   2022-06-30T16:09:58+03:00
 tags:   denote  testing
-identifier: "20220610T202021"
+identifier: "20220630T160958"
 ---
 #+end_src
 
@@ -461,9 +461,9 @@ For Markdown with TOML, it looks like this 
(~denote-file-type~ has the
 #+begin_src md
 +++
 title  = "This is a sample note"
-date   = 2022-06-10
+date   = 2022-06-30T16:10:13+03:00
 tags   = ["denote", "testing"]
-identifier = "20220610T201510"
+identifier = "20220630T161013"
 +++
 #+end_src
 
@@ -472,31 +472,31 @@ And for plain text, we have the following 
(~denote-file-type~ has the
 
 #+begin_example
 title:  This is a sample note
-date:   2022-06-10
+date:   2022-06-30
 tags:   denote  testing
-identifier: 20220610T202232
+identifier: 20220630T161028
 ---
 #+end_example
 
-#+vindex: denote-front-matter-date-format
+#+vindex: denote-date-format
 The format of the date in the front matter is controlled by the user
-option ~denote-front-matter-date-format~:
+option ~denote-date-format~.  When nil, Denote uses a file-type-specific
+format:
+
+- For Org, an inactive timestamp is used, such as
+  =[2022-06-30 Wed 06:19]=.
 
-- When the value is nil (the default), the date uses a plain
-  =YEAR-MONTH-DAY= notation, like =2022-06-08= (the ISO 8601 standard).
+- For Markdowmn, the RFC3339 standard is applied:
+  =2022-06-30T15:48:00+03:00=.
 
-- When the value is the =org-timestamp= symbol, the date is recorded as
-  an inactive Org timestamp, such as =[2022-06-08 Wed 06:19]=.
+- For plain text, the format is that of ISO 8601: =2022-06-30=.
 
-- An arbitrary string value is interpreted as the argument for the
-  function ~format-time-string~.  This gives the user maximum control
-  over how time is represented in the front matter.
+If the value is a string, ignore the above and use it instead.  The
+string must include format specifiers for the date.  These are described
+in the doc string of ~format-time-string~..
 
-When ~denote-file-type~ specifies one of the Markdown flavors, we ignore
-this user option in order to enforce the RFC3339 specification (Markdown
-is typically employed in static site generators as source code for Web
-pages).  However, when ~denote-front-matter-date-format~ has a string
-value, this rule is suspended: we use whatever the user wants.
+[ DEV NOTE: ~denote-date-format~ supersedes the now obsolete
+  ~denote-front-matter-date-format~ as part of {{{development-version}}} ]
 
 ** Tweaking the front matter
 :PROPERTIES:
@@ -1456,7 +1456,7 @@ Everything is in place to set up the package.
 ;; preference is for single-word keywords for a more rigid workflow.
 (setq denote-allow-multi-word-keywords t)
 
-(setq denote-front-matter-date-format nil) ; change this to `org-timestamp' or 
custom string
+(setq denote-date-format nil) ; read doc string
 
 ;; You will not need to `require' all those individually once the
 ;; package is available.
@@ -1942,7 +1942,7 @@ Denote is meant to be a collective effort.  Every bit of 
help matters.
   Jean-Philippe Gagné Guay, Kaushal Modi.
 
 + Ideas and/or user feedback :: Colin McLear, Damien Cassou, Frank
-  Ehmsen, Jack Baty, Kaushal Modi, M. Hadi Timachi, Sven Seebeck, Ypot.
+  Ehmsen, Jack Baty, Kaushal Modi, Peter Prevos, Sven Seebeck, Ypot.
 
 Special thanks to Peter Povinec who helped refine the file-naming
 scheme, which is the cornerstone of this project.
diff --git a/denote.el b/denote.el
index 824d04d89a..bafba9c65c 100644
--- a/denote.el
+++ b/denote.el
@@ -188,31 +188,29 @@ Any other non-nil value is the same as the default."
   (const :tag "Plain text" text))
   :group 'denote)
 
-(defcustom denote-front-matter-date-format nil
+(defcustom denote-date-format nil
   "Date format in the front matter (file header) of new notes.
 
-If the value is nil, use a plain date in YEAR-MONTH-DAY notation,
-like 2022-06-08 (the ISO 8601 standard).
+When nil, use a file-type-specific format:
 
-If the value is the `org-timestamp' symbol, format the date as a

[elpa] externals/denote ce791f5e42 26/27: Keep filename intact for backlink creation

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit ce791f5e429fdd89e36ae4af02bbb381f470bd90
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Keep filename intact for backlink creation

This is to ensure that links to/from subdirectories work as intended.  A
bug pertaining to the old code was reported by Shreyas Ragavan on the
mailing list:

.
---
 denote-link.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/denote-link.el b/denote-link.el
index b1c97959f2..5de8dabc60 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -468,7 +468,7 @@ option `denote-link-backlinks-display-buffer-action'.  By
 default, it will show up below the current window."
   (interactive)
   (let* ((default-directory (denote-directory))
- (file (file-name-nondirectory (buffer-file-name)))
+ (file (buffer-file-name))
  (id (denote-retrieve--filename-identifier file))
  (title (denote-retrieve--value-title file)))
 (if-let ((files (denote-retrieve--proces-grep id)))



[elpa] externals/denote 66e455ef84 14/27: Fix denote--current-file-is-note-p for subdirectories

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 66e455ef844a71a6936963bbe803fc3e2f4cc3a2
Author: Jean-Philippe Gagné Guay 
Commit: Jean-Philippe Gagné Guay 

Fix denote--current-file-is-note-p for subdirectories
---
 denote.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 21a8ce19ac..26f0168c34 100644
--- a/denote.el
+++ b/denote.el
@@ -327,7 +327,7 @@ FILE must be an absolute path."
   "Return non-nil if current file likely is a Denote note."
   (and (or (string-match-p denote--id-regexp (buffer-file-name))
(string-match-p denote--id-regexp (buffer-name)))
-   (string= (expand-file-name default-directory) (denote-directory
+   (string-prefix-p (denote-directory) (expand-file-name 
default-directory
 
  Keywords
 



[elpa] externals/denote 01618516ff 07/27: Refine denote--file-name-relative-to-denote-directory

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 01618516ff09afb19302b20fe49c48e222ca45b8
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Refine denote--file-name-relative-to-denote-directory
---
 denote.el | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/denote.el b/denote.el
index 58ea9ed912..f57ce463e0 100644
--- a/denote.el
+++ b/denote.el
@@ -317,9 +317,11 @@ FILE is relative to the variable `denote-directory'."
 (defun denote--file-name-relative-to-denote-directory (file)
   "Return file name of FILE relative to the variable `denote-directory'.
 FILE must be an absolute path."
-  (if (and (file-name-absolute-p file)
-   (string-prefix-p (denote-directory) file))
-(substring-no-properties file (length (denote-directory)
+  (if-let* ((dir (denote-directory))
+((file-name-absolute-p file))
+((string-prefix-p dir file)))
+  (substring-no-properties file (length dir))
+file))
 
 (defun denote--current-file-is-note-p ()
   "Return non-nil if current file likely is a Denote note."



[elpa] externals/denote 070d4412ee 23/27: Set org-id-extra-files to all files in all subdirectories.

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 070d4412ee89a5c2e24d350f3d3b1ad67f98
Author: Jean-Philippe Gagné Guay 
Commit: Jean-Philippe Gagné Guay 

Set org-id-extra-files to all files in all subdirectories.

Clicking on an id: link to a note in a subdirectory should work.
---
 denote.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index bafba9c65c..039a8ffd7f 100644
--- a/denote.el
+++ b/denote.el
@@ -260,7 +260,7 @@ We consider those characters illigal for our purposes.")
 (unless (file-directory-p path)
   (make-directory path t))
 (when (require 'org-id nil :noerror)
-  (setq org-id-extra-files (directory-files path nil "\.org$")))
+  (setq org-id-extra-files (directory-files-recursively path "\.org$")))
 (file-name-as-directory path)))
 
 (defun denote--extract (regexp str &optional group)



[elpa] externals/denote eb3ea19637 10/27: Document subdir support as part of dev version

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit eb3ea196371dcd0d3e73c8bffde518ec5389166f
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Document subdir support as part of dev version
---
 README.org | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index 85dfd81163..989f5da832 100644
--- a/README.org
+++ b/README.org
@@ -129,8 +129,14 @@ Obligations, Tasks, and Engagements.
 :END:
 
 #+vindex: denote-directory
-Notes are stored as a flat list in the ~denote-directory~ (i.e. no
-subdirectories).  The default path is =~/Documents/notes=.
+Notes are stored the ~denote-directory~.  The default path is
+=~/Documents/notes=.  The ~denote-directory~ can be a flat listing,
+meaning that it has no subdirectories, or it can be a directory tree.
+At any rate, Denote takes care to only consider "notes" as valid
+candidates in the relevant operations and will omit other files or
+directories.
+
+[ Subdirectory support is part of {{{development-version}}} ]
 
 Every note produced by Denote follows this pattern 
([[#h:17896c8c-d97a-4faa-abf6-31df99746ca6][Points of entry]]):
 



[elpa] externals/denote 25e86bf0bc 27/27: Update Acknowledgements in the manual

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 25e86bf0bc0b64745b88fc1e54a31f12b6c0d91f
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Update Acknowledgements in the manual
---
 README.org | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index b03068261a..2a817aec18 100644
--- a/README.org
+++ b/README.org
@@ -1945,8 +1945,8 @@ Denote is meant to be a collective effort.  Every bit of 
help matters.
   Jean-Philippe Gagné Guay, Kaushal Modi.
 
 + Ideas and/or user feedback :: Colin McLear, Damien Cassou, Frank
-  Ehmsen, Jack Baty, Kaushal Modi, M. Hadi Timachi, Peter Prevos, Sven
-  Seebeck, Ypot.
+  Ehmsen, Jack Baty, Kaushal Modi, M. Hadi Timachi, Peter Prevos,
+  Shreyas Ragavan, Sven Seebeck, Ypot.
 
 Special thanks to Peter Povinec who helped refine the file-naming
 scheme, which is the cornerstone of this project.



[elpa] externals/denote c88d9daaf1 1/4: Fix issue in denote-retrieve.el and refactor the code.

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit c88d9daaf1ee3c577c5c99e4cc8dc38d771e0aae
Author: Jean-Philippe Gagné Guay 
Commit: Jean-Philippe Gagné Guay 

Fix issue in denote-retrieve.el and refactor the code.

When a note title ended with a ")" (or other special characters),
denote-retrieve--value-title did not return the last character.

The regexps have been modified to focus only on the key part of the
line. The value part is easy to retrieve once the key is matched. We
just need to trim (of spaces and quotes) the remainder of the line.

denote-retrieve--value has been removed. denote-retrieve--search is
doing all the work. Given a KEY-REGEXP, it retrieves the value part of
the matching line. With optional KEY argument, it retrieves the key
part instead.
---
 denote-dired.el|  2 +-
 denote-retrieve.el | 80 --
 2 files changed, 37 insertions(+), 45 deletions(-)

diff --git a/denote-dired.el b/denote-dired.el
index 4e20b5aa47..9da31ce205 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -284,7 +284,7 @@ TITLE, DATE, KEYWORDS, FILENAME, ID, and FILETYPE are all 
strings
   "Return likely file type of FILE.
 The return value is for `denote--file-meta-header'."
   (pcase (file-name-extension file)
-("md" (if (string-match-p "title\\s-*=" (denote-retrieve--value-title file 
0))
+("md" (if (string-match-p "title\\s-*=" (denote-retrieve--value-title file 
t))
   'markdown-toml
 'markdown-yaml))
 ("txt" 'text)
diff --git a/denote-retrieve.el b/denote-retrieve.el
index 22c46f9366..3d63b2c8b9 100644
--- a/denote-retrieve.el
+++ b/denote-retrieve.el
@@ -32,23 +32,17 @@
 (require 'denote)
 (require 'xref)
 
-(defconst denote-retrieve--title-front-matter-regexp
-  "^\\(?:#\\+\\)?\\(?:title\\)\\s-*[:=]\\s-*[\"']?\\(?1:.*\\b\\)[\"']?"
-  "Regular expression for title key and value.
-The match that needs to be extracted is explicityly marked as
-group 1.")
-
-(defconst denote-retrieve--id-front-matter-regexp
-  
"^.?.?\\b\\(?:identifier\\|[Ii][Dd]\\)\\s-*[:=]\\s-*[\"']?\\(?1:[0-9T]+\\)[\"']?"
-  "Regular expression for identifier key and value.
-The match that needs to be extracted is explicityly marked as
-group 1.")
-
-(defconst denote-retrieve--date-front-matter-regexp
-  "^\\(?:#\\+\\)?\\(?:date\\)\\s-*[:=]\\s-*[\"']?\\(?1:.*\\b]?\\)[\"']?"
-  "Regular expression for date key and value.
-The match that needs to be extracted is explicityly marked as
-group 1.")
+(defconst denote-retrieve--title-front-matter-key-regexp
+  "^\\(?:#\\+\\)?\\(?:title\\)\\s-*[:=]"
+  "Regular expression for title key.")
+
+(defconst denote-retrieve--id-front-matter-key-regexp
+  "^.?.?\\b\\(?:identifier\\|[Ii][Dd]\\)\\s-*[:=]"
+  "Regular expression for identifier key.")
+
+(defconst denote-retrieve--date-front-matter-key-regexp
+  "^\\(?:#\\+\\)?\\(?:date\\)\\s-*[:=]"
+  "Regular expression for date key.")
 
 (defun denote-retrieve--filename-identifier (file)
   "Extract identifier from FILE name."
@@ -58,35 +52,33 @@ group 1.")
 (match-string 0 file))
 (error "Cannot find `%s' as a file" file)))
 
-(defun denote-retrieve--search (regexp &optional group)
-  "Search for REGEXP in the current buffer.
-With optional GROUP match it, else match group 1."
-  (save-excursion
-(save-restriction
-  (widen)
-  (goto-char (point-min))
-  (re-search-forward regexp nil t 1)
-  (unless (eq (point) (point-min))
-(match-string-no-properties (or group 1))
-
-(defun denote-retrieve--value (file regexp &optional group)
-  "Return REGEXP value from FILE.
-FILE is a note in the variable `denote-directory'.
-
-Optional GROUP is a regexp construct for
-`denote-retrieve--search'."
+(defun denote-retrieve--search (file key-regexp &optional key)
+  "Return the value associated with the KEY-REGEXP key in the
+current buffer from FILE.
+If optional KEY is non-nil, return the key instead."
   (with-temp-buffer
 (insert-file-contents file)
-(or (denote-retrieve--search regexp group)
-nil)))
-
-(defun denote-retrieve--value-title (file &optional group)
-  "Return title from FILE, optionally matching regexp GROUP."
-  (denote-retrieve--value file denote-retrieve--title-front-matter-regexp 
group))
-
-(defun denote-retrieve--value-date (file &optional group)
-  "Return date from FILE, optionally matching regexp GROUP."
-  (denote-retrieve--value file denote-retrieve--date-front-matter-regexp 
group))
+(save-excursion
+  (save-restriction
+(widen)
+(goto-char (point-min))
+(when (re-search-forward key-regexp nil t 1)
+  (if key
+  (match-string-no-properties 0)
+(let ((trims "[ \t\n\r\"']+"))
+  (string-trim
+   (buffer-substring-no-properties (point) (point-at-eol))
+   trims trims
+
+(defun denote-retrieve--value-title (file &optional key)
+  "Return title value from FIL

[elpa] externals/denote updated (25e86bf0bc -> 332512b144)

2022-07-02 Thread ELPA Syncer
elpasync pushed a change to branch externals/denote.

  from  25e86bf0bc Update Acknowledgements in the manual
   new  c88d9daaf1 Fix issue in denote-retrieve.el and refactor the code.
   new  b76eb3e20f Merge pull request #21 from ggjp/simplify-denote-retrieve
   new  b4d1a73629 Set default-value to previous title in 
denote--title-prompt
   new  332512b144 Merge pull request #30 from 
ggjp/default-title-when-renaming


Summary of changes:
 denote-dired.el| 11 
 denote-retrieve.el | 80 --
 denote.el  | 13 ++---
 3 files changed, 51 insertions(+), 53 deletions(-)



[elpa] externals/denote 332512b144 4/4: Merge pull request #30 from ggjp/default-title-when-renaming

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 332512b14469ccefcb0c9122f3471571da2ab73f
Merge: b76eb3e20f b4d1a73629
Author: Protesilaos Stavrou 
Commit: GitHub 

Merge pull request #30 from ggjp/default-title-when-renaming

Set default-value to previous title in denote--title-prompt

An empty input will just use the previous title. This would be useful if
you just want to update the tags.  When prompted for a title, using M-n
allows for editing of the previous title.
---
 denote-dired.el |  9 +
 denote.el   | 13 +
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/denote-dired.el b/denote-dired.el
index 727de90109..53c730a205 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -231,10 +231,11 @@ This command is intended to (i) rename existing Denote
 notes, (ii) complement note-taking, such as by renaming
 attachments that the user adds to their notes."
   (interactive
-   (list
-(denote-dired--rename-file-is-regular 
(denote-dired--rename-dired-file-or-prompt))
-(denote--title-prompt)
-(denote--keywords-prompt)))
+   (let ((file (denote-dired--rename-file-is-regular 
(denote-dired--rename-dired-file-or-prompt
+ (list
+  file
+  (denote--title-prompt (denote-retrieve--value-title file))
+  (denote--keywords-prompt
   (let* ((dir (file-name-directory file))
  (old-name (file-name-nondirectory file))
  (extension (file-name-extension file t))
diff --git a/denote.el b/denote.el
index 039a8ffd7f..909c8610e1 100644
--- a/denote.el
+++ b/denote.el
@@ -631,10 +631,15 @@ used to construct the path's identifier."
 (defvar denote--title-history nil
   "Minibuffer history of `denote--title-prompt'.")
 
-(defun denote--title-prompt ()
-  "Read file title for `denote'."
-  (setq denote-last-title
-(read-string "File title: " nil 'denote--title-history)))
+(defun denote--title-prompt (&optional default-title)
+  "Read file title for `denote'.
+
+Optional DEFAULT-TITLE is used as the default value."
+  (let ((format (if default-title
+(format " File title [%s]: " default-title)
+  "File title: ")))
+(setq denote-last-title
+  (read-string format nil 'denote--title-history default-title
 
 ;;;###autoload
 (defun denote (title keywords)



[elpa] externals/denote b76eb3e20f 2/4: Merge pull request #21 from ggjp/simplify-denote-retrieve

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit b76eb3e20fdd52f1451faeb93c7fea5ac095090e
Merge: 25e86bf0bc c88d9daaf1
Author: Protesilaos Stavrou 
Commit: GitHub 

Merge pull request #21 from ggjp/simplify-denote-retrieve

When a note title ends with `)`, denote-retrieve--title-front-matter-regexp 
does not capture the `)`.
---
 denote-dired.el|  2 +-
 denote-retrieve.el | 80 --
 2 files changed, 37 insertions(+), 45 deletions(-)

diff --git a/denote-dired.el b/denote-dired.el
index 23bd006ff9..727de90109 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -284,7 +284,7 @@ TITLE, DATE, KEYWORDS, FILENAME, ID, and FILETYPE are all 
strings
   "Return likely file type of FILE.
 The return value is for `denote--file-meta-header'."
   (pcase (file-name-extension file)
-("md" (if (string-match-p "title\\s-*=" (denote-retrieve--value-title file 
0))
+("md" (if (string-match-p "title\\s-*=" (denote-retrieve--value-title file 
t))
   'markdown-toml
 'markdown-yaml))
 ("txt" 'text)
diff --git a/denote-retrieve.el b/denote-retrieve.el
index b3479c210d..ec118d7821 100644
--- a/denote-retrieve.el
+++ b/denote-retrieve.el
@@ -32,23 +32,17 @@
 (require 'denote)
 (require 'xref)
 
-(defconst denote-retrieve--title-front-matter-regexp
-  "^\\(?:#\\+\\)?\\(?:title\\)\\s-*[:=]\\s-*[\"']?\\(?1:.*\\b\\)[\"']?"
-  "Regular expression for title key and value.
-The match that needs to be extracted is explicityly marked as
-group 1.")
-
-(defconst denote-retrieve--id-front-matter-regexp
-  
"^.?.?\\b\\(?:identifier\\|[Ii][Dd]\\)\\s-*[:=]\\s-*[\"']?\\(?1:[0-9T]+\\)[\"']?"
-  "Regular expression for identifier key and value.
-The match that needs to be extracted is explicityly marked as
-group 1.")
-
-(defconst denote-retrieve--date-front-matter-regexp
-  "^\\(?:#\\+\\)?\\(?:date\\)\\s-*[:=]\\s-*[\"']?\\(?1:.*\\b]?\\)[\"']?"
-  "Regular expression for date key and value.
-The match that needs to be extracted is explicityly marked as
-group 1.")
+(defconst denote-retrieve--title-front-matter-key-regexp
+  "^\\(?:#\\+\\)?\\(?:title\\)\\s-*[:=]"
+  "Regular expression for title key.")
+
+(defconst denote-retrieve--id-front-matter-key-regexp
+  "^.?.?\\b\\(?:identifier\\|[Ii][Dd]\\)\\s-*[:=]"
+  "Regular expression for identifier key.")
+
+(defconst denote-retrieve--date-front-matter-key-regexp
+  "^\\(?:#\\+\\)?\\(?:date\\)\\s-*[:=]"
+  "Regular expression for date key.")
 
 (defun denote-retrieve--filename-identifier (file)
   "Extract identifier from FILE name."
@@ -58,35 +52,33 @@ group 1.")
 (match-string 0 file))
 (error "Cannot find `%s' as a file" file)))
 
-(defun denote-retrieve--search (regexp &optional group)
-  "Search for REGEXP in the current buffer.
-With optional GROUP match it, else match group 1."
-  (save-excursion
-(save-restriction
-  (widen)
-  (goto-char (point-min))
-  (re-search-forward regexp nil t 1)
-  (unless (eq (point) (point-min))
-(match-string-no-properties (or group 1))
-
-(defun denote-retrieve--value (file regexp &optional group)
-  "Return REGEXP value from FILE.
-FILE is a note in the variable `denote-directory'.
-
-Optional GROUP is a regexp construct for
-`denote-retrieve--search'."
+(defun denote-retrieve--search (file key-regexp &optional key)
+  "Return the value associated with the KEY-REGEXP key in the
+current buffer from FILE.
+If optional KEY is non-nil, return the key instead."
   (with-temp-buffer
 (insert-file-contents file)
-(or (denote-retrieve--search regexp group)
-nil)))
-
-(defun denote-retrieve--value-title (file &optional group)
-  "Return title from FILE, optionally matching regexp GROUP."
-  (denote-retrieve--value file denote-retrieve--title-front-matter-regexp 
group))
-
-(defun denote-retrieve--value-date (file &optional group)
-  "Return date from FILE, optionally matching regexp GROUP."
-  (denote-retrieve--value file denote-retrieve--date-front-matter-regexp 
group))
+(save-excursion
+  (save-restriction
+(widen)
+(goto-char (point-min))
+(when (re-search-forward key-regexp nil t 1)
+  (if key
+  (match-string-no-properties 0)
+(let ((trims "[ \t\n\r\"']+"))
+  (string-trim
+   (buffer-substring-no-properties (point) (point-at-eol))
+   trims trims
+
+(defun denote-retrieve--value-title (file &optional key)
+  "Return title value from FILE.
+If optional KEY is non-nil, return the key instead."
+  (denote-retrieve--search file denote-retrieve--title-front-matter-key-regexp 
key))
+
+(defun denote-retrieve--value-date (file &optional key)
+  "Return date value from FILE.
+If optional KEY is non-nil, return the key instead."
+  (denote-retrieve--search file denote-retrieve--date-front-matter-key-regexp 
key))
 
 (defun denote-retrieve--read-file-prompt ()
   "Prompt for regular file in variable `denote-directory'."



[elpa] externals/denote b4d1a73629 3/4: Set default-value to previous title in denote--title-prompt

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit b4d1a73629ca7b80a9724c86bb3d99af919bd719
Author: Jean-Philippe Gagné Guay 
Commit: Jean-Philippe Gagné Guay 

Set default-value to previous title in denote--title-prompt

denote--title-prompt accepts a DEFAULT-TITLE parameter which the
command denote-dired-rename-file sets to the previous title
---
 denote-dired.el |  9 +
 denote.el   | 13 +
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/denote-dired.el b/denote-dired.el
index 23bd006ff9..c24717d49b 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -231,10 +231,11 @@ This command is intended to (i) rename existing Denote
 notes, (ii) complement note-taking, such as by renaming
 attachments that the user adds to their notes."
   (interactive
-   (list
-(denote-dired--rename-file-is-regular 
(denote-dired--rename-dired-file-or-prompt))
-(denote--title-prompt)
-(denote--keywords-prompt)))
+   (let ((file (denote-dired--rename-file-is-regular 
(denote-dired--rename-dired-file-or-prompt
+ (list
+  file
+  (denote--title-prompt (denote-retrieve--value-title file))
+  (denote--keywords-prompt
   (let* ((dir (file-name-directory file))
  (old-name (file-name-nondirectory file))
  (extension (file-name-extension file t))
diff --git a/denote.el b/denote.el
index 039a8ffd7f..909c8610e1 100644
--- a/denote.el
+++ b/denote.el
@@ -631,10 +631,15 @@ used to construct the path's identifier."
 (defvar denote--title-history nil
   "Minibuffer history of `denote--title-prompt'.")
 
-(defun denote--title-prompt ()
-  "Read file title for `denote'."
-  (setq denote-last-title
-(read-string "File title: " nil 'denote--title-history)))
+(defun denote--title-prompt (&optional default-title)
+  "Read file title for `denote'.
+
+Optional DEFAULT-TITLE is used as the default value."
+  (let ((format (if default-title
+(format " File title [%s]: " default-title)
+  "File title: ")))
+(setq denote-last-title
+  (read-string format nil 'denote--title-history default-title
 
 ;;;###autoload
 (defun denote (title keywords)



[elpa] externals/denote 6dbea94b23: Set denote-link-use-org-id to nil (undo 2193501)

2022-07-02 Thread ELPA Syncer
branch: externals/denote
commit 6dbea94b235c255e1f5113a32c9b93f34d73f2db
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Set denote-link-use-org-id to nil (undo 2193501)

A non-nil value requires extra setup and comes with potential downsides.
We need to account for them and provide solutions where appropriate.

Read issue 29 on the GitHub mirror:
.
---
 README.org | 26 ++
 denote-link.el | 10 ++
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/README.org b/README.org
index 2a817aec18..4c2cff5681 100644
--- a/README.org
+++ b/README.org
@@ -647,17 +647,19 @@ When ~denote-link~ is called with a prefix argument 
(=C-u= by default)
 it formats links like =[[denote:IDENTIFIER]]=.  The user might prefer
 its simplicity.
 
-[ Default value of ~denote-link-use-org-id~ changed as part of
-  {{{development-version}}} ]
-
 #+vindex: denote-link-use-org-id
 When the user option ~denote-link-use-org-id~ is set to non-nil (the
-default), inserted links in Org notes that target other Org notes will
-use the standard =id:= type so the format is =[[id:IDENTIFIER][TITLE]]=
-(the title is omitted is ~denote-link~ is called with a prefix argument,
-as explained above).  When, however, an Org note links to a note in
-another file, the link with use our own =denote:= type as there is no
-standard for this case.
+default is nil), inserted links in Org notes that target other Org notes
+will use the standard =id:= hyperlink type.  The format is
+=[[id:IDENTIFIER][TITLE]]= (the title is omitted if ~denote-link~ is
+called with a prefix argument, as explained above).  When, however, an
+Org note links to a note of another file type (e.g Org to Markdown), the
+link will use our own =denote:= type as there is no standard for this
+case.
+
+# TODO 2022-07-03: Document potential downsides of the 'id:' type and
+# write documentation on what the user must do to ensure that everything
+# works properly.
 
 Inserted links are automatically buttonized and remain active for as
 long as the buffer is available.  In Org this is handled automatically
@@ -1466,9 +1468,9 @@ Everything is in place to set up the package.
 (require 'denote-retrieve)
 (require 'denote-link)
 
-;; If you want links to and from Org notes to use the standard 'id:'
-;; link type instead of 'denote:'.
-(setq denote-link-use-org-id t)
+;; Set to non-nil if you want links to and from Org notes to use the
+;; standard 'id:' link type instead of 'denote:'.
+(setq denote-link-use-org-id nil)
 
 ;; By default, we fontify backlinks in their bespoke buffer.
 (setq denote-link-fontify-backlinks t)
diff --git a/denote-link.el b/denote-link.el
index 5de8dabc60..6e7874acb0 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -200,7 +200,9 @@ and/or the documentation string of `display-buffer'."
alist)
   :group 'denote-link)
 
-(defcustom denote-link-use-org-id t
+;; TODO 2022-07-03: After "ecosystem" elaborate on the responsibility
+;; the user has to ensure things continue to work.
+(defcustom denote-link-use-org-id nil
   "When non-nil use the ID link type in Org files, if appropriate.
 
 Newly created links from Org notes which target other Org notes
@@ -211,9 +213,9 @@ will use the standard `id:' hyperlink type instead of the 
custom
 In practical terms, the ID ensures maximum compatibility with
 other tools in the Org ecosystem.
 
-When the value is nil, Denote links rely on the custom `denote:'
-hyperlink type (which should behave the same as the standard
-`file:' link).
+When the value is nil (the default), Denote links rely on the
+custom `denote:' hyperlink type (which should behave the same as
+the standard `file:' link).
 
 Other file types beside Org always use the `denote:' links."
   :type 'boolean