[elpa] externals-release/org updated (3e4c89e556 -> 84945f9de0)

2024-06-12 Thread ELPA Syncer
elpasync pushed a change to branch externals-release/org.

  from  3e4c89e556 org-image--align: Fix image alignment when image is not 
inside paragraph
   new  a0950e9432 org-babel-execute-src-block: Handle code block moving 
point
   new  84945f9de0 orgtbl-gather-send-defs: Fix infinite loop when table is 
at bob


Summary of changes:
 lisp/ob-core.el   |  6 +-
 lisp/org-table.el | 18 ++
 2 files changed, 15 insertions(+), 9 deletions(-)



[elpa] externals-release/org 84945f9de0 2/2: orgtbl-gather-send-defs: Fix infinite loop when table is at bob

2024-06-12 Thread ELPA Syncer
branch: externals-release/org
commit 84945f9de037949b2be3801acb496540c9365722
Author: Ihor Radchenko 
Commit: Ihor Radchenko 

orgtbl-gather-send-defs: Fix infinite loop when table is at bob

* lisp/org-table.el (orgtbl-gather-send-defs): Avoid infinite loop
when table is at the beginning of buffer.

Reported-by: Rustom Mody 
Link: 
https://orgmode.org/list/caj+teoehk30lkvctwmy0urebhknvbvroldzybouq4wbv6fn...@mail.gmail.com
---
 lisp/org-table.el | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 37ce91570d..4a2623b553 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -5477,14 +5477,16 @@ a radio table."
 (goto-char (org-table-begin))
 (let (rtn)
   (forward-line -1)
-  (while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ 
\t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
-   (let ((name (org-no-properties (match-string 1)))
- (transform (intern (match-string 2)))
- (params (if (match-end 3)
- (read (concat "(" (match-string 3) ")")
- (push (list :name name :transform transform :params params)
-   rtn)
- (forward-line -1)))
+  (catch :bob
+(while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ 
\t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
+ (let ((name (org-no-properties (match-string 1)))
+   (transform (intern (match-string 2)))
+   (params (if (match-end 3)
+   (read (concat "(" (match-string 3) ")")
+   (push (list :name name :transform transform :params params)
+ rtn)
+(when (bobp) (throw :bob nil))
+   (forward-line -1
   rtn)))
 
 (defun orgtbl-send-replace-tbl (name text)



[elpa] externals/org updated (e24c2408e7 -> 959534ba11)

2024-06-12 Thread ELPA Syncer
elpasync pushed a change to branch externals/org.

  from  e24c2408e7 Merge branch 'bugfix'
   new  a0950e9432 org-babel-execute-src-block: Handle code block moving 
point
   new  84945f9de0 orgtbl-gather-send-defs: Fix infinite loop when table is 
at bob
   new  3232cc1619 Merge branch 'bugfix'
   new  959534ba11 ob-sql: Quote all the shell arguments originating from 
Org buffer


Summary of changes:
 lisp/ob-core.el   |  6 +++-
 lisp/ob-sql.el| 90 +++
 lisp/org-table.el | 18 ++-
 3 files changed, 66 insertions(+), 48 deletions(-)



[elpa] externals-release/org a0950e9432 1/2: org-babel-execute-src-block: Handle code block moving point

2024-06-12 Thread ELPA Syncer
branch: externals-release/org
commit a0950e943236b67794754c1da74bb0b001d625ba
Author: Ihor Radchenko 
Commit: Ihor Radchenko 

org-babel-execute-src-block: Handle code block moving point

* lisp/ob-core.el (org-babel-execute-src-block): Make sure that point
remain on src block after evaluation.  The function logic later
implicitly assumes that the point is on the block that has been
evaluated.
---
 lisp/ob-core.el | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index d1984b2d6f..2e0e86f70c 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -893,7 +893,11 @@ guess will be made."
  (format "at position %S" (nth 5 info)
(setq exec-start-time (current-time)
   result
- (let ((r (save-current-buffer (funcall cmd body params
+ (let ((r
+ ;; Code block may move point in the buffer.
+ ;; Make sure that the point remains on the
+ ;; code block.
+ (save-excursion (funcall cmd body params
(if (and (eq (cdr (assq :result-type params)) 'value)
 (or (member "vector" result-params)
 (member "table" result-params))



[elpa] externals/org 959534ba11 2/2: ob-sql: Quote all the shell arguments originating from Org buffer

2024-06-12 Thread ELPA Syncer
branch: externals/org
commit 959534ba1149bb29b1c731b34df9a339a54753e6
Author: Ihor Radchenko 
Commit: Ihor Radchenko 

ob-sql: Quote all the shell arguments originating from Org buffer

* lisp/ob-sql.el (org-babel-sql-dbstring-mysql):
(org-babel-sql-dbstring-postgresql):
(org-babel-sql-dbstring-oracle):
(org-babel-sql-dbstring-mssql):
(org-babel-sql-dbstring-sqsh):
(org-babel-sql-dbstring-vertica):
(org-babel-sql-dbstring-saphana):
(org-babel-execute:sql): Quote all the shell arguments to avoid
unexpect shell expansion.  Do not quote port as it is a number; make
sure that port is really demanded a number in the format strings.

Reported-by: Andrea 
Link: 
https://orgmode.org/list/du2p193mb24225f623dbf8b3d254d3c0e88...@du2p193mb2422.eurp193.prod.outlook.com
---
 lisp/ob-sql.el | 90 +-
 1 file changed, 51 insertions(+), 39 deletions(-)

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index dc067a4171..e51eed1bc3 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -117,23 +117,27 @@ corresponding :engine source block header argument."
 
 (defun org-babel-sql-dbstring-mysql (host port user password database)
   "Make MySQL cmd line args for database connection.  Pass nil to omit that 
arg."
-  (combine-and-quote-strings
+  (mapconcat
+   #'identity
(delq nil
-(list (when host (concat "-h" host))
+(list (when host (concat "-h" (shell-quote-argument host)))
   (when port (format "-P%d" port))
-  (when user (concat "-u" user))
-  (when password (concat "-p" password))
-  (when database (concat "-D" database))
+  (when user (concat "-u" (shell-quote-argument user)))
+  (when password (concat "-p" (shell-quote-argument password)))
+  (when database (concat "-D" (shell-quote-argument database)
+   " "))
 
 (defun org-babel-sql-dbstring-postgresql (host port user database)
   "Make PostgreSQL command line args for database connection.
 Pass nil to omit that arg."
-  (combine-and-quote-strings
+  (mapconcat
+   #'identity
(delq nil
-(list (when host (concat "-h" host))
+(list (when host (concat "-h" (shell-quote-argument host)))
   (when port (format "-p%d" port))
-  (when user (concat "-U" user))
-  (when database (concat "-d" database))
+  (when user (concat "-U" (shell-quote-argument user)))
+  (when database (concat "-d" (shell-quote-argument database)
+   " "))
 
 (defun org-babel-sql-dbstring-oracle (host port user password database)
   "Make Oracle command line arguments for database connection.
@@ -149,8 +153,12 @@ or
   /@
 
 using its alias."
+  (when user (setq user (shell-quote-argument user)))
+  (when password (setq password (shell-quote-argument password)))
+  (when database (setq database (shell-quote-argument database)))
+  (when host (setq host (shell-quote-argument host)))
   (cond ((and user password database host port)
-(format "%s/%s@%s:%s/%s" user password host port database))
+(format "%s/%s@%s:%d/%s" user password host port database))
((and user password database)
 (format "%s/%s@%s" user password database))
(t (user-error "Missing information to connect to database"
@@ -161,10 +169,10 @@ using its alias."
 SQL Server on Windows and Linux platform."
   (mapconcat #'identity
 (delq nil
-  (list (when host (format "-S \"%s\"" host))
-(when user (format "-U \"%s\"" user))
-(when password (format "-P \"%s\"" password))
-(when database (format "-d \"%s\"" database
+  (list (when host (format "-S \"%s\"" (shell-quote-argument 
host)))
+(when user (format "-U \"%s\"" (shell-quote-argument 
user)))
+(when password (format "-P \"%s\"" 
(shell-quote-argument password)))
+(when database (format "-d \"%s\"" 
(shell-quote-argument database)
 " "))
 
 (defun org-babel-sql-dbstring-sqsh (host user password database)
@@ -172,10 +180,10 @@ SQL Server on Windows and Linux platform."
 \"sqsh\" is one method to access Sybase or MS SQL via Linux platform"
   (mapconcat #'identity
  (delq nil
-   (list  (when host (format "-S \"%s\"" host))
-  (when user (format "-U \"%s\"" user))
-  (when password (format "-P \"%s\"" password))
-  (when database (format "-D \"%s\"" database
+   (list  (when host (format "-S \"%s\"" 
(shell-quote-argument host)))
+  (when user (format "-U \"%s\"" 
(shell-quote-argument user)))
+  (when password (format "-P \"%s\"" 
(shell-quote

[elpa] externals/org 3232cc1619 1/2: Merge branch 'bugfix'

2024-06-12 Thread ELPA Syncer
branch: externals/org
commit 3232cc16197d91439fc88f92afbce7947b72d449
Merge: e24c2408e7 84945f9de0
Author: Ihor Radchenko 
Commit: Ihor Radchenko 

Merge branch 'bugfix'
---
 lisp/ob-core.el   |  6 +-
 lisp/org-table.el | 18 ++
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index d1984b2d6f..2e0e86f70c 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -893,7 +893,11 @@ guess will be made."
  (format "at position %S" (nth 5 info)
(setq exec-start-time (current-time)
   result
- (let ((r (save-current-buffer (funcall cmd body params
+ (let ((r
+ ;; Code block may move point in the buffer.
+ ;; Make sure that the point remains on the
+ ;; code block.
+ (save-excursion (funcall cmd body params
(if (and (eq (cdr (assq :result-type params)) 'value)
 (or (member "vector" result-params)
 (member "table" result-params))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 37ce91570d..4a2623b553 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -5477,14 +5477,16 @@ a radio table."
 (goto-char (org-table-begin))
 (let (rtn)
   (forward-line -1)
-  (while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ 
\t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
-   (let ((name (org-no-properties (match-string 1)))
- (transform (intern (match-string 2)))
- (params (if (match-end 3)
- (read (concat "(" (match-string 3) ")")
- (push (list :name name :transform transform :params params)
-   rtn)
- (forward-line -1)))
+  (catch :bob
+(while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ 
\t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
+ (let ((name (org-no-properties (match-string 1)))
+   (transform (intern (match-string 2)))
+   (params (if (match-end 3)
+   (read (concat "(" (match-string 3) ")")
+   (push (list :name name :transform transform :params params)
+ rtn)
+(when (bobp) (throw :bob nil))
+   (forward-line -1
   rtn)))
 
 (defun orgtbl-send-replace-tbl (name text)



[nongnu] elpa/zenburn-theme 15f48bfc6b: Add support for window-tool-bar, added in Emacs 30.

2024-06-12 Thread ELPA Syncer
branch: elpa/zenburn-theme
commit 15f48bfc6b52d112f3c3fd98e533bda9138ffdd2
Author: Jared Finder 
Commit: Bozhidar Batsov 

Add support for window-tool-bar, added in Emacs 30.
---
 CHANGELOG.md |  1 +
 zenburn-theme.el | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75a4d15d80..aea1b2d7dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
 ### New features
 
 * Add `corfu` support.
+* Add `window-tool-bar` support.
 
 ## 2.8 (2023-03-15)
 
diff --git a/zenburn-theme.el b/zenburn-theme.el
index 3ab1a028ea..c309189fc1 100644
--- a/zenburn-theme.el
+++ b/zenburn-theme.el
@@ -1693,6 +1693,16 @@ Also bind `class' to ((class color) (min-colors 89))."
`(wl-highlight-summary-displaying-face ((t (:underline t :weight bold
 ; which-func-mode
`(which-func ((t (:foreground ,zenburn-green+4
+; window-tool-bar-mode
+   `(window-tool-bar-button ((t (:foreground ,zenburn-fg
+ :background ,zenburn-bg
+ :box (:line-width -1 :style 
released-button)
+   `(window-tool-bar-button-hover ((t (:foreground ,zenburn-fg
+   :background ,zenburn-bg+1
+   :box (:line-width -1 :style 
released-button)
+   `(window-tool-bar-button-disabled ((t (:foreground ,zenburn-fg
+  :background ,zenburn-bg+3
+  :box (:line-width -1 :style 
released-button)
 ; xcscope
`(cscope-file-face ((t (:foreground ,zenburn-yellow :weight bold
`(cscope-function-face ((t (:foreground ,zenburn-cyan :weight bold



[nongnu] scratch/editorconfig 3b1c10e556: WiP: eliminate O(N^2) complexity in fnmatch translation

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit 3b1c10e556222a53060c9984a30c43204100805b
Author: Stefan Monnier 
Commit: Stefan Monnier 

WiP: eliminate O(N^2) complexity in fnmatch translation
---
 editorconfig-fnmatch.el | 162 +---
 1 file changed, 84 insertions(+), 78 deletions(-)

diff --git a/editorconfig-fnmatch.el b/editorconfig-fnmatch.el
index 520aeb16c2..cb793124e5 100644
--- a/editorconfig-fnmatch.el
+++ b/editorconfig-fnmatch.el
@@ -53,13 +53,9 @@
 
 (require 'cl-lib)
 
-(defvar editorconfig-fnmatch--cache-hashtable
-  nil
+(defconst editorconfig-fnmatch--cache-hashtable
+  (make-hash-table :test 'equal)
   "Cache of shell pattern and its translation.")
-;; Clear cache on file reload
-(setq editorconfig-fnmatch--cache-hashtable
-  (make-hash-table :test 'equal))
-
 
 (defconst editorconfig-fnmatch--left-brace-regexp
   "\\(^\\|[^\\]\\){"
@@ -128,7 +124,7 @@ translation is found for PATTERN."
 (length (length pattern))
 (brace-level 0)
 (in-brackets nil)
-;; List of strings of resulting regexp
+;; List of strings of resulting regexp, in reverse order.
 (result ())
 (is-escaped nil)
 (matching-braces (= (editorconfig-fnmatch--match-num
@@ -141,8 +137,7 @@ translation is found for PATTERN."
 current-char
 pos
 has-slash
-has-comma
-num-range)
+has-comma)
 
 (while (< index length)
   (if (and (not is-escaped)
@@ -151,8 +146,8 @@ translation is found for PATTERN."
  pattern
  index)
(eq index (match-beginning 0)))
-  (setq result `(,@result ,(regexp-quote (match-string 0 pattern)))
-index (match-end 0)
+  (push (regexp-quote (match-string 0 pattern)) result)
+  (setq index (match-end 0)
 is-escaped nil)
 
 (setq current-char (aref pattern index)
@@ -161,21 +156,23 @@ translation is found for PATTERN."
 (cl-case current-char
   (?*
(setq pos index)
-   (if (and (< pos length)
-(= (aref pattern pos) ?*))
-   (setq result `(,@result ".*"))
- (setq result `(,@result "[^/]*"
+   (push (if (and (< pos length)
+  (= (aref pattern pos) ?*))
+ ".*"
+   "[^/]*")
+ result))
 
   (??
-   (setq result `(,@result "[^/]")))
+   (push "[^/]" result))
 
   (?\[
(if in-brackets
-   (setq result `(,@result "\\["))
+   (push "\\[" result)
  (if (= (aref pattern index) ?/)
  ;; Slash after an half-open bracket
- (setq result `(,@result "\\[/")
-   index (+ index 1))
+ (progn
+   (setq index (+ index 1))
+   (push "\\[/" result))
(setq pos index
  has-slash nil)
(while (and (< pos length)
@@ -186,28 +183,30 @@ translation is found for PATTERN."
  (setq has-slash t)
(setq pos (1+ pos
(if has-slash
-   (setq result `(,@result ,(concat "\\["
-(substring pattern
-   index
-   (1+ pos))
-"\\]"))
- index (+ pos 2))
- (if (and (< index length)
-  (memq (aref pattern index)
-'(?! ?^)))
- (setq index (1+ index)
-   result `(,@result "[^"))
-   (setq result `(,@result "[")))
- (setq in-brackets t)
+   (progn
+ (push (concat "\\["
+   (substring pattern
+  index
+  (1+ pos))
+   "\\]")
+   result)
+ (setq index (+ pos 2)))
+ (setq in-brackets t)
+ (push (if (and (< index length)
+(memq (aref pattern index)
+  '(?! ?^)))
+   (progn
+ (setq index (1+ index))
+ "[^")
+ "[")
+   result)
 
   (?-
-   (if in-brackets
-   (setq result `(,@result "-"))
- (setq result `(,@result "\\-"
+   (push (if in-brackets "-" "\\-") result))
 
   (?\]
-   (setq result `(,@result "]")

[nongnu] branch scratch/editorconfig deleted (was 3b1c10e556)

2024-06-12 Thread Stefan Monnier via
monnier pushed a change to branch scratch/editorconfig.

   was  3b1c10e556 WiP: eliminate O(N^2) complexity in fnmatch translation

This change permanently discards the following revisions:

  discards  3b1c10e556 WiP: eliminate O(N^2) complexity in fnmatch translation
  discards  205be47ee0 WiP: reduce allocation in parser
  discards  4a30b1f321 WiP
  discards  eff8ad8f30 WiP
  discards  fc9a90 Misc changes accrued while trying to run the tests
  discards  d80106fe3b Miscellaneous minor changes.
  discards  11327989c8 Use new Emacs-30 hooks
  discards  beec90f1c4 (editorconfig-set-local-variables): Get first, set later
  discards  a3c7e15a97 Cosmetic changes for compilation purposes



[nongnu] scratch/editorconfig 9f8cc3e6e8 1/2: (editorconfig-set-local-variables): Get first, set later

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit 9f8cc3e6e898e00da7ee06761ee46802807b0077
Author: Stefan Monnier 
Commit: Stefan Monnier 

(editorconfig-set-local-variables): Get first, set later

In preparation for the use of Emacs-30's
`hack-dir-local-get-variables-functions`, split the job of
`editorconfig-set-local-variables` into getting an alist of settings
and then applying them.

Rename the `editorconfig-set-*` functions to `editorconfig--get-*`
and make them return an alist of settings rather than applying them
(except for `editorconfig-set-coding-system-revert` which arguably
belongs in `editorconfig-tools.el` anyway).

* editorconfig.el (editorconfig-indentation-alist): Change the doc to
mention that the functions should return an alist.
Use the new `editorconfig--get-indentation-*-mode` functions.
(editorconfig--get-indentation-*-mode): Don't `boundp`-test the vars.
(editorconfig--get-indentation): Don't set `tab-width` from SIZE.
Don't test `editorconfig--should-set` here.  Test `boundp` here.
(editorconfig--get-trailing-ws): Use `before-save-hook`
instead of `write-file-functions`.  Still set the vars when disabling
the feature, but just return the setting in an alist instead when
enabling it.
(editorconfig-set-local-variables): Test `editorconfig--should-set` here.
Rewrite it using `editorconfig--get-local-variables`.
---
 editorconfig.el | 235 ++--
 1 file changed, 124 insertions(+), 111 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index e7bb3c90b1..e187cca7e8 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -38,6 +38,11 @@
 ;; EditorConfig files are easily readable and they work nicely with
 ;; version control systems.
 
+;; News:
+
+;; In `editorconfig-indentation-alist', if a mode is associated to a function
+;; that function should not set the vars but should instead *return* them.
+
 ;;; Code:
 
 (require 'cl-lib)
@@ -252,7 +257,7 @@ This hook will be run even when there are no matching 
sections in
 (julia-mode julia-indent-offset)
 (kotlin-mode kotlin-tab-width)
 (kotlin-ts-mode kotlin-ts-mode-indent-offset)
-(latex-mode . editorconfig-set-indentation-latex-mode)
+(latex-mode . editorconfig--get-indentation-latex-mode)
 (lisp-mode lisp-indent-offset)
 (livescript-mode livescript-tab-width)
 (lua-mode lua-indent-level)
@@ -280,8 +285,8 @@ This hook will be run even when there are no matching 
sections in
 (ps-mode ps-mode-tab)
 (pug-mode pug-tab-width)
 (puppet-mode puppet-indent-level)
-(python-mode . editorconfig-set-indentation-python-mode)
-(python-ts-mode . editorconfig-set-indentation-python-mode)
+(python-mode . editorconfig--get-indentation-python-mode)
+(python-ts-mode . editorconfig--get-indentation-python-mode)
 (rjsx-mode js-indent-level sgml-basic-offset)
 (ruby-mode ruby-indent-level)
 (ruby-ts-mode ruby-indent-level)
@@ -327,7 +332,8 @@ This hook will be run even when there are no matching 
sections in
 Each element looks like (MODE . FUNCTION) or (MODE . INDENT-SPEC-LIST).
 
 If FUNCTION is provided, it will be called when setting the
-indentation.  The indent size will be passed.
+indentation.  The indent size will be passed and it should return
+a list of settings of the form (VAR . VAL).
 
 If INDENT-SPEC-LIST is provided, each element of it must have one of the
 following forms:
@@ -438,26 +444,21 @@ Make a message by passing ARGS to `format-message'."
   (and (stringp string)
(string-match-p "\\`[0-9]+\\'" string)))
 
-(defun editorconfig-set-indentation-python-mode (size)
-  "Set `python-mode' indent size to SIZE."
-  (when (boundp 'python-indent-offset)
-(setq-local python-indent-offset size))
-  ;; For https://gitlab.com/python-mode-devs/python-mode
-  (when (boundp 'py-indent-offset)
-(setq-local py-indent-offset size)))
-
-(defun editorconfig-set-indentation-latex-mode (size)
-  "Set `latex-mode' indent size to SIZE."
-  (setq-local tex-indent-basic size)
-  (setq-local tex-indent-item size)
-  (setq-local tex-indent-arg (* 2 size))
-  ;; For AUCTeX
-  (when (boundp 'TeX-brace-indent-level)
-(setq-local TeX-brace-indent-level size))
-  (when (boundp 'LaTeX-indent-level)
-(setq-local LaTeX-indent-level size))
-  (when (boundp 'LaTeX-item-indent)
-(setq-local LaTeX-item-indent (- size
+(defun editorconfig--get-indentation-python-mode (size)
+  "Var to set `python-mode' indent size to SIZE."
+  `((python-indent-offset . ,size)
+;; For https://gitlab.com/python-mode-devs/python-mode
+(py-indent-offset . ,size)))
+
+(defun editorconfig--get-indentation-latex-mode (size)
+  "Vars to set `latex-mode' indent size to SIZE."
+  `((tex-indent-basic . ,size)
+(tex-indent-item . ,size)
+(tex-indent-arg . ,(* 2 size))
+;; For AUCTeX
+(TeX-brace-indent-level . ,size)
+(LaTeX-indent-level . ,

[nongnu] scratch/editorconfig ad60e1a93e 2/2: Use new Emacs-30 hooks

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit ad60e1a93eccd6e7953a41374a869aab5b022797
Author: Stefan Monnier 
Commit: Stefan Monnier 

Use new Emacs-30 hooks

* editorconfig.el (editorconfig--get-coding-system)
(editorconfig--get-dir-local-variables): New functions.
(editorconfig-mode): Use them if possible.
---
 editorconfig.el | 88 -
 1 file changed, 68 insertions(+), 20 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index e187cca7e8..cb21cad977 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -872,6 +872,38 @@ F is that function, and FILENAME and ARGS are arguments 
passed to F."
 (format "Error while setting variables from 
EditorConfig: %S" err
 ret))
 
+(defun editorconfig--get-coding-system (_size)
+  "Return the coding system to use according to EditorConfig.
+Meant to be used on `auto-coding-functions'."
+  (defvar auto-coding-file-name) ;; Emacs≥30
+  (when (and (stringp auto-coding-file-name)
+ (file-name-absolute-p auto-coding-file-name)
+;; Don't recurse infinitely.
+(not (string-match-p "\\.editorconfig\\'" auto-coding-file-name))
+ ;; FIXME: How important is it to support these `disabled-*'?
+ (not (editorconfig--disabled-for-filename auto-coding-file-name)))
+(let ((props (editorconfig-call-get-properties-function
+  auto-coding-file-name)))
+  (editorconfig-merge-coding-systems (gethash 'end_of_line props)
+ (gethash 'charset props)
+
+(defun editorconfig--get-dir-local-variables ()
+  "Return the directory local variables specified via EditorConfig.
+Meant to be used on `hack-dir-local-get-variables-functions'."
+  (when (and (stringp buffer-file-name)
+ ;; FIXME: How important is it to support these `disabled-*'?
+ (not (editorconfig--disabled-for-filename buffer-file-name))
+ (not (editorconfig--disabled-for-majormode major-mode)))
+(let* ((props (editorconfig-call-get-properties-function buffer-file-name))
+   (alist (editorconfig--get-local-variables props)))
+  ;; FIXME: Actually, we should loop over the "editorconfig-core-handles"
+  ;; since each one comes from a different directory.
+  (when alist
+(cons
+ ;; FIXME: This should be the dir where we found the
+ ;; `.editorconfig' file.
+ (file-name-directory buffer-file-name)
+ alist)
 
 ;;;###autoload
 (define-minor-mode editorconfig-mode
@@ -881,26 +913,42 @@ To disable EditorConfig in some buffers, modify
 `editorconfig-exclude-modes' or `editorconfig-exclude-regexps'."
   :global t
   :lighter editorconfig-mode-lighter
-  (let ((modehooks '(prog-mode-hook
- text-mode-hook
- read-only-mode-hook
- ;; Some modes call `kill-all-local-variables' in their 
init
- ;; code, which clears some values set by editorconfig.
- ;; For those modes, editorconfig-apply need to be called
- ;; explicitly through their hooks.
- rpm-spec-mode-hook)))
-(if editorconfig-mode
-(progn
-  (advice-add 'find-file-noselect :around 
'editorconfig--advice-find-file-noselect)
-  (advice-add 'insert-file-contents :around 
'editorconfig--advice-insert-file-contents)
-  (dolist (hook modehooks)
-(add-hook hook
-  'editorconfig-major-mode-hook
-  t)))
-  (advice-remove 'find-file-noselect 
'editorconfig--advice-find-file-noselect)
-  (advice-remove 'insert-file-contents 
'editorconfig--advice-insert-file-contents)
-  (dolist (hook modehooks)
-(remove-hook hook 'editorconfig-major-mode-hook)
+  (if (boundp 'hack-dir-local-get-variables-functions) ;Emacs≥30
+  (if editorconfig-mode
+  (progn
+(add-hook 'hack-dir-local-get-variables-functions
+  ;; Give them slightly lower precedence than settings from
+  ;; `dir-locals.el'.
+  #'editorconfig--get-dir-local-variables t)
+;; `auto-coding-functions' also exists in Emacs<30 but without
+;; access to the file's name via `auto-coding-file-name'.
+(add-hook 'auto-coding-functions
+  #'editorconfig--get-coding-system))
+(remove-hook 'hack-dir-local-get-variables-functions
+ #'editorconfig--get-dir-local-variables)
+(remove-hook 'auto-coding-functions
+ #'editorconfig--get-coding-system))
+;; Emacs<30
+(let ((modehooks '(prog-mode-hook
+   text-mode-hook
+   read-only-mode-hook
+   ;; Some modes call `kill-all-local-variables' in their 
init
+   ;; code, wh

[nongnu] branch scratch/editorconfig created (now ad60e1a93e)

2024-06-12 Thread Stefan Monnier via
monnier pushed a change to branch scratch/editorconfig.

at  ad60e1a93e Use new Emacs-30 hooks

This branch includes the following new commits:

   new  9f8cc3e6e8 (editorconfig-set-local-variables): Get first, set later
   new  ad60e1a93e Use new Emacs-30 hooks




[nongnu] scratch/editorconfig-wip c573d24af8 6/7: WiP: reduce allocation in parser

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig-wip
commit c573d24af8193421fe733821da75fbca88229ee3
Author: Stefan Monnier 
Commit: Stefan Monnier 

WiP: reduce allocation in parser
---
 editorconfig-core-handle.el | 95 +++--
 1 file changed, 39 insertions(+), 56 deletions(-)

diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el
index 071329c006..d369a05028 100644
--- a/editorconfig-core-handle.el
+++ b/editorconfig-core-handle.el
@@ -94,12 +94,7 @@ If CONF does not exist return nil."
(equal (editorconfig-core-handle-mtime cached) mtime))
   cached
 (let ((parsed (editorconfig-core-handle--parse-file conf)))
-  (puthash conf
-   (make-editorconfig-core-handle :top-props (plist-get parsed 
:top-props)
-  :sections (plist-get parsed 
:sections)
-  :mtime mtime
-  :path conf)
-   editorconfig-core-handle--cache-hash))
+  (puthash conf parsed editorconfig-core-handle--cache-hash))
 
 (defun editorconfig-core-handle-root-p (handle)
   "Return non-nil if HANDLE represent root EditorConfig file.
@@ -157,10 +152,7 @@ This function is a fnmatch with a few modification for 
EditorConfig usage."
 (defun editorconfig-core-handle--parse-file (conf)
   "Parse EditorConfig file CONF.
 
-This function returns cons of its top properties alist and
-alist of patterns and its properties alist.
-The list returned will be ordered by the lines they appear.
-
+This function returns a `editorconfig-core-handle'.
 If CONF is not found return nil."
   (when (file-readable-p conf)
 (with-temp-buffer
@@ -172,8 +164,6 @@ If CONF is not found return nil."
 (sections ())
 (top-props nil)
 
-;; String of current line
-(line "")
 ;; nil when pattern not appeared yet, "" when pattern is empty 
("[]")
 (pattern nil)
 ;; Alist of properties for current PATTERN
@@ -181,58 +171,51 @@ If CONF is not found return nil."
 
 ;; Current line num
 (current-line-number 1))
-(while (not (eq (point) point-max))
-  (setq line
-(buffer-substring-no-properties (line-beginning-position)
-(line-end-position)))
-  (setq line
-(replace-regexp-in-string "\\(^\\| \\)\\(#\\|;\\).*$"
-  ""
-  
(editorconfig-core-handle--string-trim line)))
-
+(while (not (eobp))
   (cond
-   ((string-equal "" line)
+   ((looking-at "^[ \t]*\\(?:[#;].*\\)$")
 nil)
 
;; Start of section
-   ((string-match "^\\[\\(.*\\)\\]$"
-  line)
-(when pattern
-  (setq sections
-`(,@sections ,(make-editorconfig-core-handle-section
-   :name pattern
-   :props props)))
-  (setq pattern nil)
-  (setq props nil))
-(setq pattern (match-string 1 line)))
-
-   (t
-(let ((idx (string-match "=\\|:" line)))
-  (unless idx
-(error "Error while reading config file: %s:%d:\n%s\n"
-   conf current-line-number line))
-  (let ((key (downcase (editorconfig-core-handle--string-trim
-(substring line 0 idx
-(value (editorconfig-core-handle--string-trim
-(substring line (1+ idx)
-(when (and (< (length key) 51)
-   (< (length value) 256))
-  (if pattern
-  (when (< (length pattern) 4097)
-(setq props
-  `(,@props (,key . ,value
-(setq top-props
-  `(,@top-props (,key . ,value)
+   ((looking-at "^\\[\\(.*\\)\\]$")
+(let ((newpattern (match-string 1)))
+  (when pattern
+(push (make-editorconfig-core-handle-section
+   :name pattern
+   :props (nreverse props))
+  sections))
+  (setq props nil)
+  (setq pattern newpattern)))
+
+   ((looking-at "^[ \t]\\([^=: \t]+\\)[ \t]*[=:][ \t]*\\(.*?\\)[ 
\t]*$")
+(let ((key (downcase (match-string 1)))
+  (value (match-string 2)))
+  (when (and (< (length key) 51)
+ (< (length value) 256))
+(if pattern
+(when (< (length pattern) 4097) ;;FIXME: 4097?
+  (push `(,key . ,value)
+  

[nongnu] scratch/editorconfig-wip 7457c878b8 3/7: Misc changes accrued while trying to run the tests

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig-wip
commit 7457c878b8700ed02a15f6c22e8256dda4b6bc61
Author: Stefan Monnier 
Commit: Stefan Monnier 

Misc changes accrued while trying to run the tests

* Makefile (SRCS): Filter out `editorconfig-autoloads.el` and
`editorconfig-pkg.el`.
(test-ert): Explicitly load the $OBJS files.

* editorconfig.el (editorconfig-call-get-properties-function):
Don't catch errors when debugging.

* ert-tests/editorconfig.el: Use `expand-file-name` rather than
`concat`.
(editorconfig-ert-dir, editorconfig-secondary-ert-dir)
(editorconfig-local-variables-ert-dir): Use `macroexp-file-name` rather
than `default-directory`.
(test-trim-trailing-ws): Adjust to new code that sets
`before-save-hook` rather than `write-file-functions`.

* ert-tests/editorconfig-core-handle.el (editorconfig--fixtures):
Rename from `fixtures`.  Adjust all users (and use `expand-file-name`
rather than `concat`).
---
 Makefile  | 11 ---
 editorconfig.el   |  2 +-
 ert-tests/editorconfig-core-handle.el | 39 ++-
 ert-tests/editorconfig.el | 58 +--
 4 files changed, 59 insertions(+), 51 deletions(-)

diff --git a/Makefile b/Makefile
index 963f6de2ed..0c5eec25be 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ ERT_TESTS = $(wildcard $(PROJECT_ROOT_DIR)/ert-tests/*.el)
 BATCHFLAGS = -batch -q --no-site-file -L $(PROJECT_ROOT_DIR)
 
 MAIN_SRC = editorconfig.el
-SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el)
+SRCS = $(filter-out %-autoloads.el %-pkg.el, $(wildcard 
$(PROJECT_ROOT_DIR)/*.el))
 OBJS = $(SRCS:.el=.elc)
 
 .PHONY: check-unix check-dos \
@@ -54,11 +54,12 @@ test: test-ert test-core
 
 # ert test
 test-ert: $(ERT_TESTS) $(OBJS)
-   $(EMACS) $(BATCHFLAGS) \
-   --eval "(setq debug-on-error t)" \
-   --eval "(require 'ert)" \
+   $(EMACS) $(BATCHFLAGS)   \
+   --eval "(setq debug-on-error t)" \
+   --eval "(require 'ert)"  \
--eval "(setq metadata-el-files '($(MAIN_SRC:%=\"%\")))" \
-   $(ERT_TESTS:%=-l "%") \
+   $(OBJS:%=-l "%") \
+   $(ERT_TESTS:%=-l "%")\
-f ert-run-tests-batch-and-exit
 
 
diff --git a/editorconfig.el b/editorconfig.el
index d6e521bb2e..1606d94413 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -700,7 +700,7 @@ This function also removes `unset' properties and calls
   (setq filename (expand-file-name filename))
 (editorconfig-error "Invalid argument: %S" filename))
   (let ((props nil))
-(condition-case err
+(condition-case-unless-debug err
 (setq props (funcall editorconfig-get-properties-function
  filename))
   (error
diff --git a/ert-tests/editorconfig-core-handle.el 
b/ert-tests/editorconfig-core-handle.el
index 454a1ab1be..485a10289b 100644
--- a/ert-tests/editorconfig-core-handle.el
+++ b/ert-tests/editorconfig-core-handle.el
@@ -25,48 +25,43 @@
 
 (require 'editorconfig-core-handle "../editorconfig-core-handle")
 
-(defconst fixtures (concat (file-name-directory load-file-name) "fixtures/")
+(defconst editorconfig--fixtures (expand-file-name "fixtures/"
+   (file-name-directory load-file-name))
   "Path to fixtures.")
 
 (set-variable 'vc-handled-backends nil)
 
 (ert-deftest test-editorconfig-core-handle ()
   ;; handle.ini
-  (let* ((conf (concat fixtures "handle.ini"))
+  (let* ((conf (expand-file-name "handle.ini" editorconfig--fixtures))
  (handle (editorconfig-core-handle conf)))
 (should (editorconfig-core-handle-root-p handle))
-(should (equal (editorconfig-core-handle-get-properties handle
-(concat fixtures
-"b.js"))
+(should (equal (editorconfig-core-handle-get-properties
+handle (expand-file-name "b.js" editorconfig--fixtures))
'((("key2" . "value2")
-(should (equal (editorconfig-core-handle-get-properties handle
-(concat fixtures
-"a.js"))
+(should (equal (editorconfig-core-handle-get-properties
+handle (expand-file-name "a.js" editorconfig--fixtures))
'((("key1" . "value1")) (("key2" . "value2"))
   ;; Test twice for checking cache
-  (let* ((conf (concat fixtures "handle.ini"))
+  (let* ((conf (expand-file-name "handle.ini" editorconfig--fixtures))
  (handle (editorconfig-core-handle conf)))
 (should (editorconfig-core-handl

[nongnu] scratch/editorconfig-wip 3d2e0af8af 2/7: Miscellaneous minor changes.

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig-wip
commit 3d2e0af8af14f7af592aeb7b5ebd7ea5ef131941
Author: Stefan Monnier 
Commit: Stefan Monnier 

Miscellaneous minor changes.

* editorconfig.el: Drop redundant `require`s of pcase, nadvice, rx.
Remove unnecessary (and incorrect) `defvar`s in `eval-when-compile`.
(recentf): Remove `with-eval-after-load` workaround introduced for
issue #240 since a real fix was installed (for issue #246) since then.
(editorconfig--get-indentation): Use `derived-mode-all-parents` when
available.
(find-library-name, lm-version): Move declarations to right after
the corresponding `require` so we have a reason to believe they're defined.
(editorconfig-version): Use `package-get-version` when available.

* ert-tests/editorconfig-fnmatch.el: Prefer #' to quote function names.
---
 editorconfig.el   | 73 +++
 ert-tests/editorconfig-fnmatch.el |  4 +--
 2 files changed, 37 insertions(+), 40 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index 88494cecf4..d6e521bb2e 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -5,7 +5,7 @@
 ;; Author: EditorConfig Team 
 ;; Version: 0.11.0
 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme
-;; Package-Requires: ((emacs "26.1") (nadvice "0.3"))
+;; Package-Requires: ((emacs "26.1"))
 ;; Keywords: convenience editorconfig
 
 ;; See
@@ -46,17 +46,8 @@
 ;;; Code:
 
 (require 'cl-lib)
-(require 'pcase)
 
-(require 'nadvice)
-
-(eval-when-compile
-  (require 'rx)
-  (require 'subr-x)
-  (defvar tex-indent-basic)
-  (defvar tex-indent-item)
-  (defvar tex-indent-arg)
-  (defvar evil-shift-width))
+(eval-when-compile (require 'subr-x))
 
 (require 'editorconfig-core)
 
@@ -362,11 +353,6 @@ NOTE: Only the **buffer local** value of VARIABLE will be 
set."
 When variable `buffer-file-name' matches any of the regexps, then
 `editorconfig-mode-apply' will not do its work."
   :type '(repeat string))
-(with-eval-after-load 'recentf
-  (add-to-list 'editorconfig-exclude-regexps
-   (rx-to-string '(seq string-start
-   (eval (file-truename (expand-file-name 
recentf-save-file
- t)))
 
 (defcustom editorconfig-trim-whitespaces-mode nil
   "Buffer local minor-mode to use to trim trailing whitespaces.
@@ -376,7 +362,7 @@ Otherwise, use `delete-trailing-whitespace'."
   :type 'symbol)
 
 (defvar editorconfig-properties-hash nil
-  "Hash object of EditorConfig properties that was enabled for current buffer.
+  "Hashtable of EditorConfig properties that was enabled for current buffer.
 Set by `editorconfig-apply' and nil if that is not invoked in
 current buffer yet.")
 (make-variable-buffer-local 'editorconfig-properties-hash)
@@ -507,13 +493,20 @@ See `editorconfig-lisp-use-default-indent' for details."
 ,@(when (and size (featurep 'evil))
 `((evil-shift-width . ,size)))
 ,@(when size
-(let ((parent major-mode)
-  entry)
-  ;; Find the closet parent mode of `major-mode' in
+(let* ((parents (if (fboundp 'derived-mode-all-parents)
+(derived-mode-all-parents major-mode)))
+   (parent (if parents (pop parents) major-mode))
+   (entry ()))
+  ;; Find the closest parent mode of `major-mode' in
   ;; `editorconfig-indentation-alist'.
+  ;; FIXME: Rather than keep a central database of all modes and their
+  ;; indent var(s), we should have a buffer-local var and let each
+  ;; major mode set it to indicate how to set the indentation size.
   (while (and (not (setq entry
  (assoc parent 
editorconfig-indentation-alist)))
-  (setq parent (get parent 'derived-mode-parent
+  (setq parent (if (fboundp 'derived-mode-all-parents)
+   (pop parents)
+ (get parent 'derived-mode-parent)
   (when entry
 (let ((fn-or-list (cdr entry)))
   (cond ((functionp fn-or-list)
@@ -947,9 +940,6 @@ To disable EditorConfig in some buffers, modify
 ;; (lm-version))
 ;;   "EditorConfig version.")
 
-(declare-function find-library-name "find-func" (library))
-(declare-function lm-version "lisp-mnt" nil)
-
 ;;;###autoload
 (defun editorconfig-version (&optional show-version)
   "Get EditorConfig version as string.
@@ -957,20 +947,27 @@ To disable EditorConfig in some buffers, modify
 If called interactively or if SHOW-VERSION is non-nil, show the
 version in the echo area and the messages buffer."
   (interactive (list t))
-  (let* ((version (with-temp-buffer
-(require 'find-func)
-(insert-file-contents (find-library-name "editorconfig"))
-(require 'lisp-mnt)
-(lm-version)))
- (pkg (and 

[nongnu] scratch/editorconfig-wip dff7b4dc2e 4/7: WiP

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig-wip
commit dff7b4dc2e6adc4b8ec8d7dcf169bf132dd42d33
Author: Stefan Monnier 
Commit: Stefan Monnier 

WiP
---
 .dir-locals.el  |   4 ++
 editorconfig-core-handle.el |   5 +--
 editorconfig-core.el|  38 +
 editorconfig-exec.el| 100 
 editorconfig-fnmatch.el |   2 +-
 editorconfig-tools.el   |   2 +-
 editorconfig.el |  76 -
 7 files changed, 127 insertions(+), 100 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 00..970a416e6f
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,4 @@
+ ;;; Directory Local Variables-*- no-byte-compile: t -*-
+ ;;; For more information see (info "(emacs) Directory Variables")
+
+((emacs-lisp-mode . ((sentence-end-double-space . t
diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el
index d225e1456b..ac8c0889af 100644
--- a/editorconfig-core-handle.el
+++ b/editorconfig-core-handle.el
@@ -115,6 +115,7 @@ If HANDLE is nil return nil."
 The list returned will be ordered by the lines they appear.
 
 If HANDLE is nil return nil."
+  (declare (obsolete editorconfig-core-handle-get-properties-hash "0.8.0")))
   (when handle
 (let ((dir (file-name-directory (editorconfig-core-handle-path handle
   (cl-loop for section in (editorconfig-core-handle-sections handle)
@@ -122,10 +123,6 @@ If HANDLE is nil return nil."
 
file
 
dir)
when props collect (copy-alist props)
-(make-obsolete 'editorconfig-core-handle-get-properties
-   'editorconfig-core-handle-get-properties-hash
-   "0.8.0")
-
 
 (defun editorconfig-core-handle-get-properties-hash (handle file)
   "Return hash of properties from HANDLE for FILE.
diff --git a/editorconfig-core.el b/editorconfig-core.el
index c7b52deaaf..84bf94e220 100644
--- a/editorconfig-core.el
+++ b/editorconfig-core.el
@@ -85,12 +85,11 @@ RESULT is used internally and normally should not be used."
 (parent (file-name-directory (directory-file-name dir
 (if (or (string= parent dir)
 (and handle (editorconfig-core-handle-root-p handle)))
-(cl-remove-if-not 'identity (cons handle result))
+(cl-remove-if-not #'identity (cons handle result))
   (editorconfig-core--get-handles parent
   confname
   (cons handle result)
 
-;;;###autoload
 (defun editorconfig-core-get-nearest-editorconfig (directory)
   "Return path to .editorconfig file that is closest to DIRECTORY."
   (when-let* ((handle (car (last
@@ -98,21 +97,21 @@ RESULT is used internally and normally should not be used."
".editorconfig")
 (editorconfig-core-handle-path handle)))
 
-;;;###autoload
-(defun editorconfig-core-get-properties (&optional file confname confversion)
-  "Get EditorConfig properties for FILE.
-If FILE is not given, use currently visiting file.
-Give CONFNAME for basename of config file other than .editorconfig.
-If need to specify config format version, give CONFVERSION.
-
-This function returns an alist of properties.  Each element will
-look like (KEY . VALUE)."
-  (let ((hash (editorconfig-core-get-properties-hash file confname 
confversion))
-(result nil))
-(maphash (lambda (key value)
-   (add-to-list 'result (cons (symbol-name key) value)))
- hash)
-result))
+;; Not used.
+;;(defun editorconfig-core-get-properties (&optional file confname confversion)
+;;  "Get EditorConfig properties for FILE.
+;;If FILE is not given, use currently visiting file.
+;;Give CONFNAME for basename of config file other than .editorconfig.
+;;If need to specify config format version, give CONFVERSION.
+
+;;This function returns an alist of properties.  Each element will
+;;look like (KEY . VALUE)."
+;;  (let ((hash (editorconfig-core-get-properties-hash file confname 
confversion))
+;;(result nil))
+;;(maphash (lambda (key value)
+;;   (add-to-list 'result (cons (symbol-name key) value)))
+;; hash)
+;;result))
 
 (defun editorconfig-core--hash-merge (into update)
   "Merge two hashes INTO and UPDATE.
@@ -122,7 +121,6 @@ When the same key exists in both two hashes, values of 
UPDATE takes precedence."
   (maphash (lambda (key value) (puthash key value into)) update)
   into)
 
-;;;###autoload
 (defun editorconfig-core-get-properties-hash (&optional file confname 
confversion)
   "Get EditorConfig properties for FILE.
 If FILE is not given, use currently visiting file.
@@ -145,12 +143,14 @@ hash object instead."

[nongnu] branch scratch/editorconfig-wip created (now 785be24cbd)

2024-06-12 Thread Stefan Monnier via
monnier pushed a change to branch scratch/editorconfig-wip.

at  785be24cbd WiP: eliminate O(N^2) complexity in fnmatch translation

This branch includes the following new commits:

   new  ed46b54596 Cosmetic changes for compilation purposes
   new  3d2e0af8af Miscellaneous minor changes.
   new  7457c878b8 Misc changes accrued while trying to run the tests
   new  dff7b4dc2e WiP
   new  c4bb7da5d1 WiP
   new  c573d24af8 WiP: reduce allocation in parser
   new  785be24cbd WiP: eliminate O(N^2) complexity in fnmatch translation




[nongnu] scratch/editorconfig-wip ed46b54596 1/7: Cosmetic changes for compilation purposes

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig-wip
commit ed46b545960f70a8d29f0e2ef53a6a192836da3f
Author: Stefan Monnier 
Commit: Stefan Monnier 

Cosmetic changes for compilation purposes

* editorconfig.el: Remove redundant `:group`: arguments.
Prefer #' to quote function names.

ert-tests/: Tweak `require` statements to try and avoid recursively
loading the tests.
---
 editorconfig.el   | 37 ---
 ert-tests/editorconfig-core-handle.el |  2 +-
 ert-tests/editorconfig-core.el|  2 +-
 ert-tests/editorconfig-fnmatch.el |  2 +-
 ert-tests/editorconfig.el |  2 +-
 5 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index cb21cad977..88494cecf4 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -78,15 +78,14 @@ coding styles between different editors and IDEs."
   "Path to EditorConfig executable.
 
 Used by `editorconfig--execute-editorconfig-exec'."
-  :type 'string
-  :group 'editorconfig)
+  :type 'string)
 
 (define-obsolete-variable-alias
   'edconf-get-properties-function
   'editorconfig-get-properties-function
   "0.5")
 (defcustom editorconfig-get-properties-function
-  'editorconfig-core-get-properties-hash
+  #'editorconfig-core-get-properties-hash
   "A function which gets EditorConfig properties for specified file.
 
 This function will be called with one argument, full path of the target file,
@@ -112,13 +111,11 @@ Possible known values are:
 use `editorconfig-core-get-properties-hash'
 * `editorconfig-get-properties-from-exec'
   * Get properties by executing EditorConfig executable"
-  :type 'function
-  :group 'editorconfig)
+  :type 'function)
 
 (defcustom editorconfig-mode-lighter " EditorConfig"
   "Command `editorconfig-mode' lighter string."
-  :type 'string
-  :group 'editorconfig)
+  :type 'string)
 
 (define-obsolete-variable-alias
   'edconf-custom-hooks
@@ -148,8 +145,7 @@ show line numbers on the left:
 
 This hook will be run even when there are no matching sections in
 \".editorconfig\", or no \".editorconfig\" file was found at all."
-  :type 'hook
-  :group 'editorconfig)
+  :type 'hook)
 
 (defcustom editorconfig-hack-properties-functions ()
   "A list of function to alter property values before applying them.
@@ -171,8 +167,7 @@ overwrite \"indent_style\" property when current 
`major-mode' is a
 
 This hook will be run even when there are no matching sections in
 \".editorconfig\", or no \".editorconfig\" file was found at all."
-  :type 'hook
-  :group 'editorconfig)
+  :type 'hook)
 (make-obsolete-variable 'editorconfig-hack-properties-functions
 "Using `editorconfig-after-apply-functions' instead is 
recommended,
 because since 2021/08/30 (v0.9.0) this variable cannot support all 
properties:
@@ -355,21 +350,18 @@ following forms:
 
 NOTE: Only the **buffer local** value of VARIABLE will be set."
   :type '(alist :key-type symbol :value-type sexp)
-  :risky t
-  :group 'editorconfig)
+  :risky t)
 
 (defcustom editorconfig-exclude-modes ()
   "Modes in which `editorconfig-mode-apply' will not run."
-  :type '(repeat (symbol :tag "Major Mode"))
-  :group 'editorconfig)
+  :type '(repeat (symbol :tag "Major Mode")))
 
 (defcustom editorconfig-exclude-regexps ()
   "List of regexp for buffer filenames `editorconfig-mode-apply' will not run.
 
 When variable `buffer-file-name' matches any of the regexps, then
 `editorconfig-mode-apply' will not do its work."
-  :type '(repeat string)
-  :group 'editorconfig)
+  :type '(repeat string))
 (with-eval-after-load 'recentf
   (add-to-list 'editorconfig-exclude-regexps
(rx-to-string '(seq string-start
@@ -381,8 +373,7 @@ When variable `buffer-file-name' matches any of the 
regexps, then
 
 If set, enable that mode when `trim_trailing_whitespace` is set to true.
 Otherwise, use `delete-trailing-whitespace'."
-  :type 'symbol
-  :group 'editorconfig)
+  :type 'symbol)
 
 (defvar editorconfig-properties-hash nil
   "Hash object of EditorConfig properties that was enabled for current buffer.
@@ -406,13 +397,11 @@ number - `lisp-indent-offset' is not set only if 
indent_size is
 
 (defcustom editorconfig-override-file-local-variables t
   "Non-nil means editorconfig will override file local variable values."
-  :type 'boolean
-  :group 'editorconfig)
+  :type 'boolean)
 
 (defcustom editorconfig-override-dir-local-variables t
   "Non-nil means editorconfig will override values defined in dir-locals.el ."
-  :type 'boolean
-  :group 'editorconfig)
+  :type 'boolean)
 
 (define-error 'editorconfig-error
   "Error thrown from editorconfig lib")
@@ -684,7 +673,7 @@ This function will revert buffer when the coding-system has 
been changed."
   (let ((key-val (split-string prop " *= *")))
 (when (> (length key-val) 1)
   (let ((key (intern (car key-val)))
-(val (mapconcat 'identity (cdr key-val) "")))
+ 

[nongnu] scratch/editorconfig-wip 785be24cbd 7/7: WiP: eliminate O(N^2) complexity in fnmatch translation

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig-wip
commit 785be24cbdfc783840e3000fc578d794e01612b8
Author: Stefan Monnier 
Commit: Stefan Monnier 

WiP: eliminate O(N^2) complexity in fnmatch translation
---
 editorconfig-fnmatch.el | 162 +---
 1 file changed, 84 insertions(+), 78 deletions(-)

diff --git a/editorconfig-fnmatch.el b/editorconfig-fnmatch.el
index 520aeb16c2..cb793124e5 100644
--- a/editorconfig-fnmatch.el
+++ b/editorconfig-fnmatch.el
@@ -53,13 +53,9 @@
 
 (require 'cl-lib)
 
-(defvar editorconfig-fnmatch--cache-hashtable
-  nil
+(defconst editorconfig-fnmatch--cache-hashtable
+  (make-hash-table :test 'equal)
   "Cache of shell pattern and its translation.")
-;; Clear cache on file reload
-(setq editorconfig-fnmatch--cache-hashtable
-  (make-hash-table :test 'equal))
-
 
 (defconst editorconfig-fnmatch--left-brace-regexp
   "\\(^\\|[^\\]\\){"
@@ -128,7 +124,7 @@ translation is found for PATTERN."
 (length (length pattern))
 (brace-level 0)
 (in-brackets nil)
-;; List of strings of resulting regexp
+;; List of strings of resulting regexp, in reverse order.
 (result ())
 (is-escaped nil)
 (matching-braces (= (editorconfig-fnmatch--match-num
@@ -141,8 +137,7 @@ translation is found for PATTERN."
 current-char
 pos
 has-slash
-has-comma
-num-range)
+has-comma)
 
 (while (< index length)
   (if (and (not is-escaped)
@@ -151,8 +146,8 @@ translation is found for PATTERN."
  pattern
  index)
(eq index (match-beginning 0)))
-  (setq result `(,@result ,(regexp-quote (match-string 0 pattern)))
-index (match-end 0)
+  (push (regexp-quote (match-string 0 pattern)) result)
+  (setq index (match-end 0)
 is-escaped nil)
 
 (setq current-char (aref pattern index)
@@ -161,21 +156,23 @@ translation is found for PATTERN."
 (cl-case current-char
   (?*
(setq pos index)
-   (if (and (< pos length)
-(= (aref pattern pos) ?*))
-   (setq result `(,@result ".*"))
- (setq result `(,@result "[^/]*"
+   (push (if (and (< pos length)
+  (= (aref pattern pos) ?*))
+ ".*"
+   "[^/]*")
+ result))
 
   (??
-   (setq result `(,@result "[^/]")))
+   (push "[^/]" result))
 
   (?\[
(if in-brackets
-   (setq result `(,@result "\\["))
+   (push "\\[" result)
  (if (= (aref pattern index) ?/)
  ;; Slash after an half-open bracket
- (setq result `(,@result "\\[/")
-   index (+ index 1))
+ (progn
+   (setq index (+ index 1))
+   (push "\\[/" result))
(setq pos index
  has-slash nil)
(while (and (< pos length)
@@ -186,28 +183,30 @@ translation is found for PATTERN."
  (setq has-slash t)
(setq pos (1+ pos
(if has-slash
-   (setq result `(,@result ,(concat "\\["
-(substring pattern
-   index
-   (1+ pos))
-"\\]"))
- index (+ pos 2))
- (if (and (< index length)
-  (memq (aref pattern index)
-'(?! ?^)))
- (setq index (1+ index)
-   result `(,@result "[^"))
-   (setq result `(,@result "[")))
- (setq in-brackets t)
+   (progn
+ (push (concat "\\["
+   (substring pattern
+  index
+  (1+ pos))
+   "\\]")
+   result)
+ (setq index (+ pos 2)))
+ (setq in-brackets t)
+ (push (if (and (< index length)
+(memq (aref pattern index)
+  '(?! ?^)))
+   (progn
+ (setq index (1+ index))
+ "[^")
+ "[")
+   result)
 
   (?-
-   (if in-brackets
-   (setq result `(,@result "-"))
- (setq result `(,@result "\\-"
+   (push (if in-brackets "-" "\\-") result))
 
   (?\]
-   (setq result `(,@result "

[nongnu] scratch/editorconfig-wip c4bb7da5d1 5/7: WiP

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig-wip
commit c4bb7da5d1f726212a2b871824d81448e92b0ec6
Author: Stefan Monnier 
Commit: Stefan Monnier 

WiP
---
 editorconfig-core-handle.el | 34 --
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el
index ac8c0889af..071329c006 100644
--- a/editorconfig-core-handle.el
+++ b/editorconfig-core-handle.el
@@ -51,13 +51,14 @@ Slots:
   (name nil)
   (props nil))
 
-(defun editorconfig-core-handle-section-get-properties (section file dir)
+(defun editorconfig-core-handle-section-get-properties (section file)
   "Return properties alist when SECTION name match FILE.
 
-DIR should be the directory where .editorconfig file which has SECTION lives.
+FILE should be a relative file name, relative to the directory where
+.editorconfig file which has SECTION lives.
 IF not match, return nil."
   (when (editorconfig-core-handle--fnmatch-p
- file (editorconfig-core-handle-section-name section) dir)
+ file (editorconfig-core-handle-section-name section))
 (editorconfig-core-handle-section-props section)))
 
 (cl-defstruct editorconfig-core-handle
@@ -115,14 +116,12 @@ If HANDLE is nil return nil."
 The list returned will be ordered by the lines they appear.
 
 If HANDLE is nil return nil."
-  (declare (obsolete editorconfig-core-handle-get-properties-hash "0.8.0")))
-  (when handle
-(let ((dir (file-name-directory (editorconfig-core-handle-path handle
-  (cl-loop for section in (editorconfig-core-handle-sections handle)
-   for props = (editorconfig-core-handle-section-get-properties 
section
-
file
-
dir)
-   when props collect (copy-alist props)
+  (declare (obsolete editorconfig-core-handle-get-properties-hash "0.8.0"))
+  (let ((hash (editorconfig-core-handle-get-properties-hash handle file))
+alist)
+(when hash
+ (maphash (lambda (k v) (push (cons k v) alist)) hash)
+ alist)))
 
 (defun editorconfig-core-handle-get-properties-hash (handle file)
   "Return hash of properties from HANDLE for FILE.
@@ -130,23 +129,22 @@ If HANDLE is nil return nil."
 If HANDLE is nil return nil."
   (when handle
 (let ((hash (make-hash-table))
-  (dir (file-name-directory (editorconfig-core-handle-path
+  (file (file-relative-name (editorconfig-core-handle-path
  handle
   (dolist (section (editorconfig-core-handle-sections handle))
-(cl-loop for (key . value) in 
(editorconfig-core-handle-section-get-properties section file dir)
+(cl-loop for (key . value) in 
(editorconfig-core-handle-section-get-properties section file)
  do (puthash (intern key) value hash)))
   hash)))
 
-(defun editorconfig-core-handle--fnmatch-p (name pattern dir)
+(defun editorconfig-core-handle--fnmatch-p (name pattern)
   "Return non-nil if NAME match PATTERN.
 If pattern has slash, pattern should be relative to DIR.
 
 This function is a fnmatch with a few modification for EditorConfig usage."
   (if (string-match-p "/" pattern)
-  (let ((pattern (replace-regexp-in-string "^/" "" pattern))
-(dir (file-name-as-directory dir)))
-(editorconfig-fnmatch-p name (concat dir pattern)))
-(editorconfig-fnmatch-p name (concat "**/" pattern
+  (let ((pattern (replace-regexp-in-string "\\`/" "" pattern)))
+(editorconfig-fnmatch-p name pattern))
+(editorconfig-fnmatch-p (file-name-nondirectory name) pattern)))
 
 (defsubst editorconfig-core-handle--string-trim (str)
   "Remove leading and trailing whitespaces from STR."



[nongnu] elpa/hyperdrive 0d04b9b2ea: Change: (hyperdrive-entry) Improve docstring

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 0d04b9b2ea55952287b6c3c81ba5ba0a45b60823
Author: Joseph Turner 
Commit: Joseph Turner 

Change: (hyperdrive-entry) Improve docstring
---
 hyperdrive-lib.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index d7e09bbec7..00ffcbcd3c 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -71,7 +71,9 @@ Passes ARGS to `format-message'."
   (size nil :documentation "Size of file.")
   (version nil :documentation "Hyperdrive version specified in entry's URL.")
   (type nil :documentation "MIME type of the entry.")
-  (etc nil :documentation "Alist for extra data about the entry."))
+  (etc nil :documentation "Alist for extra data about the entry.
+- display-name :: Displayed in directory view instead of name.
+- target :: Link fragment to jump to."))
 
 (cl-defstruct (hyperdrive (:constructor h/create)
   (:copier nil))



[nongnu] scratch/editorconfig 0d207c59e1: WiP: Fix test regressions

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit 0d207c59e18e7eb2a20ac857ad3055f2fdcb350a
Author: Stefan Monnier 
Commit: Stefan Monnier 

WiP: Fix test regressions
---
 Makefile  |  2 +-
 editorconfig.el   | 56 ---
 ert-tests/editorconfig.el | 23 +++
 3 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index 963f6de2ed..a4e5338c50 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ ERT_TESTS = $(wildcard $(PROJECT_ROOT_DIR)/ert-tests/*.el)
 BATCHFLAGS = -batch -q --no-site-file -L $(PROJECT_ROOT_DIR)
 
 MAIN_SRC = editorconfig.el
-SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el)
+SRCS = $(filter-out %-autoloads.el %-pkg.el, $(wildcard 
$(PROJECT_ROOT_DIR)/*.el))
 OBJS = $(SRCS:.el=.elc)
 
 .PHONY: check-unix check-dos \
diff --git a/editorconfig.el b/editorconfig.el
index cb21cad977..2bab3e92fa 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -209,7 +209,7 @@ This hook will be run even when there are no matching 
sections in
 (css-ts-mode css-indent-offset)
 (d-mode c-basic-offset)
 (elixir-ts-mode elixir-ts-indent-offset)
-(emacs-lisp-mode lisp-indent-offset)
+(emacs-lisp-mode . editorconfig--get-indentation-lisp)
 (enh-ruby-mode enh-ruby-indent-level)
 (erlang-mode erlang-indent-level)
 (ess-mode ess-indent-offset)
@@ -258,7 +258,7 @@ This hook will be run even when there are no matching 
sections in
 (kotlin-mode kotlin-tab-width)
 (kotlin-ts-mode kotlin-ts-mode-indent-offset)
 (latex-mode . editorconfig--get-indentation-latex-mode)
-(lisp-mode lisp-indent-offset)
+(lisp-mode . editorconfig--get-indentation-lisp)
 (livescript-mode livescript-tab-width)
 (lua-mode lua-indent-level)
 (lua-ts-mode lua-ts-indent-offset)
@@ -460,15 +460,19 @@ Make a message by passing ARGS to `format-message'."
 (LaTeX-indent-level . ,size)
 (LaTeX-item-indent . ,(- size
 
-(cl-defun editorconfig--should-set (symbol &optional size)
-  "Determine if editorconfig should set SYMBOL.
+(defun editorconfig--get-indentation-lisp (size)
+  (when (cond ((null editorconfig-lisp-use-default-indent)  t)
+  ((eql t editorconfig-lisp-use-default-indent) nil)
+  ((numberp editorconfig-lisp-use-default-indent)
+   (not (eql size editorconfig-lisp-use-default-indent)))
+  (t t))
+`((lisp-indent-offset . ,size
 
-Optional arg SIZE is used when symbol is `lisp-indent-offset'.
-See `editorconfig-lisp-use-default-indent' for details."
+(cl-defun editorconfig--should-set (symbol)
+  "Determine if editorconfig should set SYMBOL."
   (display-warning '(editorconfig editorconfig--should-set)
-   (format "symbol: %S | size: %S"
-   symbol
-   size)
+   (format "symbol: %S"
+   symbol)
:debug)
   (when (and (not editorconfig-override-file-local-variables)
  (assq symbol file-local-variables-alist))
@@ -480,14 +484,6 @@ See `editorconfig-lisp-use-default-indent' for details."
 (cl-return-from editorconfig--should-set
   nil))
 
-  (when (eq symbol 'lisp-indent-offset)
-(cl-return-from editorconfig--should-set
-  (cond ((null editorconfig-lisp-use-default-indent)  t)
-((eql t editorconfig-lisp-use-default-indent) nil)
-((numberp editorconfig-lisp-use-default-indent)
- (not (eql size editorconfig-lisp-use-default-indent)))
-(t t
-
   t)
 
 (defun editorconfig--get-indentation (style &optional size tab_width)
@@ -619,24 +615,37 @@ This function will revert buffer when the coding-system 
has been changed."
  `((require-final-newline . nil)
(mode-require-final-newline . nil)
 
+(defun editorconfig--add-hook-safe (exp)
+  (equal exp '(add-hook 'before-save-hook
+#'editorconfig--delete-trailing-whitespace nil t)))
+
+(let ((predicates (get 'add-hook 'safe-local-eval-function)))
+  (when (functionp predicates)
+(setq predicates (list predicates)))
+  (unless (memq #'editorconfig--add-hook-safe predicates)
+(put 'add-hook 'safe-local-eval-function #'editorconfig--add-hook-safe)))
+
+(defun editorconfig--delete-trailing-whitespace ()
+  "Call `delete-trailing-whitespace' unless the buffer is read-only."
+  (unless buffer-read-only (delete-trailing-whitespace)))
+
 (defun editorconfig--get-trailing-ws (trim-trailing-ws)
   "Get vars to trim of trailing whitespace according to TRIM-TRAILING-WS."
   `(,@(when (and (equal trim-trailing-ws "true")
- ;; FIXME: Test this in `before-save-hook'?
  (not buffer-read-only))
 `((eval
. ,(if editorconfig-trim-whitespaces-mode
   `(,editorconfig-trim-whitespaces-mode 1)
-;; Don't use #' because this specific form is recognized
-;; by Emacs's 

[nongnu] branch scratch/editorconfig deleted (was 0d207c59e1)

2024-06-12 Thread Stefan Monnier via
monnier pushed a change to branch scratch/editorconfig.

   was  0d207c59e1 WiP: Fix test regressions

This change permanently discards the following revisions:

  discards  0d207c59e1 WiP: Fix test regressions



[nongnu] scratch/editorconfig c8031d4983 5/5: WiP: Document test regressions

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit c8031d498343280413bcac7f72be337cf8921237
Author: Stefan Monnier 
Commit: Stefan Monnier 

WiP: Document test regressions
---
 Makefile  |  2 +-
 ert-tests/editorconfig.el | 10 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 963f6de2ed..a4e5338c50 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ ERT_TESTS = $(wildcard $(PROJECT_ROOT_DIR)/ert-tests/*.el)
 BATCHFLAGS = -batch -q --no-site-file -L $(PROJECT_ROOT_DIR)
 
 MAIN_SRC = editorconfig.el
-SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el)
+SRCS = $(filter-out %-autoloads.el %-pkg.el, $(wildcard 
$(PROJECT_ROOT_DIR)/*.el))
 OBJS = $(SRCS:.el=.elc)
 
 .PHONY: check-unix check-dos \
diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el
index 92a2dbd4f5..a78a5b0316 100644
--- a/ert-tests/editorconfig.el
+++ b/ert-tests/editorconfig.el
@@ -121,6 +121,14 @@
 'iso-latin-1-unix)))
   (with-visit-file (concat editorconfig-ert-dir "utf-16be.txt")
 (set-buffer-file-coding-system 'undecided-unix)
+;; FIXME: It seems this test uses a non-existing file, and it seems that
+;; when using `auto-coding-functions', the coding system is not set in
+;; `buffer-file-coding-system' is not set in that case, instead
+;; `auto-coding-functions' will be (re)consulted when writing the file.
+;; So I think this test needs to be updated.
+;; FIXME: Maybe it could also be considered as an Emacs bug that
+;; `buffer-file-coding-system' is not set according to `auto-coding-*'
+;; when visiting a missing file, but it's not specific to EditorConfig.
 (should (eq buffer-file-coding-system
 'utf-16be-with-signature-unix)))
   (editorconfig-mode -1))
@@ -128,6 +136,8 @@
 
 (ert-deftest test-local-variables nil
   (editorconfig-mode 1)
+  ;; FIXME: This test fails with the new Emacs-30 hook because we can't
+  ;; really obey `editorconfig-override-file/dir-local-variables' in that case.
   (with-visit-file (concat editorconfig-local-variables-ert-dir 
"file_locals.rb")
 (should (eq tab-width 9))
 (should (eq ruby-indent-level 7)))



[nongnu] scratch/editorconfig c24ec14b8b 1/5: (editorconfig--should-set): Eliminate `lisp-indent-offset` special case

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit c24ec14b8b982468f4ed1296aff1a2e6108e9227
Author: Stefan Monnier 
Commit: Stefan Monnier 

(editorconfig--should-set): Eliminate `lisp-indent-offset` special case

Instead of treating `lisp-indent-offset` specially in
`editorconfig--should-set` (to obey `editorconfig-lisp-use-default-indent`),
use a new function `editorconfig-set-indentation-lisp-mode`
for Lisp modes.

* editorconfig.el (editorconfig--should-set): Remove `size` argument.
(editorconfig-set-indentation): Adjust calls accordingly.
(editorconfig-set-indentation-lisp-mode): New function.
(editorconfig-indentation-alist): Use it.
---
 editorconfig.el | 37 +
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index e7bb3c90b1..cf6c03249a 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -204,7 +204,7 @@ This hook will be run even when there are no matching 
sections in
 (css-ts-mode css-indent-offset)
 (d-mode c-basic-offset)
 (elixir-ts-mode elixir-ts-indent-offset)
-(emacs-lisp-mode lisp-indent-offset)
+(emacs-lisp-mode . editorconfig-set-indentation-lisp-mode)
 (enh-ruby-mode enh-ruby-indent-level)
 (erlang-mode erlang-indent-level)
 (ess-mode ess-indent-offset)
@@ -253,7 +253,7 @@ This hook will be run even when there are no matching 
sections in
 (kotlin-mode kotlin-tab-width)
 (kotlin-ts-mode kotlin-ts-mode-indent-offset)
 (latex-mode . editorconfig-set-indentation-latex-mode)
-(lisp-mode lisp-indent-offset)
+(lisp-mode . editorconfig-set-indentation-lisp-mode)
 (livescript-mode livescript-tab-width)
 (lua-mode lua-indent-level)
 (lua-ts-mode lua-ts-indent-offset)
@@ -459,15 +459,20 @@ Make a message by passing ARGS to `format-message'."
   (when (boundp 'LaTeX-item-indent)
 (setq-local LaTeX-item-indent (- size
 
-(cl-defun editorconfig--should-set (symbol &optional size)
-  "Determine if editorconfig should set SYMBOL.
-
-Optional arg SIZE is used when symbol is `lisp-indent-offset'.
-See `editorconfig-lisp-use-default-indent' for details."
+(defun editorconfig-set-indentation-lisp-mode (size)
+ "Set indent size to SIZE for Lisp mode(s)."
+ (when (cond ((null editorconfig-lisp-use-default-indent)  t)
+ ((eql t editorconfig-lisp-use-default-indent) nil)
+ ((numberp editorconfig-lisp-use-default-indent)
+  (not (eql size editorconfig-lisp-use-default-indent)))
+ (t t))
+   (setq-local lisp-indent-offset size)))
+
+(cl-defun editorconfig--should-set (symbol)
+  "Determine if editorconfig should set SYMBOL."
   (display-warning '(editorconfig editorconfig--should-set)
-   (format "symbol: %S | size: %S"
-   symbol
-   size)
+   (format "symbol: %S"
+   symbol)
:debug)
   (when (and (not editorconfig-override-file-local-variables)
  (assq symbol file-local-variables-alist))
@@ -479,14 +484,6 @@ See `editorconfig-lisp-use-default-indent' for details."
 (cl-return-from editorconfig--should-set
   nil))
 
-  (when (eq symbol 'lisp-indent-offset)
-(cl-return-from editorconfig--should-set
-  (cond ((null editorconfig-lisp-use-default-indent)  t)
-((eql t editorconfig-lisp-use-default-indent) nil)
-((numberp editorconfig-lisp-use-default-indent)
- (not (eql size editorconfig-lisp-use-default-indent)))
-(t t
-
   t)
 
 (defun editorconfig-set-indentation (style &optional size tab_width)
@@ -532,10 +529,10 @@ See `editorconfig-lisp-use-default-indent' for details."
 ((listp fn-or-list)
  (dolist (elem fn-or-list)
(cond ((and (symbolp elem)
-   (editorconfig--should-set elem size))
+   (editorconfig--should-set elem))
   (set (make-local-variable elem) size))
  ((and (consp elem)
-   (editorconfig--should-set (car elem) size))
+   (editorconfig--should-set (car elem)))
   (let ((spec (cdr elem)))
 (set (make-local-variable (car elem))
  (cond ((functionp spec) (funcall spec size))



[nongnu] scratch/editorconfig 964747660c 2/5: Don't hook into `read-only-mode-hook`

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit 964747660cacf01799512e28c8999afea345203e
Author: Stefan Monnier 
Commit: Stefan Monnier 

Don't hook into `read-only-mode-hook`

We shouldn't re-set variables just because `read-only-mode` is 
(de)activated,
and with Emacs-30's hooks it would be even less natural to do.
Also `buffer-read-only` can change without calling `read-only-mode`,
so better test it dynamically when we try to trim whitespace.

* editorconfig.el (editorconfig--delete-trailing-whitespace): New function.
(editorconfig-set-trailing-ws): Use it.
Also prefer `before-save-hook` and use `add/remove-hook` to
manipulate hooks, like god intended.
Don't test `buffer-read-only` any more.
(editorconfig-mode): Don't hook into `read-only-mode-hook` any more.

* ert-tests/editorconfig.el (test-trim-trailing-ws): Adjust
test accordingly.
---
 editorconfig.el   | 19 ++-
 ert-tests/editorconfig.el | 15 +--
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index cf6c03249a..66e99c4185 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -612,24 +612,26 @@ to non-nil when FINAL-NEWLINE is true."
  (setq-local require-final-newline  nil)
  (setq-local mode-require-final-newline nil
 
+(defun editorconfig--delete-trailing-whitespace ()
+  "Call `delete-trailing-whitespace' unless the buffer is read-only."
+  (unless buffer-read-only (delete-trailing-whitespace)))
+
 (defun editorconfig-set-trailing-ws (trim-trailing-ws)
   "Set up trimming of trailing whitespace at end of lines by TRIM-TRAILING-WS."
-  (make-local-variable 'write-file-functions) ;; just current buffer
-  (when (and (equal trim-trailing-ws "true")
- (not buffer-read-only))
+  (when (equal trim-trailing-ws "true")
 ;; when true we push delete-trailing-whitespace (emacs > 21)
 ;; to write-file-functions
 (if editorconfig-trim-whitespaces-mode
 (funcall editorconfig-trim-whitespaces-mode 1)
-  (add-to-list 'write-file-functions 'delete-trailing-whitespace)))
-  (when (or (equal trim-trailing-ws "false")
-buffer-read-only)
+  (add-hook 'before-save-hook
+#'editorconfig--delete-trailing-whitespace nil t)))
+  (when (equal trim-trailing-ws "false")
 ;; when false we remove every delete-trailing-whitespace
 ;; from write-file-functions
 (when editorconfig-trim-whitespaces-mode
   (funcall editorconfig-trim-whitespaces-mode 0))
-(setq write-file-functions
-  (remove 'delete-trailing-whitespace write-file-functions
+(remove-hook 'before-save-hook
+ #'editorconfig--delete-trailing-whitespace t)))
 
 (defun editorconfig-set-line-length (length)
   "Set the max line length (`fill-column') to LENGTH."
@@ -867,7 +869,6 @@ To disable EditorConfig in some buffers, modify
   :lighter editorconfig-mode-lighter
   (let ((modehooks '(prog-mode-hook
  text-mode-hook
- read-only-mode-hook
  ;; Some modes call `kill-all-local-variables' in their 
init
  ;; code, which clears some values set by editorconfig.
  ;; For those modes, editorconfig-apply need to be called
diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el
index 4fcfe13f4e..92a2dbd4f5 100644
--- a/ert-tests/editorconfig.el
+++ b/ert-tests/editorconfig.el
@@ -102,12 +102,15 @@
 (ert-deftest test-trim-trailing-ws nil
   (editorconfig-mode 1)
   (with-visit-file (concat editorconfig-ert-dir "trim.txt")
-(should (memq 'delete-trailing-whitespace
-  write-file-functions)))
-  (with-visit-file (concat editorconfig-ert-dir "trim.txt")
-(read-only-mode 1)
-(should (not (memq 'delete-trailing-whitespace
-   write-file-functions
+(should (memq #'editorconfig--delete-trailing-whitespace
+  before-save-hook)))
+  ;; We used to re-apply the vars when switching `read-only-mode',
+  ;; but now instead we use a hook function that checks `buffer-read-only'
+  ;; every time we save the file.
+  ;;(with-visit-file (concat editorconfig-ert-dir "trim.txt")
+  ;;  (read-only-mode 1)
+  ;;  (should (not (memq #'editorconfig--delete-trailing-whitespace
+  ;; before-save-hook
   (editorconfig-mode -1))
 
 (ert-deftest test-charset nil



[nongnu] scratch/editorconfig 54ee2b4862 3/5: (editorconfig-set-local-variables): Get first, set later

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit 54ee2b48626e6688c21699253865f57f45ff2679
Author: Stefan Monnier 
Commit: Stefan Monnier 

(editorconfig-set-local-variables): Get first, set later

In preparation for the use of Emacs-30's
`hack-dir-local-get-variables-functions`, split the job of
`editorconfig-set-local-variables` into getting an alist of settings
and then applying them.

Rename the `editorconfig-set-*` functions to `editorconfig--get-*`
and make them return an alist of settings rather than applying them
(except for `editorconfig-set-coding-system-revert` which arguably
belongs in `editorconfig-tools.el` anyway).

* editorconfig.el (editorconfig-indentation-alist): Change the doc to
mention that the functions should return an alist.
Use the new `editorconfig--get-indentation-*-mode` functions.
(editorconfig--get-indentation-*-mode): Don't `boundp`-test the vars.
(editorconfig--get-indentation): Don't set `tab-width` from SIZE.
Don't test `editorconfig--should-set` here.  Test `boundp` here.
(editorconfig--add-hook-safe): New function.
Add it to the `safe-local-eval-function` property of `add-hook`.
(editorconfig-set-local-variables): Test `editorconfig--should-set` here.
Rewrite it using `editorconfig--get-local-variables`.
---
 editorconfig.el | 253 ++--
 1 file changed, 138 insertions(+), 115 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index 66e99c4185..ca271b5004 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -38,6 +38,11 @@
 ;; EditorConfig files are easily readable and they work nicely with
 ;; version control systems.
 
+;; News:
+
+;; In `editorconfig-indentation-alist', if a mode is associated to a function
+;; that function should not set the vars but should instead *return* them.
+
 ;;; Code:
 
 (require 'cl-lib)
@@ -204,7 +209,7 @@ This hook will be run even when there are no matching 
sections in
 (css-ts-mode css-indent-offset)
 (d-mode c-basic-offset)
 (elixir-ts-mode elixir-ts-indent-offset)
-(emacs-lisp-mode . editorconfig-set-indentation-lisp-mode)
+(emacs-lisp-mode . editorconfig--get-indentation-lisp-mode)
 (enh-ruby-mode enh-ruby-indent-level)
 (erlang-mode erlang-indent-level)
 (ess-mode ess-indent-offset)
@@ -252,8 +257,8 @@ This hook will be run even when there are no matching 
sections in
 (julia-mode julia-indent-offset)
 (kotlin-mode kotlin-tab-width)
 (kotlin-ts-mode kotlin-ts-mode-indent-offset)
-(latex-mode . editorconfig-set-indentation-latex-mode)
-(lisp-mode . editorconfig-set-indentation-lisp-mode)
+(latex-mode . editorconfig--get-indentation-latex-mode)
+(lisp-mode . editorconfig--get-indentation-lisp-mode)
 (livescript-mode livescript-tab-width)
 (lua-mode lua-indent-level)
 (lua-ts-mode lua-ts-indent-offset)
@@ -280,8 +285,8 @@ This hook will be run even when there are no matching 
sections in
 (ps-mode ps-mode-tab)
 (pug-mode pug-tab-width)
 (puppet-mode puppet-indent-level)
-(python-mode . editorconfig-set-indentation-python-mode)
-(python-ts-mode . editorconfig-set-indentation-python-mode)
+(python-mode . editorconfig--get-indentation-python-mode)
+(python-ts-mode . editorconfig--get-indentation-python-mode)
 (rjsx-mode js-indent-level sgml-basic-offset)
 (ruby-mode ruby-indent-level)
 (ruby-ts-mode ruby-indent-level)
@@ -327,7 +332,8 @@ This hook will be run even when there are no matching 
sections in
 Each element looks like (MODE . FUNCTION) or (MODE . INDENT-SPEC-LIST).
 
 If FUNCTION is provided, it will be called when setting the
-indentation.  The indent size will be passed.
+indentation.  The indent size will be passed and it should return
+a list of settings of the form (VAR . VAL).
 
 If INDENT-SPEC-LIST is provided, each element of it must have one of the
 following forms:
@@ -438,35 +444,30 @@ Make a message by passing ARGS to `format-message'."
   (and (stringp string)
(string-match-p "\\`[0-9]+\\'" string)))
 
-(defun editorconfig-set-indentation-python-mode (size)
-  "Set `python-mode' indent size to SIZE."
-  (when (boundp 'python-indent-offset)
-(setq-local python-indent-offset size))
-  ;; For https://gitlab.com/python-mode-devs/python-mode
-  (when (boundp 'py-indent-offset)
-(setq-local py-indent-offset size)))
-
-(defun editorconfig-set-indentation-latex-mode (size)
-  "Set `latex-mode' indent size to SIZE."
-  (setq-local tex-indent-basic size)
-  (setq-local tex-indent-item size)
-  (setq-local tex-indent-arg (* 2 size))
-  ;; For AUCTeX
-  (when (boundp 'TeX-brace-indent-level)
-(setq-local TeX-brace-indent-level size))
-  (when (boundp 'LaTeX-indent-level)
-(setq-local LaTeX-indent-level size))
-  (when (boundp 'LaTeX-item-indent)
-(setq-local LaTeX-item-indent (- size
-
-(defun editorconfig-set-indentation-lisp-mode (size)
- "Set indent

[nongnu] scratch/editorconfig 9f183805ce 4/5: Use new Emacs-30 hooks

2024-06-12 Thread Stefan Monnier via
branch: scratch/editorconfig
commit 9f183805cec5d1757cfd53ab7e375e2367839a2b
Author: Stefan Monnier 
Commit: Stefan Monnier 

Use new Emacs-30 hooks

* editorconfig.el (editorconfig--get-coding-system)
(editorconfig--get-dir-local-variables): New functions.
(editorconfig-mode): Use them if possible.
---
 editorconfig.el | 89 +
 1 file changed, 70 insertions(+), 19 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index ca271b5004..25b5a3296d 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -881,6 +881,41 @@ F is that function, and FILENAME and ARGS are arguments 
passed to F."
 (format "Error while setting variables from 
EditorConfig: %S" err
 ret))
 
+(defun editorconfig--get-coding-system (_size)
+  "Return the coding system to use according to EditorConfig.
+Meant to be used on `auto-coding-functions'."
+  (defvar auto-coding-file-name) ;; Emacs≥30
+  (when (and (stringp auto-coding-file-name)
+ (file-name-absolute-p auto-coding-file-name)
+;; Don't recurse infinitely.
+(not (string-match-p "\\.editorconfig\\'" auto-coding-file-name))
+ ;; FIXME: How important is it to support these `disabled-*'?
+ (not (editorconfig--disabled-for-filename auto-coding-file-name)))
+(let ((props (editorconfig-call-get-properties-function
+  auto-coding-file-name)))
+  (editorconfig-merge-coding-systems (gethash 'end_of_line props)
+ (gethash 'charset props)
+
+(defun editorconfig--get-dir-local-variables ()
+  "Return the directory local variables specified via EditorConfig.
+Meant to be used on `hack-dir-local-get-variables-functions'."
+  (when (and (stringp buffer-file-name)
+ ;; FIXME: How important is it to support these `disabled-*'?
+ (not (editorconfig--disabled-for-filename buffer-file-name))
+ (not (editorconfig--disabled-for-majormode major-mode)))
+(let* ((props (editorconfig-call-get-properties-function buffer-file-name))
+   (_ (with-demoted-errors "editorconfig-hack-properties-functions: %S"
+(run-hook-with-args
+ 'editorconfig-hack-properties-functions props)))
+   (alist (editorconfig--get-local-variables props)))
+  ;; FIXME: Actually, we should loop over the "editorconfig-core-handles"
+  ;; since each one comes from a different directory.
+  (when alist
+(cons
+ ;; FIXME: This should be the dir where we found the
+ ;; `.editorconfig' file.
+ (file-name-directory buffer-file-name)
+ alist)
 
 ;;;###autoload
 (define-minor-mode editorconfig-mode
@@ -890,25 +925,41 @@ To disable EditorConfig in some buffers, modify
 `editorconfig-exclude-modes' or `editorconfig-exclude-regexps'."
   :global t
   :lighter editorconfig-mode-lighter
-  (let ((modehooks '(prog-mode-hook
- text-mode-hook
- ;; Some modes call `kill-all-local-variables' in their 
init
- ;; code, which clears some values set by editorconfig.
- ;; For those modes, editorconfig-apply need to be called
- ;; explicitly through their hooks.
- rpm-spec-mode-hook)))
-(if editorconfig-mode
-(progn
-  (advice-add 'find-file-noselect :around 
'editorconfig--advice-find-file-noselect)
-  (advice-add 'insert-file-contents :around 
'editorconfig--advice-insert-file-contents)
-  (dolist (hook modehooks)
-(add-hook hook
-  'editorconfig-major-mode-hook
-  t)))
-  (advice-remove 'find-file-noselect 
'editorconfig--advice-find-file-noselect)
-  (advice-remove 'insert-file-contents 
'editorconfig--advice-insert-file-contents)
-  (dolist (hook modehooks)
-(remove-hook hook 'editorconfig-major-mode-hook)
+  (if (boundp 'hack-dir-local-get-variables-functions) ;Emacs≥30
+  (if editorconfig-mode
+  (progn
+(add-hook 'hack-dir-local-get-variables-functions
+  ;; Give them slightly lower precedence than settings from
+  ;; `dir-locals.el'.
+  #'editorconfig--get-dir-local-variables t)
+;; `auto-coding-functions' also exists in Emacs<30 but without
+;; access to the file's name via `auto-coding-file-name'.
+(add-hook 'auto-coding-functions
+  #'editorconfig--get-coding-system))
+(remove-hook 'hack-dir-local-get-variables-functions
+ #'editorconfig--get-dir-local-variables)
+(remove-hook 'auto-coding-functions
+ #'editorconfig--get-coding-system))
+;; Emacs<30
+(let ((modehooks '(prog-mode-hook
+   text-mode-hook
+

[nongnu] branch scratch/editorconfig created (now c8031d4983)

2024-06-12 Thread Stefan Monnier via
monnier pushed a change to branch scratch/editorconfig.

at  c8031d4983 WiP: Document test regressions

This branch includes the following new commits:

   new  c24ec14b8b (editorconfig--should-set): Eliminate 
`lisp-indent-offset` special case
   new  964747660c Don't hook into `read-only-mode-hook`
   new  54ee2b4862 (editorconfig-set-local-variables): Get first, set later
   new  9f183805ce Use new Emacs-30 hooks
   new  c8031d4983 WiP: Document test regressions




[elpa] externals/company b225aee4db 06/10: Narrow down the "forced sync" cases further

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit b225aee4db3dd02e4b5c591e85ac79903409488a
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Narrow down the "forced sync" cases further

#1468
---
 company.el | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/company.el b/company.el
index 2f346aecc8..052c33f1ad 100644
--- a/company.el
+++ b/company.el
@@ -1411,7 +1411,10 @@ be recomputed when this value changes."
 (defvar-local company-selection-changed nil)
 
 (defvar-local company--manual-action nil
-  "Non-nil, if manual completion took place.")
+  "Non-nil if manual completion was performed by the user.")
+
+(defvar-local company--manual-now nil
+  "Non-nil if manual completion is being performed now.")
 
 (defvar-local company--manual-prefix nil)
 
@@ -1591,12 +1594,11 @@ update if FORCE-UPDATE."
 'snippet
 
 (defun company--fetch-candidates (prefix)
-  (let* ((non-essential (not (company-explicit-action-p)))
+  (let* ((non-essential (not company--manual-now))
  (inhibit-redisplay t)
- ;; TODO: We can narrow this down further, but at least we need "fresh"
- ;; completions if the current command will use them (e.g. insert
- ;; common, or finish completion).
- (c (if (not non-essential)
+ ;; At least we need "fresh" completions if the current command will
+ ;; rely on the result (e.g. insert common, or finish completion).
+ (c (if company--manual-now
 (company-call-backend 'candidates prefix)
   (company-call-backend-raw 'candidates prefix
 (if (not (eq (car c) :async))
@@ -2104,8 +2106,10 @@ doesn't cause any immediate changes to the buffer text."
   (company-assert-enabled)
   (setq company--manual-action t)
   (unwind-protect
-  (let ((company-minimum-prefix-length 0))
-(or company-candidates
+  (let ((company-minimum-prefix-length 0)
+(company--manual-now t))
+(or (and company-candidates
+ (= company-point (point)))
 (company-auto-begin)))
 (unless company-candidates
   (setq company--manual-action nil



[elpa] externals/company 566c273678 09/10: Document the change in NEWS

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit 566c273678cae95db1541eb7b0ce1eddb26b8dfe
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Document the change in NEWS

#1468
---
 NEWS.md | 8 
 1 file changed, 8 insertions(+)

diff --git a/NEWS.md b/NEWS.md
index 7a5085ff2f..093f2bb3d7 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,14 @@
 
 # Next
 
+* Improved behavior when user types new character while completion is being
+  computed: better performance, less blinking (in the rare cases when it still
+  happened). The improvement extends to native async backends and to
+  `company-capf`.
+* As such `company-capf` now interrupts computation on new user
+  input. Completion tables that are incompatible with this behavior should get
+  updated: bind `inhibit-quit` to non-nil around their sensitive sections, or
+  simply around the whole implementation (as a fallback).
 * `company-elisp` has been removed.  It's not needed since Emacs 24.4, with all
   of its features having been incorporated into the built-in Elisp completion.
 * `company-files` shows shorter completions.  Previously, the popup spanned



[elpa] externals/company 854e48fa80 04/10: Add tests for capf interruption handling

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit 854e48fa804c0770e479a876e77414169d48edb9
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Add tests for capf interruption handling
---
 test/capf-tests.el | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/test/capf-tests.el b/test/capf-tests.el
index 37efa8d541..10bb267728 100644
--- a/test/capf-tests.el
+++ b/test/capf-tests.el
@@ -1,6 +1,6 @@
 ;;; capf-tests.el --- company tests for the company-capf backend  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2018-2019, 2021-2023  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019, 2021-2024  Free Software Foundation, Inc.
 
 ;; Author: João Távora 
 ;; Keywords:
@@ -141,5 +141,29 @@
   0 14 (face (company-tooltip-common company-tooltip)); 
"with-current-b"
   14 19 (face company-tooltip))); "uffer"
 
+(ert-deftest company-capf-interrupted-on-input ()
+  (should
+   (eq
+(catch 'interrupted
+  (with-temp-buffer
+(let ((completion-at-point-functions
+   (list (lambda ()
+   (list 1 1 obarray :company-use-while-no-input t
+  (unread-command-events '(?a)))
+  (company-capf 'candidates "a")
+  (error "Not reachable"
+'new-input)))
+
+(ert-deftest company-capf-uninterrupted ()
+  (should
+   (equal
+(with-temp-buffer
+  (let ((completion-at-point-functions
+ (list (lambda ()
+ (list 1 1 '("abcd" "ae" "be") t
+(unread-command-events '(?a)))
+(company-capf 'candidates "b")))
+'("be"
+
 (provide 'capf-tests)
 ;;; capf-tests.el ends here



[elpa] externals/company updated (6c7731d4ec -> 24c804393e)

2024-06-12 Thread ELPA Syncer
elpasync pushed a change to branch externals/company.

  from  6c7731d4ec company--clean-string: Handle negative ADD-LENGTH by 
falling back to NEW-STR
   new  3a5694426f Handle input interruption with throw-catch
   new  e23eccdb37 company-capf: Add property :company-use-while-no-input
   new  a66beb5344 Merge branch 'master' into async_no_cache_flicker
   new  854e48fa80 Add tests for capf interruption handling
   new  882fbe8572 Synchronize async backend in fewer cases and lay further 
groundwork
   new  b225aee4db Narrow down the "forced sync" cases further
   new  e27597f6f9 company-capf--candidates: Make sure to check 
'non-essential'
   new  61d992bd62 Remove :company-use-while-no-input, just default to 
interrupting
   new  566c273678 Document the change in NEWS
   new  24c804393e Merge pull request #1471 from 
company-mode/async_no_cache_flicker


Summary of changes:
 NEWS.md|  8 
 company-capf.el| 18 ++---
 company.el | 59 --
 test/capf-tests.el | 27 -
 4 files changed, 84 insertions(+), 28 deletions(-)



[elpa] externals/company 24c804393e 10/10: Merge pull request #1471 from company-mode/async_no_cache_flicker

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit 24c804393eaebe2e6919c1d9f7fbebfbc76d6eae
Merge: 6c7731d4ec 566c273678
Author: Dmitry Gutov 
Commit: GitHub 

Merge pull request #1471 from company-mode/async_no_cache_flicker

No-flicker with no-cache+async and while-no-input in company-capf
---
 NEWS.md|  8 
 company-capf.el| 18 ++---
 company.el | 59 --
 test/capf-tests.el | 27 -
 4 files changed, 84 insertions(+), 28 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 7a5085ff2f..093f2bb3d7 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,14 @@
 
 # Next
 
+* Improved behavior when user types new character while completion is being
+  computed: better performance, less blinking (in the rare cases when it still
+  happened). The improvement extends to native async backends and to
+  `company-capf`.
+* As such `company-capf` now interrupts computation on new user
+  input. Completion tables that are incompatible with this behavior should get
+  updated: bind `inhibit-quit` to non-nil around their sensitive sections, or
+  simply around the whole implementation (as a fallback).
 * `company-elisp` has been removed.  It's not needed since Emacs 24.4, with all
   of its features having been incorporated into the built-in Elisp completion.
 * `company-files` shows shorter completions.  Previously, the popup spanned
diff --git a/company-capf.el b/company-capf.el
index 0173a611cc..2543f3d8d2 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -1,6 +1,6 @@
 ;;; company-capf.el --- company-mode completion-at-point-functions backend -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2013-2023  Free Software Foundation, Inc.
+;; Copyright (C) 2013-2024  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier 
 
@@ -189,9 +189,10 @@ so we can't just use the preceding variable instead.")
  table pred
 (company-capf--save-current-data res meta)
 (when res
-  (let* ((candidates (completion-all-completions input table pred
+  (let* ((candidates (company-capf--candidates-1 input table pred
  (length input)
- meta))
+ meta
+ non-essential))
  (sortfun (cdr (assq 'display-sort-function meta)))
  (last (last candidates))
  (base-size (and (numberp (cdr last)) (cdr last
@@ -207,6 +208,17 @@ so we can't just use the preceding variable instead.")
   candidates))
   candidates)
 
+(defun company-capf--candidates-1 (input table pred len meta 
interrupt-on-input)
+  (if (not interrupt-on-input)
+  (completion-all-completions input table pred len meta)
+(let (res)
+  (and (while-no-input
+ (setq res
+   (completion-all-completions input table pred len meta))
+ nil)
+   (throw 'interrupted 'new-input))
+  res)))
+
 (defun company--capf-post-completion (arg)
   (let* ((res company-capf--current-completion-data)
  (exit-function (plist-get (nthcdr 4 res) :exit-function))
diff --git a/company.el b/company.el
index 9b518347c3..fb564f1d25 100644
--- a/company.el
+++ b/company.el
@@ -1411,7 +1411,10 @@ be recomputed when this value changes."
 (defvar-local company-selection-changed nil)
 
 (defvar-local company--manual-action nil
-  "Non-nil, if manual completion took place.")
+  "Non-nil if manual completion was performed by the user.")
+
+(defvar-local company--manual-now nil
+  "Non-nil if manual completion is being performed now.")
 
 (defvar-local company--manual-prefix nil)
 
@@ -1591,12 +1594,11 @@ update if FORCE-UPDATE."
 'snippet
 
 (defun company--fetch-candidates (prefix)
-  (let* ((non-essential (not (company-explicit-action-p)))
+  (let* ((non-essential (not company--manual-now))
  (inhibit-redisplay t)
- (c (if (or company-selection-changed
-;; FIXME: This is not ideal, but we have not managed to 
deal
-;; with these situations in a better way yet.
-(company-require-match-p))
+ ;; At least we need "fresh" completions if the current command will
+ ;; rely on the result (e.g. insert common, or finish completion).
+ (c (if company--manual-now
 (company-call-backend 'candidates prefix)
   (company-call-backend-raw 'candidates prefix
 (if (not (eq (car c) :async))
@@ -1617,9 +1619,11 @@ update if FORCE-UPDATE."
 (while (member (car unread-command-events)
'(company-foo (t . company-foo)))
   (pop unread-command-events))
-(prog1
-(and (consp res) res)
-  (setq res 'exited))
+(let ((res-was res))
+   

[elpa] externals/dape 58067c3daa 4/4: Improve error message when failing to establish TCP connection

2024-06-12 Thread ELPA Syncer
branch: externals/dape
commit 58067c3daad6177e8b01c9c284bde0f9911f75c5
Author: Daniel Pettersson 
Commit: Daniel Pettersson 

Improve error message when failing to establish TCP connection
---
 dape.el | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dape.el b/dape.el
index cf4f73b1fb..c983b722d8 100644
--- a/dape.el
+++ b/dape.el
@@ -2088,9 +2088,13 @@ symbol `dape-connection'."
   (setq retries (1- retries)))
 (if (zerop retries)
 (progn
-  (dape--repl-message (format "Unable to connect to server %s:%d"
+  (dape--repl-message (format "* Unable to connect to dap server 
at %s:%d *"
   host (plist-get config 'port))
   'dape-repl-error-face)
+  (dape--repl-message
+   (format "* Connection is configurable by %s and %s keys *"
+   (propertize "host" 'font-lock-face 
'font-lock-keyword-face)
+   (propertize "port" 'font-lock-face 
'font-lock-keyword-face)))
   ;; barf server std-err
   (when-let ((buffer
   (and server-process



[elpa] externals/dape 5467629f85 1/4: Remove mouse-face highlight from inlay hints value part

2024-06-12 Thread ELPA Syncer
branch: externals/dape
commit 5467629f85d5364e966738cd8b9ca472b52612eb
Author: Daniel Pettersson 
Commit: Daniel Pettersson 

Remove mouse-face highlight from inlay hints value part

The value part of the inlay hints does not include any mouse-*
binding, and there for should not be "face"ed as such
---
 dape.el | 79 ++---
 1 file changed, 37 insertions(+), 42 deletions(-)

diff --git a/dape.el b/dape.el
index 39cc629bd6..88736dd7c0 100644
--- a/dape.el
+++ b/dape.el
@@ -4727,48 +4727,43 @@ Update `dape--inlay-hint-overlays' from SCOPES."
  do
  (setcdr cons (list value updated-p))
  (setf symbols (delq cons symbols)
-  (cl-loop for inlay-hint in dape--inlay-hint-overlays
-   when (overlayp inlay-hint) do
-   (cl-loop with symbols = (overlay-get inlay-hint 'dape-symbols)
-for (symbol value update) in  symbols
-when value
-collect
-(format
- "%s %s"
- (propertize
-  (format "%s:" symbol)
-  'face 'dape-inlay-hint-face
- 'mouse-face 'highlight
- 'keymap
- (let ((map (make-sparse-keymap))
-   (sym symbol))
-   (define-key map [mouse-1]
-   (lambda (event)
- (interactive "e")
- (save-selected-window
-   (let ((start (event-start event)))
- (select-window (posn-window start))
- (save-excursion
-   (goto-char (posn-point start))
-   (dape-watch-dwim sym nil t))
-   map)
- 'help-echo
- (format "mouse-2, RET: add `%s' to watch" symbol))
- (propertize
-  (truncate-string-to-width
-   (substring value
-  0 (string-match-p "\n" value))
-   dape-inlay-hints-variable-name-max nil nil t)
-  'mouse-face 'highlight
-  'help-echo value
-  'face (if update 'dape-inlay-hint-highlight-face
-  'dape-inlay-hint-face)))
-into after-string
-finally do
-(thread-last
-  (mapconcat 'identity after-string 
dape--inlay-hint-seperator)
-  (format "  %s")
-  (overlay-put inlay-hint 'after-string)
+  (cl-loop
+   for inlay-hint in dape--inlay-hint-overlays
+   when (overlayp inlay-hint) do
+   (cl-loop
+with symbols = (overlay-get inlay-hint 'dape-symbols)
+for (symbol value update) in  symbols
+when value collect
+(concat
+ (propertize (format "%s:" symbol)
+ 'face 'dape-inlay-hint-face
+ 'mouse-face 'highlight
+ 'keymap
+ (let ((map (make-sparse-keymap))
+   (sym symbol))
+   (define-key map [mouse-1]
+   (lambda (event)
+ (interactive "e")
+ (save-selected-window
+   (let ((start (event-start event)))
+ (select-window (posn-window start))
+ (save-excursion
+   (goto-char (posn-point start))
+   (dape-watch-dwim sym nil t))
+   map)
+ 'help-echo
+ (format "mouse-2: add `%s' to watch" symbol))
+ " "
+ (propertize (truncate-string-to-width
+  (substring value 0 (string-match-p "\n" value))
+  dape-inlay-hints-variable-name-max nil nil t)
+ 'help-echo value
+ 'face (if update 'dape-inlay-hint-highlight-face
+ 'dape-inlay-hint-face)))
+into after-string finally do
+(thread-last (mapconcat 'identity after-string dape--inlay-hint-seperator)
+ (format "  %s")
+ (overlay-put inlay-hint 'after-string)
 
 (defun dape-inlay-hints-update ()
   "Update inlay hints."



[elpa] externals/dape updated (be9af1b193 -> 58067c3daa)

2024-06-12 Thread ELPA Syncer
elpasync pushed a change to branch externals/dape.

  from  be9af1b193 Generate new hexlish buffers on dape-memory-read
   new  5467629f85 Remove mouse-face highlight from inlay hints value part
   new  27f83cb858 Fix stale modeline status on switching adapter 
connections
   new  8ebd0181e2 Remove error when breakpoint on line where 
thing-at-point is nil
   new  58067c3daa Improve error message when failing to establish TCP 
connection


Summary of changes:
 dape.el | 90 -
 1 file changed, 45 insertions(+), 45 deletions(-)



[elpa] externals/dape 27f83cb858 2/4: Fix stale modeline status on switching adapter connections

2024-06-12 Thread ELPA Syncer
branch: externals/dape
commit 27f83cb858a7421c8319eafdf45425a204a67e44
Author: Daniel Pettersson 
Commit: Daniel Pettersson 

Fix stale modeline status on switching adapter connections
---
 dape.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dape.el b/dape.el
index 88736dd7c0..bd23f45628 100644
--- a/dape.el
+++ b/dape.el
@@ -2434,7 +2434,8 @@ When SKIP-UPDATE is non nil, does not notify adapter 
about removal."
  (alist-get thread-name collection nil nil 'equal)))
   (setf (dape--thread-id conn) thread-id)
   (setq dape--connection-selected conn)
-  (dape--update conn t))
+  (dape--update conn t)
+  (dape--mode-line-format))
 
 (defun dape-select-stack (conn stack-id)
   "Selected current stack for adapter CONN by STACK-ID."



[elpa] externals/emms cead7b435a: emms-idapi: track (recording) features and debug buffers

2024-06-12 Thread ELPA Syncer
branch: externals/emms
commit cead7b435a679690fd4bbe91fa2f57739a1e0077
Author: Yoni Rabkin 
Commit: Yoni Rabkin 

emms-idapi: track (recording) features and debug buffers
---
 emms-idapi-browser.el | 88 
 emms-idapi-musicbrainz.el | 93 +--
 2 files changed, 139 insertions(+), 42 deletions(-)

diff --git a/emms-idapi-browser.el b/emms-idapi-browser.el
index 84b6386893..d89a32666b 100644
--- a/emms-idapi-browser.el
+++ b/emms-idapi-browser.el
@@ -26,6 +26,14 @@
 ;;; Commentary:
 ;;
 
+(defvar emms-idapi-browser-debug-name
+  " *Emms Search Debug Browser*"
+  "Name of the search browser debug buffer")
+
+(defvar emms-idapi-browser-debug-buffer
+  nil
+  "Search browser debug buffer")
+
 (defvar emms-idapi-browser-name
   "Emms Search Browser"
   "Name of the search browser buffer")
@@ -91,6 +99,21 @@
   (error "could not read Emms track at point"))
 track))
 
+(defun emms-idapi-browser-search-recording-artist (track)
+  "Search for the recording and artist of TRACK."
+  (let ((recording (alist-get 'info-title track))
+   (artist (or (alist-get 'info-artist track)
+   (alist-get 'info-albumartist track
+(list
+ (cons 'info-title (read-string "search for recording (track): " 
recording))
+ (cons 'info-artist (read-string "search for artist: " artist)
+
+(defun emms-idapi-browser-search-recording (track)
+  "Search for the recording of TRACK."
+  (let ((recording (alist-get 'info-title track)))
+(list
+ (cons 'info-title (read-string "search for recording (track): " 
recording)
+
 (defun emms-idapi-browser-search-artist (track)
   "Search for the artist of TRACK."
   (let ((artist (or (alist-get 'info-artist track)
@@ -117,6 +140,22 @@
 (format "search for album \"%s\" by artist: " 
search-album)
 artist)
 
+(defun emms-idapi-browser-search-recording-artist-at ()
+  "Search for the recording and artist of the track at point."
+  (interactive)
+  (emms-idapi-browser-show
+   (emms-idapi-search emms-idapi-service
+ (emms-idapi-browser-search-recording-artist
+  (emms-playlist-track-at (point))
+
+(defun emms-idapi-browser-search-recording-at ()
+  "Search for the recording of the track at point."
+  (interactive)
+  (emms-idapi-browser-show
+   (emms-idapi-search emms-idapi-service
+ (emms-idapi-browser-search-recording
+  (emms-playlist-track-at (point))
+
 (defun emms-idapi-browser-search-artist-at ()
   "Search for the artist of the track at point."
   (interactive)
@@ -144,12 +183,21 @@
 ;;; --
 ;;; Response
 ;;; --
+(defun emms-idapi-browser-write-debug (response)
+  "Write RESPONSE to the browser debug buffer."
+  (let ((buffer (get-buffer-create emms-idapi-browser-debug-name)))
+(with-current-buffer buffer
+  (erase-buffer)
+  (insert (format "%s" response))
+  (setq emms-idapi-browser-debug-buffer buffer
+
 (defun emms-idapi-browser-print-header (header)
   "Print the material for the search HEADER."
   (let ((artist (alist-get 'info-artist header))
-   (album (alist-get 'info-album header))
+   (album  (alist-get 'info-album header))
+   (title  (alist-get 'info-title header))
(service (alist-get emms-idapi-service emms-idapi-services-alist)))
-(when (not (or artist album))
+(when (not (or artist album title))
   (error "could not read header: %s" header))
 (insert (format "service: %s (%s)\n"
(alist-get 'name service)
@@ -158,6 +206,8 @@
   (insert (format "artist:  %s\n" artist)))
 (when album
   (insert (format "album:   %s\n" album)))
+(when title
+  (insert (format "title:   %s\n" title)))
 (insert "\n")))
 
 (defun emms-idapi-browser-entry-packaging (entry)
@@ -168,36 +218,44 @@
(format ", %s" packaging)
   "")))
 
+(defun emms-idapi-browser-print-entry-artist (entry)
+  "Return artist ENTRY."
+  (format "%s%s%s\n\n"
+ (alist-get 'info-artist entry)
+ (if (alist-get 'info-country entry)
+ (format " (%s) " (alist-get 'info-country entry))
+   "")
+ (let ((begin (alist-get 'begin (alist-get 'info-time entry)))
+   (end (alist-get 'end (alist-get 'info-time entry
+   (format "%s%s"
+   (if begin begin "")
+   (if end (format " - %s, " end) "")
+
 (defun emms-idapi-browser-print-entry (entry)
   "Print ENTRY."
-  (cond ((equal 'info-release (alist-get 'type entry))
+  (cond ((equal 'idapi-release (alist-get 'type entry))
 (insert (format "\"%s\" by %s%s\n"
 (alist-get 'info-album entry)
 (alist-get 'info-artist entry)
  

[elpa] externals/dape 8ebd0181e2 3/4: Remove error when breakpoint on line where thing-at-point is nil

2024-06-12 Thread ELPA Syncer
branch: externals/dape
commit 8ebd0181e2cb9b4abad8bb540bbf30f9ac62b9f2
Author: Daniel Pettersson 
Commit: Daniel Pettersson 

Remove error when breakpoint on line where thing-at-point is nil

Breakpoint info buffer signals error on revert if thing-at-point 'line
returns nil on breakpoint position
---
 dape.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dape.el b/dape.el
index bd23f45628..cf4f73b1fb 100644
--- a/dape.el
+++ b/dape.el
@@ -3599,7 +3599,7 @@ displayed."
(save-excursion
  (goto-char (overlay-start breakpoint))
  (truncate-string-to-width
-  (concat " " (string-trim (thing-at-point 'line)))
+  (concat " " (string-trim (or (thing-at-point 'line) "")))
   dape-info-breakpoint-source-line-max
 (when-let* (with-hits-p
 (hits (overlay-get breakpoint 'dape-hits)))



[elpa] externals/company e27597f6f9 07/10: company-capf--candidates: Make sure to check 'non-essential'

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit e27597f6f97d95b70c048a9530d2b03f336f315b
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

company-capf--candidates: Make sure to check 'non-essential'
---
 company-capf.el| 3 ++-
 test/capf-tests.el | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/company-capf.el b/company-capf.el
index 09ba50b1a1..8d796f5f01 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -193,7 +193,8 @@ so we can't just use the preceding variable instead.")
  (candidates (company-capf--candidates-1 input table pred
  (length input)
  meta
- interrupt))
+ (and non-essential
+  interrupt)))
  (sortfun (cdr (assq 'display-sort-function meta)))
  (last (last candidates))
  (base-size (and (numberp (cdr last)) (cdr last
diff --git a/test/capf-tests.el b/test/capf-tests.el
index 10bb267728..bf7997ade0 100644
--- a/test/capf-tests.el
+++ b/test/capf-tests.el
@@ -149,7 +149,8 @@
 (let ((completion-at-point-functions
(list (lambda ()
(list 1 1 obarray :company-use-while-no-input t
-  (unread-command-events '(?a)))
+  (unread-command-events '(?a))
+  (non-essential t))
   (company-capf 'candidates "a")
   (error "Not reachable"
 'new-input)))



[elpa] externals/company 61d992bd62 08/10: Remove :company-use-while-no-input, just default to interrupting

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit 61d992bd62ebaacf6d3e9e621951f6408006fc54
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Remove :company-use-while-no-input, just default to interrupting

As long as completion is `non-essential', of course.

#1468

Resulting from this thread:
https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg01217.html

This makes company-capf more compatible with Corfu, Cc @minad
---
 company-capf.el | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/company-capf.el b/company-capf.el
index 8d796f5f01..2543f3d8d2 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -189,12 +189,10 @@ so we can't just use the preceding variable instead.")
  table pred
 (company-capf--save-current-data res meta)
 (when res
-  (let* ((interrupt (plist-get (nthcdr 4 res) :company-use-while-no-input))
- (candidates (company-capf--candidates-1 input table pred
+  (let* ((candidates (company-capf--candidates-1 input table pred
  (length input)
  meta
- (and non-essential
-  interrupt)))
+ non-essential))
  (sortfun (cdr (assq 'display-sort-function meta)))
  (last (last candidates))
  (base-size (and (numberp (cdr last)) (cdr last



[elpa] externals/company e23eccdb37 02/10: company-capf: Add property :company-use-while-no-input

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit e23eccdb37173971a54c5901c736513960486ff4
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

company-capf: Add property :company-use-while-no-input

#1468
---
 company-capf.el | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/company-capf.el b/company-capf.el
index 0173a611cc..09ba50b1a1 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -1,6 +1,6 @@
 ;;; company-capf.el --- company-mode completion-at-point-functions backend -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2013-2023  Free Software Foundation, Inc.
+;; Copyright (C) 2013-2024  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier 
 
@@ -189,9 +189,11 @@ so we can't just use the preceding variable instead.")
  table pred
 (company-capf--save-current-data res meta)
 (when res
-  (let* ((candidates (completion-all-completions input table pred
+  (let* ((interrupt (plist-get (nthcdr 4 res) :company-use-while-no-input))
+ (candidates (company-capf--candidates-1 input table pred
  (length input)
- meta))
+ meta
+ interrupt))
  (sortfun (cdr (assq 'display-sort-function meta)))
  (last (last candidates))
  (base-size (and (numberp (cdr last)) (cdr last
@@ -207,6 +209,17 @@ so we can't just use the preceding variable instead.")
   candidates))
   candidates)
 
+(defun company-capf--candidates-1 (input table pred len meta 
interrupt-on-input)
+  (if (not interrupt-on-input)
+  (completion-all-completions input table pred len meta)
+(let (res)
+  (and (while-no-input
+ (setq res
+   (completion-all-completions input table pred len meta))
+ nil)
+   (throw 'interrupted 'new-input))
+  res)))
+
 (defun company--capf-post-completion (arg)
   (let* ((res company-capf--current-completion-data)
  (exit-function (plist-get (nthcdr 4 res) :exit-function))



[elpa] externals/company a66beb5344 03/10: Merge branch 'master' into async_no_cache_flicker

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit a66beb534458e02dcb95cb266a4515c83e4a194f
Merge: e23eccdb37 57734334e2
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Merge branch 'master' into async_no_cache_flicker
---
 company-dabbrev-code.el |  2 +-
 company-files.el|  2 +-
 company-ispell.el   |  2 +-
 company-semantic.el |  4 ++--
 company.el  | 22 +++---
 test/async-tests.el |  2 +-
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/company-dabbrev-code.el b/company-dabbrev-code.el
index cf435f28b2..5d7bf66475 100644
--- a/company-dabbrev-code.el
+++ b/company-dabbrev-code.el
@@ -78,7 +78,7 @@ also `company-dabbrev-code-time-limit'."
 (defun company-dabbrev-code--make-regexp (prefix)
   (let ((prefix-re
  (cond
-  ((equal prefix "")
+  ((string-empty-p prefix)
"\\([a-zA-Z]\\|\\s_\\)")
   ((not company-dabbrev-code-completion-styles)
(regexp-quote prefix))
diff --git a/company-files.el b/company-files.el
index 6a53ada5f8..ebe3a6a28a 100644
--- a/company-files.el
+++ b/company-files.el
@@ -53,7 +53,7 @@ Set this to nil to disable that behavior."
 (lambda (s1 s2) (string-lessp (downcase s1) (downcase 
s2))
 (when company-files-exclusions
   (setq comp (company-files--exclusions-filtered comp)))
-(if (equal prefix "")
+(if (string-empty-p prefix)
 (delete "../" (delete "./" comp))
   comp))
 (file-error nil)))
diff --git a/company-ispell.el b/company-ispell.el
index d40d8c6eb4..2699d30bed 100644
--- a/company-ispell.el
+++ b/company-ispell.el
@@ -81,7 +81,7 @@ If nil, use `ispell-complete-word-dict' or 
`ispell-alternate-dictionary'."
   (lambda () (ispell-lookup-words "" dict))
   :check-tag dict))
 (completion-ignore-case t))
-   (if (string= arg "")
+   (if (string-empty-p arg)
;; Small optimization.
all-words
  (company-substitute-prefix
diff --git a/company-semantic.el b/company-semantic.el
index 53b11c0320..df20e6260e 100644
--- a/company-semantic.el
+++ b/company-semantic.el
@@ -140,7 +140,7 @@ and `c-electric-colon', for automatic completion right 
after \">\" and
  (memq major-mode company-semantic-modes)
  (not (company-in-string-or-comment))
  (or (company-semantic--prefix) 'stop)))
-(candidates (if (and (equal arg "")
+(candidates (if (and (string-empty-p arg)
  (not (looking-back "->\\|\\.\\|::" (- (point) 2
 (company-semantic-completions-raw arg)
   (company-semantic-completions arg)))
@@ -151,7 +151,7 @@ and `c-electric-colon', for automatic completion right 
after \">\" and
 (doc-buffer (company-semantic-doc-buffer
  (assoc arg company-semantic--current-tags)))
 ;; Because "" is an empty context and doesn't return local variables.
-(no-cache (equal arg ""))
+(no-cache (string-empty-p arg))
 (duplicates t)
 (location (let ((tag (assoc arg company-semantic--current-tags)))
 (when (buffer-live-p (semantic-tag-buffer tag))
diff --git a/company.el b/company.el
index 3f6a6e04d3..e9a542cf46 100644
--- a/company.el
+++ b/company.el
@@ -1993,7 +1993,7 @@ Keywords and function definition names are ignored."
 (cl-delete-if
  (lambda (candidate)
(goto-char w-start)
-   (when (and (not (equal candidate ""))
+   (when (and (not (string-empty-p candidate))
   (search-forward candidate w-end t)
   ;; ^^^ optimize for large lists where most elements
   ;; won't have a match.
@@ -2147,8 +2147,8 @@ For more details see `company-insertion-on-trigger' and
  (if (consp company-insertion-triggers)
  (memq (char-syntax (string-to-char input))
company-insertion-triggers)
-   (string-match (regexp-quote (substring input 0 1))
- company-insertion-triggers)
+   (string-match-p (regexp-quote (substring input 0 1))
+   company-insertion-triggers)
 
 (defun company--incremental-p ()
   (and (> (point) company-point)
@@ -2512,9 +2512,9 @@ each one wraps a part of the input string."
 (defun company--search-update-predicate (ss)
   (let* ((re (funcall company-search-regexp-function ss))
  (company-candidates-predicate
-  (and (not (string= re ""))
+  (and (not (string-empty-p re))
company-search-filtering
-   (lambda (candidate) (string-match re candidate
+   (lambda (candidate) (string-match-p re candidate
  (cc (company-calculate-candidates company-prefix
(company-call-backend 
'igno

[elpa] externals/company 882fbe8572 05/10: Synchronize async backend in fewer cases and lay further groundwork

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit 882fbe8572517f2a01776fc87b5dc344493cd016
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Synchronize async backend in fewer cases and lay further groundwork

The change in company-point setting will help when the condition for
non-essential changes from "not explicit-action" to "not explicit-action 
now".
---
 company.el | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/company.el b/company.el
index e9a542cf46..2f346aecc8 100644
--- a/company.el
+++ b/company.el
@@ -1593,10 +1593,10 @@ update if FORCE-UPDATE."
 (defun company--fetch-candidates (prefix)
   (let* ((non-essential (not (company-explicit-action-p)))
  (inhibit-redisplay t)
- (c (if (or company-selection-changed
-;; FIXME: This is not ideal, but we have not managed to 
deal
-;; with these situations in a better way yet.
-(company-require-match-p))
+ ;; TODO: We can narrow this down further, but at least we need "fresh"
+ ;; completions if the current command will use them (e.g. insert
+ ;; common, or finish completion).
+ (c (if (not non-essential)
 (company-call-backend 'candidates prefix)
   (company-call-backend-raw 'candidates prefix
 (if (not (eq (car c) :async))
@@ -2211,8 +2211,8 @@ For more details see `company-insertion-on-trigger' and
 (- company-point (length company-prefix
 (company-calculate-candidates new-prefix ignore-case)
 (cond
- ((eq c 'new-input) ; Keep the old completions, but update prefix.
-  (setq company-prefix new-prefix))
+ ((eq c 'new-input) ; Keep the old completions, company-point, prefix.
+  t)
  ((and company-abort-on-unique-match
(company--unique-match-p c new-prefix ignore-case))
   ;; Handle it like completion was aborted, to differentiate from user
@@ -2221,7 +2221,8 @@ For more details see `company-insertion-on-trigger' and
   (company-cancel 'unique))
  ((consp c)
   ;; incremental match
-  (setq company-prefix new-prefix)
+  (setq company-prefix new-prefix
+company-point (point))
   (company-update-candidates c)
   c)
  ((and (characterp last-command-event)
@@ -2255,6 +2256,7 @@ For more details see `company-insertion-on-trigger' and
 ;; Keep this undocumented, esp. while only 1 backend needs it.
 (company-call-backend 'set-min-prefix min-prefix)
 (setq company-prefix (company--prefix-str prefix)
+  company-point (point)
   company-backend backend
   c (catch 'interrupted
   (company-calculate-candidates company-prefix 
ignore-case)))
@@ -2288,8 +2290,7 @@ For more details see `company-insertion-on-trigger' and
 (company--begin-new)))
   (if (not company-candidates)
   (setq company-backend nil)
-(setq company-point (point)
-  company--point-max (point-max))
+(setq company--point-max (point-max))
 (company-ensure-emulation-alist)
 (company-enable-overriding-keymap company-active-map)
 (company-call-frontends 'update)))



[elpa] externals/company 3a5694426f 01/10: Handle input interruption with throw-catch

2024-06-12 Thread ELPA Syncer
branch: externals/company
commit 3a5694426f69b8e35a43d5e8523628f211f3f198
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Handle input interruption with throw-catch

Employ the scheme previously devised by lsp-mode folks: keep the old list of
completions (setting it to nil is what created the flicker) but updated the
prefix.

This is for "continue" case, of course. begin-new should still fail.

#1468
---
 company.el | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/company.el b/company.el
index 2764bbff09..3f6a6e04d3 100644
--- a/company.el
+++ b/company.el
@@ -1617,9 +1617,11 @@ update if FORCE-UPDATE."
 (while (member (car unread-command-events)
'(company-foo (t . company-foo)))
   (pop unread-command-events))
-(prog1
-(and (consp res) res)
-  (setq res 'exited))
+(let ((res-was res))
+  (setq res 'exited)
+  (if (eq 'none res-was)
+  (throw 'interrupted 'new-input)
+res-was))
 
 (defun company--sneaky-refresh ()
   (when company-candidates (company-call-frontends 'unhide))
@@ -2201,13 +2203,16 @@ For more details see `company-insertion-on-trigger' and
 (setq company-candidates-cache nil))
   (let* ((new-prefix (company-call-backend 'prefix))
  (ignore-case (company-call-backend 'ignore-case))
- (c (when (and (company--good-prefix-p new-prefix
-   (company--prefix-min-length))
-   (setq new-prefix (company--prefix-str new-prefix))
-   (= (- (point) (length new-prefix))
-  (- company-point (length company-prefix
-  (company-calculate-candidates new-prefix ignore-case
+ (c (catch 'interrupted
+  (when (and (company--good-prefix-p new-prefix
+ (company--prefix-min-length))
+ (setq new-prefix (company--prefix-str new-prefix))
+ (= (- (point) (length new-prefix))
+(- company-point (length company-prefix
+(company-calculate-candidates new-prefix ignore-case)
 (cond
+ ((eq c 'new-input) ; Keep the old completions, but update prefix.
+  (setq company-prefix new-prefix))
  ((and company-abort-on-unique-match
(company--unique-match-p c new-prefix ignore-case))
   ;; Handle it like completion was aborted, to differentiate from user
@@ -2251,8 +2256,12 @@ For more details see `company-insertion-on-trigger' and
 (company-call-backend 'set-min-prefix min-prefix)
 (setq company-prefix (company--prefix-str prefix)
   company-backend backend
-  c (company-calculate-candidates company-prefix ignore-case))
+  c (catch 'interrupted
+  (company-calculate-candidates company-prefix 
ignore-case)))
 (cond
+ ((or (null c) (eq c 'new-input))
+  (when company--manual-action
+(message "No completion found")))
  ((and company-abort-on-unique-match
(company--unique-match-p c company-prefix ignore-case)
(if company--manual-action
@@ -2262,9 +2271,6 @@ For more details see `company-insertion-on-trigger' and
  t))
   ;; ...abort and run the hooks, e.g. to clear the cache.
   (company-cancel 'unique))
- ((null c)
-  (when company--manual-action
-(message "No completion found")))
  (t ;; We got completions!
   (when company--manual-action
 (setq company--manual-prefix prefix))



[nongnu] elpa/hyperdrive f71f3bd904 11/31: Tidy: (h/seed-url) Use pcase-let instead of pcase

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit f71f3bd90402af3a498a68b6a692646bb567ba5a
Author: Joseph Turner 
Commit: Joseph Turner 

Tidy: (h/seed-url) Use pcase-let instead of pcase

Also add comment about filling hyperdrive disk-usage in the future.
---
 hyperdrive-lib.el | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 9bb6d2cb51..6f5b70c361 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1319,13 +1319,15 @@ With PURGE, delete hash table entry for HYPERDRIVE."
 That is, if the SEED has been used to create a local
 hyperdrive."
   (condition-case err
-  (pcase (h/api 'get (format "hyper://localhost/?key=%s"
- (url-hexify-string seed))
-   :as 'response :noquery t)
-((and (pred plz-response-p)
-  response
-  (guard (= 200 (plz-response-status response
- (plz-response-body response)))
+  (pcase-let
+  (((cl-struct plz-response (body url))
+(h/api 'get (format "hyper://localhost/?key=%s"
+(url-hexify-string seed))
+  :as 'response :noquery t)))
+;; TODO: Update hyperdrive disk-usage.  The following doesn't work
+;; because the response doesn't have the proper ETag header:
+;; (h//fill (h/url-entry url) headers)
+url)
 (plz-error (if (= 400 (plz-response-status (plz-error-response (caddr 
err
;; FIXME: If plz-error is a curl-error, this block will 
fail.
nil



[nongnu] elpa/hyperdrive b6896e0ab7 01/31: Fix: (h//fill) Only update version ranges if Etag header is present

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit b6896e0ab79ffc1f65151e5d50f2f42fc7eb5fa3
Author: Joseph Turner 
Commit: Joseph Turner 

Fix: (h//fill) Only update version ranges if Etag header is present

Etag is not present in the response headers for DELETE Cache-Control: 
No-Store.
---
 hyperdrive-lib.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 00ffcbcd3c..c325219fcf 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -733,7 +733,8 @@ Returns filled ENTRY."
   ;; File HEAD/GET request ETag header does not retrieve the
   ;; hyperdrive's latest version, so `h/update-existent-version-range'
   ;; will not necessarily fill in the entry's last range.
-  (h/update-existent-version-range entry (string-to-number etag)))
+  (when etag
+(h/update-existent-version-range entry (string-to-number etag
 entry))
 
 (defun h//fill-listing-entries (listing hyperdrive version)



[nongnu] elpa/hyperdrive updated (0d04b9b2ea -> ad6c7b90ab)

2024-06-12 Thread ELPA Syncer
elpasync pushed a change to branch elpa/hyperdrive.

  from  0d04b9b2ea Change: (hyperdrive-entry) Improve docstring
   new  b6896e0ab7 Fix: (h//fill) Only update version ranges if Etag header 
is present
   new  7862965b83 Meta: Update hyper-gateway-ushin to 3.9.0: Clear cache
   new  36fe73727c Fix: (h/handler-default) Fill disk-usage from GET request
   new  857edd0a9b Comment: (h/handler-streamable) Note limitation 
regarding disk-usage
   new  ad488cd057 Fix: (h/url-loader) Fill disk-usage from GET request
   new  ab71379d58 Fix: (h/diff-file-entries) Fill disk-usage from GET 
request
   new  d4d3d92e17 Refactor: (h/fill-metadata) Don't use :as
   new  d8e96321d2 Fix: (h/fill-metadata) Fill disk-usage from GET request
   new  5a4f6b9607 Fix: (h/download-url) Fill disk-usage from GET request
   new  81c4b90895 Tidy: (h/fill) Set then to 'sync by default
   new  f71f3bd904 Tidy: (h/seed-url) Use pcase-let instead of pcase
   new  1db1a4f54a Comment: Update TODO
   new  019c9f3c6a Fix: (h//fill) Only fill version range when Etag is 
non-nil
   new  df4da23927 Change: (hyperdrive-new) Remove old workaround for fixed 
plz issue
   new  24f4c589cc Comment: Add TODOs
   new  dcbb6c2e15 Meta: Update hyper-gateway-ushin to 3.9.1: More 
X-Drive-Size headers
   new  dd3670e43e Comment: Add TODO
   new  e2685023a7 Add: (h/clear-cache) Clear local cache for file or 
directory
   new  e6cca3ccc9 Fix: (hyperdrive-new) :as 'response
   new  750ea89b57 Comment: Add TODO
   new  a20c4b9410 Tidy: (hyperdrive-menu) Capitalization
   new  499a591d4b Change: (h/clear-cache) Use POST instead of DELETE to 
clear cache
   new  a857869c48 Change: (h/menu) Add binding for h/clear-cache
   new  965b39f5d9 Change: (h/menu-bar-menu) Add binding for h/clear-cache
   new  2446113d98 Meta: Update changelog
   new  0bb8d21108 Change: (h/dir-mode-map) Add binding for h/clear-cache
   new  316e5579fb Change: (h/clear-cache) Prompt for confirmation and 
report success
   new  0db40da6f9 Meta: Update hyper-gateway-ushin to 3.9.2: Clear old 
versions
   new  035b3bc5ac Change: (h/forget-file) Rename from h/clear-cache
   new  2f1aebbe04 Docs: (hyperdrive-forget-file) Document command
   new  ad6c7b90ab Add hyperdrive-forget-file command


Summary of changes:
 CHANGELOG.org   |   2 +
 doc/hyperdrive.org  |  18 +++
 doc/hyperdrive.texi |  22 
 hyperdrive-diff.el  |   2 +
 hyperdrive-dir.el   |   1 +
 hyperdrive-lib.el   | 153 
 hyperdrive-menu.el  |   6 ++-
 hyperdrive-vars.el  |   2 +-
 hyperdrive.el   | 100 --
 9 files changed, 206 insertions(+), 100 deletions(-)



[nongnu] elpa/hyperdrive ad6c7b90ab 31/31: Add hyperdrive-forget-file command

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit ad6c7b90abf6748a8c47ea0d9db27233a55dd503
Merge: 0d04b9b2ea 2f1aebbe04
Author: Joseph Turner 
Commit: Joseph Turner 

Add hyperdrive-forget-file command
---
 CHANGELOG.org   |   2 +
 doc/hyperdrive.org  |  18 +++
 doc/hyperdrive.texi |  22 
 hyperdrive-diff.el  |   2 +
 hyperdrive-dir.el   |   1 +
 hyperdrive-lib.el   | 153 
 hyperdrive-menu.el  |   6 ++-
 hyperdrive-vars.el  |   2 +-
 hyperdrive.el   | 100 --
 9 files changed, 206 insertions(+), 100 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index aa026e75d1..b98a26a2ba 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -28,6 +28,8 @@ installation with ~M-x hyperdrive-install~, and a faster 
directory UI!
 - When visiting an old version of a hyperdrive file, press ~n~ and ~p~ to
   traverse the version history.  Press ~q~ to kill the current buffer.
 - View hyperdrive disk usage with ~hyperdrive-describe~ and ~hyperdrive-menu~.
+- Delete the local copy of a file or directory with
+  ~hyperdrive-forget-file~, also bound in ~hyperdrive-menu~ and menu bar.
 
 ** Changed
 
diff --git a/doc/hyperdrive.org b/doc/hyperdrive.org
index 260e172406..06419a74f3 100644
--- a/doc/hyperdrive.org
+++ b/doc/hyperdrive.org
@@ -267,6 +267,10 @@ available inside the directory view by default:
 
   Delete the file or directory (recursively) at point.
 
+- Key: F (hyperdrive-forget-file) ::
+
+  Delete your local copy of the file for the current buffer.
+
 - Key: H (hyperdrive-dir-history) ::
 
   Open the version history (see [[*View the hyperdrive version history]])
@@ -457,6 +461,20 @@ version of the hyperdrive (see [[*View the hyperdrive 
version history]]).*
 This command also has a keybinding in the directory view (see
 [[*Directory view]]).
 
+** Forget a hyperdrive file
+
+It is possible to "forget" your local copy of a hyperdrive file in
+order to save disk space.  "Forgetting" a file does not delete the
+file from the hyperdrive and does not increment the hyperdrive's
+version number.
+
+- Command: hyperdrive-forget-file ::
+
+  Delete your local copy of the file for the current buffer.
+
+This command also has a keybinding in the directory view (see
+[[*Directory view]]).
+
 ** View the hyperdrive version history
 
 Hyperdrives are versioned, meaning that you can explore the history of
diff --git a/doc/hyperdrive.texi b/doc/hyperdrive.texi
index ceba76ef70..4572a6e60b 100644
--- a/doc/hyperdrive.texi
+++ b/doc/hyperdrive.texi
@@ -84,6 +84,7 @@ Usage
 * Write to a hyperdrive::
 * Link to a hyperdrive::
 * Delete a hyperdrive file::
+* Forget a hyperdrive file::
 * View the hyperdrive version history::
 * Describe a hyperdrive::
 * Name a hyperdrive::
@@ -286,6 +287,7 @@ On the network it still may be there.
 * Write to a hyperdrive::
 * Link to a hyperdrive::
 * Delete a hyperdrive file::
+* Forget a hyperdrive file::
 * View the hyperdrive version history::
 * Describe a hyperdrive::
 * Name a hyperdrive::
@@ -502,6 +504,11 @@ Download the file at point to disk.
 @findex hyperdrive-delete
 Delete the file or directory (recursively) at point.
 
+@item @kbd{F} (@code{hyperdrive-forget-file})
+@kindex F
+@findex hyperdrive-forget-file
+Delete your local copy of the file for the current buffer.
+
 @item @kbd{H} (@code{hyperdrive-dir-history})
 @kindex H
 @findex hyperdrive-dir-history
@@ -728,6 +735,21 @@ Delete the hyperdrive file in the current buffer.
 This command also has a keybinding in the directory view (see
 @ref{Directory view}).
 
+@node Forget a hyperdrive file
+@section Forget a hyperdrive file
+
+It is possible to ``forget'' your local copy of a hyperdrive file in
+order to save disk space.  ``Forgetting'' a file does not delete the
+file from the hyperdrive and does not increment the hyperdrive's
+version number.
+
+@deffn Command hyperdrive-forget-file
+Delete your local copy of the file for the current buffer.
+@end deffn
+
+This command also has a keybinding in the directory view (see
+@ref{Directory view}).
+
 @node View the hyperdrive version history
 @section View the hyperdrive version history
 
diff --git a/hyperdrive-diff.el b/hyperdrive-diff.el
index 44caa5b1a7..9885d00aa5 100644
--- a/hyperdrive-diff.el
+++ b/hyperdrive-diff.el
@@ -106,10 +106,12 @@ This function is intended to diff files, not directories."
 (h/api 'get (he/url old-entry)
   :queue queue :as 'response :else #'ignore
   :then (lambda (response)
+  (h//fill old-entry (plz-response-headers response))
   (setf old-response response)))
 (h/api 'get (he/url new-entry)
   :queue queue :as 'response :else #'ignore
   :then (lambda (response)
+  (h//fill new-entry (plz-response-headers response))
   (setf new-response response)
 
  Mode
diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index ef3b0f3df9..b379422f6b 100644
--- a/hyperdrive-dir.el
+++ b/hyperdri

[nongnu] elpa/hyperdrive ab71379d58 06/31: Fix: (h/diff-file-entries) Fill disk-usage from GET request

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit ab71379d58a5e1fd49c938ee224a6e2c56335fbf
Author: Joseph Turner 
Commit: Joseph Turner 

Fix: (h/diff-file-entries) Fill disk-usage from GET request
---
 hyperdrive-diff.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hyperdrive-diff.el b/hyperdrive-diff.el
index 44caa5b1a7..9885d00aa5 100644
--- a/hyperdrive-diff.el
+++ b/hyperdrive-diff.el
@@ -106,10 +106,12 @@ This function is intended to diff files, not directories."
 (h/api 'get (he/url old-entry)
   :queue queue :as 'response :else #'ignore
   :then (lambda (response)
+  (h//fill old-entry (plz-response-headers response))
   (setf old-response response)))
 (h/api 'get (he/url new-entry)
   :queue queue :as 'response :else #'ignore
   :then (lambda (response)
+  (h//fill new-entry (plz-response-headers response))
   (setf new-response response)
 
  Mode



[nongnu] elpa/hyperdrive 316e5579fb 27/31: Change: (h/clear-cache) Prompt for confirmation and report success

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 316e5579fbb5ab04afece8d6bf5c0ba9a8ba1c95
Author: Joseph Turner 
Commit: Joseph Turner 

Change: (h/clear-cache) Prompt for confirmation and report success
---
 hyperdrive.el | 31 ++-
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/hyperdrive.el b/hyperdrive.el
index b8a8bc5194..1c4cccd746 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -186,20 +186,25 @@ Interactively, prompt for hyperdrive and action."
   "Clear local cache for file or directory ENTRY.
 Only clears the cache for the file or directory at ENTRY's
 version; other versions of the file or directory are not cleared."
-  ;; TODO: Considering support an :all-versions key for clearing the cache for
+  ;; TODO: Consider supporting an :all-versions key for clearing the cache for
   ;; all versions of the file/directory.
-  (interactive (list (hyperdrive--context-entry)))
-  (let ((url (he/url entry)))
-(h/api 'post url
-  :headers '(("Cache-Control" . "no-store"))
-  :as 'response
-  :else (lambda (err)
-  (h/error "Unable to clear cache for `%s': %S" url err))
-  :then (lambda (response)
-  (h//fill entry (plz-response-headers response))
-  ;; TODO: When file sizes in hyperdrive-dir-mode are colorized
-  ;; based locally downloaded sizes, refresh ewoc entry here.
-  
+  (interactive (list (h//context-entry)))
+  (when (yes-or-no-p
+ (format-message
+  "Clear local copy of entry (data will likely not be recoverable—see 
manual): `%s'? "
+  (h//format-entry entry)))
+(let ((url (he/url entry)))
+  (h/api 'post url
+:headers '(("Cache-Control" . "no-store"))
+:as 'response
+:else (lambda (err)
+(h/error "Unable to clear cache for `%s': %S" url err))
+:then (lambda (response)
+(h//fill entry (plz-response-headers response))
+(h/message "Cleared `%s'" (h//format-entry entry))
+;; TODO: When file sizes in hyperdrive-dir-mode are colorized
+;; based locally downloaded sizes, refresh ewoc entry here.
+)
 
 ;;;###autoload
 (defun hyperdrive-purge (hyperdrive)



[nongnu] elpa/hyperdrive 7862965b83 02/31: Meta: Update hyper-gateway-ushin to 3.9.0: Clear cache

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 7862965b83c84d7a09ea1f361cd4bdbe3538ba1c
Author: Joseph Turner 
Commit: Joseph Turner 

Meta: Update hyper-gateway-ushin to 3.9.0: Clear cache
---
 hyperdrive-vars.el |  2 +-
 hyperdrive.el  | 24 
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el
index 31bf171e53..1252b9f7e8 100644
--- a/hyperdrive-vars.el
+++ b/hyperdrive-vars.el
@@ -380,7 +380,7 @@ values are alists mapping version range starts to plists 
with
 ; Internals
 
 (defvar h/gateway-version-expected
-  '(:name "hyper-gateway-ushin" :version "3.8.0"))
+  '(:name "hyper-gateway-ushin" :version "3.9.0"))
 
 (defvar h/gateway-version-checked-p nil
   "Non-nil if the gateway's version has been checked.
diff --git a/hyperdrive.el b/hyperdrive.el
index 561c5947c9..e5f7f9eaba 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1357,20 +1357,20 @@ Intended for relative (i.e. non-full) URLs."
 
 (defvar h/gateway-urls-and-hashes
   '((gnu/linux
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.8.0/hyper-gateway-ushin-linux";
-   :sha256 
"8ff669bd378e88a3c80d65861f4088071852afaedf7bba56c88c1a162ed9e4f3")
- ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.8.0/hyper-gateway-linux-v3.8.0";
-   :sha256 ""))
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.0/hyper-gateway-ushin-linux";
+   :sha256 
"d024f8baf169a331adbd215b2d056811cbe1b3d90dbf60ebf0996b345b3d4375")
+ ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.0/hyper-gateway-linux-v3.9.0";
+   :sha256 
"331dbc0048decd42d197667f96aabdaf25306ba4e7ba0451dd9a2f31868fa86c"))
 (darwin
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.8.0/hyper-gateway-ushin-macos";
-   :sha256 
"22f6131f48d740f429690f16baac19b20a2211250360a89580db95415398d03c")
- ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.8.0/hyper-gateway-macos-v3.8.0";
-   :sha256 ""))
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.0/hyper-gateway-ushin-macos";
+   :sha256 
"5347ac71a04bb2a6cb0f9f956561de4c33fff59dac01287b3721a3687615cdb1")
+ ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.0/hyper-gateway-macos-v3.9.0";
+   :sha256 
"e78d3c1394774fc49212d86827eb615d46ae1a04c82fc0328ac31bbbdb201aa0"))
 (windows-nt
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.8.0/hyper-gateway-ushin-windows.exe";
-   :sha256 
"c347255d3fc5e6499fc10bea4d20e62798fb5968960dbbe26d507d11688326bb")
- ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.8.0/hyper-gateway-windows-v3.8.0.exe";
-   :sha256 "")))
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.0/hyper-gateway-ushin-windows.exe";
+   :sha256 
"52e1ad217a6cca972a434ab57646e84c0c3363c8909511f17906d0aa0aa5f2b6")
+ ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.0/hyper-gateway-windows-v3.9.0.exe";
+   :sha256 
"d4fa29aca473148e2d13215d042e4be40657080035caa2d3a699b741b6a45845")))
   "Alist mapping `system-type' to URLs where the gateway can be downloaded.")
 
 ;;;###autoload



[nongnu] elpa/hyperdrive 36fe73727c 03/31: Fix: (h/handler-default) Fill disk-usage from GET request

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 36fe73727cc2d1a08982eac6435de9419628bc9c
Author: Joseph Turner 
Commit: Joseph Turner 

Fix: (h/handler-default) Fill disk-usage from GET request

It's necessary to fill hyperdrive disk-usage after files have been
loaded from the network so that the disk usage reflects the newly
loaded data.
---
 hyperdrive-lib.el | 72 ---
 1 file changed, 37 insertions(+), 35 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index c325219fcf..56d78543a9 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1349,41 +1349,43 @@ Otherwise, return nil.  SLOT may be one of
 (cl-defun h/handler-default (entry &key then)
   "Load ENTRY's file into an Emacs buffer.
 If then, then call THEN with no arguments.  Default handler."
-  (h/api 'get (he/url entry)
-:noquery t
-:as (lambda ()
-  (pcase-let*
-  (((cl-struct hyperdrive-entry hyperdrive version etc) entry)
-   ((map target) etc)
-   (response-buffer (current-buffer)))
-(with-current-buffer (h//get-buffer-create entry)
-  ;; TODO: Don't reload if we're jumping to a link on the
-  ;; same page (but ensure that reverting still works).
-  (if (buffer-modified-p)
-  (h/message "Buffer modified: %S" (current-buffer))
-(save-excursion
-  (with-silent-modifications
-(erase-buffer)
-(insert-buffer-substring response-buffer))
-  (setf buffer-undo-list nil)
-  (setf buffer-read-only
-(or (not (h/writablep hyperdrive)) version))
-  (set-buffer-modified-p nil)
-  (set-visited-file-modtime (current-time
-  (when (map-elt (hyperdrive-etc hyperdrive) 'safep)
-(let ((buffer-file-name (he/name entry)))
-  (set-auto-mode)))
-  (when target
-(pcase major-mode
-  ('org-mode
-   (require 'hyperdrive-org)
-   (h/org--link-goto target))
-  ('markdown-mode
-   ;; TODO: Handle markdown link
-   )))
-  (h/blob-mode (if version +1 -1))
-  (when then
-(funcall then)))
+  (pcase-let*
+  (((cl-struct plz-response headers body)
+;; TODO: Handle errors
+;; TODO: When plz adds :as 'response-with-buffer, use that.
+(h/api 'get (he/url entry) :noquery t :as 'response))
+   ;; Filling entry is necessary in order to update hyperdrive disk-usage.
+   (_ (h//fill entry headers))
+   ((cl-struct hyperdrive-entry hyperdrive version etc) entry)
+   ((map target) etc))
+(with-current-buffer (h//get-buffer-create entry)
+  ;; TODO: Don't reload if we're jumping to a link on the
+  ;; same page (but ensure that reverting still works).
+  (if (buffer-modified-p)
+  (h/message "Buffer modified: %S" (current-buffer))
+(save-excursion
+  (with-silent-modifications
+(erase-buffer)
+(insert body))
+  (setf buffer-undo-list nil)
+  (setf buffer-read-only
+(or (not (h/writablep hyperdrive)) version))
+  (set-buffer-modified-p nil)
+  (set-visited-file-modtime (current-time
+  (when (map-elt (hyperdrive-etc hyperdrive) 'safep)
+(let ((buffer-file-name (he/name entry)))
+  (set-auto-mode)))
+  (when target
+(pcase major-mode
+  ('org-mode
+   (require 'hyperdrive-org)
+   (h/org--link-goto target))
+  ('markdown-mode
+   ;; TODO: Handle markdown link
+   )))
+  (h/blob-mode (if version +1 -1))
+  (when then
+(funcall then)
 
 (cl-defun h/handler-streamable (entry &key _then)
   ;; TODO: Is there any reason to not pass THEN through?



[nongnu] elpa/hyperdrive 750ea89b57 20/31: Comment: Add TODO

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 750ea89b57c1f3540a5da9085e63266d428cff9e
Author: Adam Porter 
Commit: Joseph Turner 

Comment: Add TODO
---
 hyperdrive.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hyperdrive.el b/hyperdrive.el
index 6ca6f24cef..76d9141880 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -466,6 +466,8 @@ in a directory.  Otherwise, or with universal prefix 
argument
   ;; plz.el will not overwrite existing files: ensure there's no file 
there.
   (delete-file filename))
 (h/api 'get url :as `(file ,filename))
+;; TODO: If plz adds support for getting response headers when downloading
+;; as a file, use it here.
 ;; Filling entry is necessary in order to update hyperdrive disk-usage.
 (h/fill (h/url-entry url
 



[nongnu] elpa/hyperdrive df4da23927 14/31: Change: (hyperdrive-new) Remove old workaround for fixed plz issue

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit df4da23927ee190892a0ca84a3669bd9b8f89d69
Author: Joseph Turner 
Commit: Joseph Turner 

Change: (hyperdrive-new) Remove old workaround for fixed plz issue
---
 hyperdrive.el | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/hyperdrive.el b/hyperdrive.el
index 2a1e0f4c50..1c28187dac 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -135,15 +135,10 @@ Return version if gateway is running; otherwise signal an 
error."
 If SEED is not currently used as the petname for another
 hyperdrive, the new hyperdrive's petname will be set to SEED."
   (interactive (list (h/read-name :prompt "New hyperdrive seed")))
-  (let* ((response (h/api 'post (concat "hyper://localhost/?key=" 
(url-hexify-string seed
- (url (progn
-;; NOTE: Working around issue in plz whereby the
-;; stderr process sentinel sometimes leaves "stderr
-;; finished" garbage in the response body in older
-;; Emacs versions.  See: 
.
-(string-match (rx bos (group "hyper://" (1+ nonl))) response)
-(match-string 1 response)))
- (hyperdrive (he/hyperdrive (h/url-entry url
+  (pcase-let* (((cl-struct plz-response (body url))
+(h/api 'post (concat "hyper://localhost/?key="
+ (url-hexify-string seed
+   (hyperdrive (he/hyperdrive (h/url-entry url
 (setf (h/seed hyperdrive) seed)
 (setf (h/writablep hyperdrive) t)
 (unwind-protect



[nongnu] elpa/hyperdrive e6cca3ccc9 19/31: Fix: (hyperdrive-new) :as 'response

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit e6cca3ccc90fff936e4f366f84578de52b3218c1
Author: Adam Porter 
Commit: Joseph Turner 

Fix: (hyperdrive-new) :as 'response
---
 hyperdrive.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hyperdrive.el b/hyperdrive.el
index 71017e669a..6ca6f24cef 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -137,7 +137,8 @@ hyperdrive, the new hyperdrive's petname will be set to 
SEED."
   (interactive (list (h/read-name :prompt "New hyperdrive seed")))
   (pcase-let* (((cl-struct plz-response (body url))
 (h/api 'post (concat "hyper://localhost/?key="
- (url-hexify-string seed
+ (url-hexify-string seed))
+   :as 'response))
(hyperdrive (he/hyperdrive (h/url-entry url
 (setf (h/seed hyperdrive) seed)
 (setf (h/writablep hyperdrive) t)



[nongnu] elpa/hyperdrive 2f1aebbe04 30/31: Docs: (hyperdrive-forget-file) Document command

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 2f1aebbe04bab2c00a83ad95a52ba31ddd56fd35
Author: Joseph Turner 
Commit: Joseph Turner 

Docs: (hyperdrive-forget-file) Document command
---
 doc/hyperdrive.org  | 18 ++
 doc/hyperdrive.texi | 22 ++
 2 files changed, 40 insertions(+)

diff --git a/doc/hyperdrive.org b/doc/hyperdrive.org
index 260e172406..06419a74f3 100644
--- a/doc/hyperdrive.org
+++ b/doc/hyperdrive.org
@@ -267,6 +267,10 @@ available inside the directory view by default:
 
   Delete the file or directory (recursively) at point.
 
+- Key: F (hyperdrive-forget-file) ::
+
+  Delete your local copy of the file for the current buffer.
+
 - Key: H (hyperdrive-dir-history) ::
 
   Open the version history (see [[*View the hyperdrive version history]])
@@ -457,6 +461,20 @@ version of the hyperdrive (see [[*View the hyperdrive 
version history]]).*
 This command also has a keybinding in the directory view (see
 [[*Directory view]]).
 
+** Forget a hyperdrive file
+
+It is possible to "forget" your local copy of a hyperdrive file in
+order to save disk space.  "Forgetting" a file does not delete the
+file from the hyperdrive and does not increment the hyperdrive's
+version number.
+
+- Command: hyperdrive-forget-file ::
+
+  Delete your local copy of the file for the current buffer.
+
+This command also has a keybinding in the directory view (see
+[[*Directory view]]).
+
 ** View the hyperdrive version history
 
 Hyperdrives are versioned, meaning that you can explore the history of
diff --git a/doc/hyperdrive.texi b/doc/hyperdrive.texi
index ceba76ef70..4572a6e60b 100644
--- a/doc/hyperdrive.texi
+++ b/doc/hyperdrive.texi
@@ -84,6 +84,7 @@ Usage
 * Write to a hyperdrive::
 * Link to a hyperdrive::
 * Delete a hyperdrive file::
+* Forget a hyperdrive file::
 * View the hyperdrive version history::
 * Describe a hyperdrive::
 * Name a hyperdrive::
@@ -286,6 +287,7 @@ On the network it still may be there.
 * Write to a hyperdrive::
 * Link to a hyperdrive::
 * Delete a hyperdrive file::
+* Forget a hyperdrive file::
 * View the hyperdrive version history::
 * Describe a hyperdrive::
 * Name a hyperdrive::
@@ -502,6 +504,11 @@ Download the file at point to disk.
 @findex hyperdrive-delete
 Delete the file or directory (recursively) at point.
 
+@item @kbd{F} (@code{hyperdrive-forget-file})
+@kindex F
+@findex hyperdrive-forget-file
+Delete your local copy of the file for the current buffer.
+
 @item @kbd{H} (@code{hyperdrive-dir-history})
 @kindex H
 @findex hyperdrive-dir-history
@@ -728,6 +735,21 @@ Delete the hyperdrive file in the current buffer.
 This command also has a keybinding in the directory view (see
 @ref{Directory view}).
 
+@node Forget a hyperdrive file
+@section Forget a hyperdrive file
+
+It is possible to ``forget'' your local copy of a hyperdrive file in
+order to save disk space.  ``Forgetting'' a file does not delete the
+file from the hyperdrive and does not increment the hyperdrive's
+version number.
+
+@deffn Command hyperdrive-forget-file
+Delete your local copy of the file for the current buffer.
+@end deffn
+
+This command also has a keybinding in the directory view (see
+@ref{Directory view}).
+
 @node View the hyperdrive version history
 @section View the hyperdrive version history
 



[nongnu] elpa/hyperdrive dd3670e43e 17/31: Comment: Add TODO

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit dd3670e43e438fb6b8471b8f6de1340eb7f9fd2d
Author: Joseph Turner 
Commit: Joseph Turner 

Comment: Add TODO
---
 hyperdrive.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hyperdrive.el b/hyperdrive.el
index 891a9c2a4c..87aef7f4b7 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -775,6 +775,8 @@ Universal prefix argument \\[universal-argument] forces
 
 (require 'url)
 
+;; TODO: EWW buffers end up being marked as modified, and Emacs prompts to save
+;; them before exiting.  Emacs should not prompt to save *eww* buffers.
 (defun h/url-loader (parsed-url)
   "Retrieve URL synchronously.
 PARSED-URL must be a URL-struct like the output of



[nongnu] elpa/hyperdrive d4d3d92e17 07/31: Refactor: (h/fill-metadata) Don't use :as

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit d4d3d92e17d288e5ff62b53f7843378797f2ee9f
Author: Joseph Turner 
Commit: Joseph Turner 

Refactor: (h/fill-metadata) Don't use :as

This allows us to access the response headers.
---
 hyperdrive-lib.el | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 7a0704b1fc..20c2a85046 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -967,14 +967,17 @@ HYPERDRIVE's public metadata file."
;; NOTE: Don't attempt to fill hyperdrive struct with old 
metadata
:version nil))
(metadata (condition-case err
- (h/api 'get (he/url entry)
-   :as (lambda ()
- (condition-case nil
- (json-read)
-   (json-error
-(h/message "Error parsing JSON metadata file: 
%s"
-   (he/url entry)
-   :noquery t)
+ ;; TODO: Refactor to use :as 'response-with-buffer and 
call h/fill
+ (pcase-let
+ (((cl-struct plz-response headers body)
+   (h/api 'get (he/url entry) :as 'response :noquery 
t)))
+   (with-temp-buffer
+ (insert body)
+ (goto-char (point-min))
+ (json-read)))
+   (json-error
+(h/message "Error parsing JSON metadata file: %s"
+   (he/url entry)))
(plz-error
 (pcase (plz-response-status (plz-error-response (caddr 
err)))
   ;; FIXME: If plz-error is a curl-error, this block will 
fail.



[nongnu] elpa/hyperdrive 035b3bc5ac 29/31: Change: (h/forget-file) Rename from h/clear-cache

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 035b3bc5ac98306afb8f21d86b609d38dcb1
Author: Joseph Turner 
Commit: Joseph Turner 

Change: (h/forget-file) Rename from h/clear-cache
---
 CHANGELOG.org  |  4 ++--
 hyperdrive-dir.el  |  2 +-
 hyperdrive-menu.el |  2 +-
 hyperdrive.el  | 19 +++
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index 9783d8beb5..b98a26a2ba 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -28,8 +28,8 @@ installation with ~M-x hyperdrive-install~, and a faster 
directory UI!
 - When visiting an old version of a hyperdrive file, press ~n~ and ~p~ to
   traverse the version history.  Press ~q~ to kill the current buffer.
 - View hyperdrive disk usage with ~hyperdrive-describe~ and ~hyperdrive-menu~.
-- Clear local copy of a file or directory with ~hyperdrive-clear-cache~,
-  also bound in ~hyperdrive-menu~ and menu bar.
+- Delete the local copy of a file or directory with
+  ~hyperdrive-forget-file~, also bound in ~hyperdrive-menu~ and menu bar.
 
 ** Changed
 
diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index 93483bfaa3..b379422f6b 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -217,7 +217,7 @@ With point on header, returns directory entry."
   "d"   #'h/download
   "^"   #'h/up
   "D"   #'h/delete
-  "C"   #'h/clear-cache
+  "F"   #'h/forget-file
   "H"   #'h/dir-history
   "s"   #'h/dir-sort
   "?"   #'h/menu
diff --git a/hyperdrive-menu.el b/hyperdrive-menu.el
index c0ecb4b506..7a7164f95b 100644
--- a/hyperdrive-menu.el
+++ b/hyperdrive-menu.el
@@ -167,7 +167,7 @@
(or version (not (h/writablep hyperdrive))
 ("d" "Download" h/download
  :if-not-mode h/dir-mode)
-("C" "Clear cache" h/clear-cache
+("F" "Forget file" h/forget-file
  :transient t)]
;; TODO: Consider adding a defcustom to hide the "Selected" and
;; "Current" groups when in a directory buffer.
diff --git a/hyperdrive.el b/hyperdrive.el
index 6253257ed5..65213e96e8 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -182,16 +182,19 @@ Interactively, prompt for hyperdrive and action."
 (propertize "safe" 'face 'success)
   (propertize "unsafe" 'face 'error))
 
-(defun h/clear-cache (entry)
-  "Clear local cache for file or directory ENTRY.
-Only clears the cache for the file or directory at ENTRY's
-version; other versions of the file or directory are not cleared."
+(defun h/forget-file (entry)
+  "Delete local copy of the file or directory contents of ENTRY.
+Only delete the blob(s) for the file or directory at ENTRY's
+version; other versions of the file or directory are not cleared.
+If ENTRY is a directory, recursively delete blobs for all files
+within the directory.  Hyperdrive directory contents are not
+modified; file blobs may be recoverable from other peers."
   ;; TODO: Consider supporting an :all-versions key for clearing the cache for
   ;; all versions of the file/directory.
   (interactive (list (h//context-entry)))
   (when (yes-or-no-p
  (format-message
-  "Clear local copy of entry (data will likely not be recoverable—see 
manual): `%s'? "
+  "Clear local copy of entry (data may not be recoverable—see 
manual):`%s'?  "
   (h//format-entry entry)))
 (let ((url (he/url entry)))
   (h/api 'post url
@@ -1239,10 +1242,10 @@ The return value of this function is the retrieval 
buffer."
   (not (string= ".."  (alist-get 'display-name
  (he/etc selected-entry))
:help "Delete file/directory at point"]
-  ["Clear Cache" (lambda ()
+  ["Forget file" (lambda ()
(interactive)
-   (call-interactively #'h/clear-cache))
-   :help "Clear local cache for file/directory at point"]
+   (call-interactively #'h/forget-file))
+   :help "Delete local copy of file/directory contents at point"]
   )
  ("Version"
   :label (let* ((version (he/version h/current-entry))



[nongnu] elpa/hyperdrive d8e96321d2 08/31: Fix: (h/fill-metadata) Fill disk-usage from GET request

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit d8e96321d290c0969fd797ab6aae5a8c7b43708a
Author: Joseph Turner 
Commit: Joseph Turner 

Fix: (h/fill-metadata) Fill disk-usage from GET request
---
 hyperdrive-lib.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 20c2a85046..68096f73ec 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -971,6 +971,7 @@ HYPERDRIVE's public metadata file."
  (pcase-let
  (((cl-struct plz-response headers body)
(h/api 'get (he/url entry) :as 'response :noquery 
t)))
+   (h//fill entry headers)
(with-temp-buffer
  (insert body)
  (goto-char (point-min))



[nongnu] elpa/hyperdrive 5a4f6b9607 09/31: Fix: (h/download-url) Fill disk-usage from GET request

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 5a4f6b9607c5cbec31c263d13dae386a55e1939e
Author: Joseph Turner 
Commit: Joseph Turner 

Fix: (h/download-url) Fill disk-usage from GET request
---
 hyperdrive.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hyperdrive.el b/hyperdrive.el
index 6be4b6f32b..f596558fed 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -449,7 +449,9 @@ in a directory.  Otherwise, or with universal prefix 
argument
 (when (file-exists-p filename)
   ;; plz.el will not overwrite existing files: ensure there's no file 
there.
   (delete-file filename))
-(h/api 'get url :as `(file ,filename
+(h/api 'get url :as `(file ,filename))
+;; Filling entry is necessary in order to update hyperdrive disk-usage.
+(h/fill (h/url-entry url) :then 'sync)))
 
 ;;;###autoload
 (defun hyperdrive-write-buffer (entry &optional overwritep)



[nongnu] elpa/hyperdrive a20c4b9410 21/31: Tidy: (hyperdrive-menu) Capitalization

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit a20c4b9410c0e021d793f6331085d6d2992fcd01
Author: Joseph Turner 
Commit: Joseph Turner 

Tidy: (hyperdrive-menu) Capitalization
---
 hyperdrive-menu.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hyperdrive-menu.el b/hyperdrive-menu.el
index adefba958c..55b6a6bfd6 100644
--- a/hyperdrive-menu.el
+++ b/hyperdrive-menu.el
@@ -71,7 +71,7 @@
 "Hyperdrive"))
 ("h" "Hyperdrive" h/menu-hyperdrive)
 ("N" "New drive" h/new)
-("L" "Open Link" h/open-url)]
+("L" "Open link" h/open-url)]
["Version"
 :if (lambda ()
   (and (h/menu--scope)



[nongnu] elpa/hyperdrive 965b39f5d9 24/31: Change: (h/menu-bar-menu) Add binding for h/clear-cache

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 965b39f5d9e5c9e56ffbaa51210bea751b18a352
Author: Joseph Turner 
Commit: Joseph Turner 

Change: (h/menu-bar-menu) Add binding for h/clear-cache
---
 hyperdrive.el | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hyperdrive.el b/hyperdrive.el
index b401e54da7..b8a8bc5194 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1233,7 +1233,12 @@ The return value of this function is the retrieval 
buffer."
   ;; TODO: Add `hyperdrive--parent-entry-p'
   (not (string= ".."  (alist-get 'display-name
  (he/etc selected-entry))
-   :help "Delete file/directory at point"])
+   :help "Delete file/directory at point"]
+  ["Clear Cache" (lambda ()
+   (interactive)
+   (call-interactively #'h/clear-cache))
+   :help "Clear local cache for file/directory at point"]
+  )
  ("Version"
   :label (let* ((version (he/version h/current-entry))
 (existsp (he/exists-p h/current-entry))



[nongnu] elpa/hyperdrive 0bb8d21108 26/31: Change: (h/dir-mode-map) Add binding for h/clear-cache

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 0bb8d21108316e20e50a61169719f2e5465449ba
Author: Joseph Turner 
Commit: Joseph Turner 

Change: (h/dir-mode-map) Add binding for h/clear-cache
---
 hyperdrive-dir.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index ef3b0f3df9..93483bfaa3 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -217,6 +217,7 @@ With point on header, returns directory entry."
   "d"   #'h/download
   "^"   #'h/up
   "D"   #'h/delete
+  "C"   #'h/clear-cache
   "H"   #'h/dir-history
   "s"   #'h/dir-sort
   "?"   #'h/menu



[nongnu] elpa/hyperdrive 81c4b90895 10/31: Tidy: (h/fill) Set then to 'sync by default

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 81c4b9089561f2b504143b8ea262a268674a376c
Author: Joseph Turner 
Commit: Joseph Turner 

Tidy: (h/fill) Set then to 'sync by default
---
 hyperdrive-lib.el | 4 ++--
 hyperdrive.el | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 68096f73ec..9bb6d2cb51 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -466,7 +466,7 @@ When VERSION is nil, return latest version of ENTRY."
 (setf (he/version entry) version)
 (condition-case err
 ;; FIXME: Requests to out of range version currently hang.
-(h/fill entry :then 'sync)
+(h/fill entry)
   (plz-error
(pcase (plz-response-status (plz-error-response (caddr err)))
  ;; FIXME: If plz-error is a curl-error, this block will fail.
@@ -620,7 +620,7 @@ echo area when the request for the file is made."
 (when messagep
   (h/message "Opening <%s>..." (he/url entry)
 
-(cl-defun h/fill (entry &key queue then else)
+(cl-defun h/fill (entry &key queue (then 'sync) else)
   "Fill ENTRY's metadata and call THEN.
 If THEN is `sync', return the filled entry and ignore ELSE.
 Otherwise, make request asynchronously and call THEN with the
diff --git a/hyperdrive.el b/hyperdrive.el
index f596558fed..2a1e0f4c50 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -451,7 +451,7 @@ in a directory.  Otherwise, or with universal prefix 
argument
   (delete-file filename))
 (h/api 'get url :as `(file ,filename))
 ;; Filling entry is necessary in order to update hyperdrive disk-usage.
-(h/fill (h/url-entry url) :then 'sync)))
+(h/fill (h/url-entry url
 
 ;;;###autoload
 (defun hyperdrive-write-buffer (entry &optional overwritep)



[nongnu] elpa/hyperdrive 1db1a4f54a 12/31: Comment: Update TODO

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 1db1a4f54ac460a3bca575a71aad9f4ca85091e5
Author: Joseph Turner 
Commit: Joseph Turner 

Comment: Update TODO
---
 hyperdrive-lib.el | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 6f5b70c361..281e1e1e84 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -166,11 +166,13 @@ REST may include the argument `:queue', a `plz-queue' in 
which to
 make the request."
   ;; TODO: Document that the request/queue is returned.
   ;; TODO: Should we create a wrapper for `h/api' which calls
-  ;;  `h//fill-latest-version' for requests to
-  ;;  directories/requests which modify the drive (and therefore
-  ;;  always return the latest version number). If we did this, we
-  ;;  could remove redundant calls to
-  ;;  `h//fill-latest-version' everywhere else.
+  ;; `h//fill-latest-version' for requests to directories/requests which modify
+  ;; the drive (and therefore always return the latest version number).  If we
+  ;; did this, we could remove redundant calls to `h//fill-latest-version'
+  ;; everywhere else.  X-Drive-Size is returned by many types of requests, and 
it
+  ;; would simplify the code to handle updating the hyperdrive disk-usage in 
one
+  ;; place.  Once implemented, go through each call to `h/api' to verify that
+  ;; disk-usage is updated correctly.
   (declare (indent defun))
   (pcase method
 ((and (or 'get 'head)



[nongnu] elpa/hyperdrive 0db40da6f9 28/31: Meta: Update hyper-gateway-ushin to 3.9.2: Clear old versions

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 0db40da6f93f45070c1c937e7eb6bf4831f03ecd
Author: Joseph Turner 
Commit: Joseph Turner 

Meta: Update hyper-gateway-ushin to 3.9.2: Clear old versions

Now it's possible to clear cached blobs for files at an old version of
a hyperdrive.  Also, instead of sending a DELETE request to clear the
cache, send a POST request.
---
 hyperdrive-vars.el |  2 +-
 hyperdrive.el  | 18 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el
index 5422f32c99..2c9c26ebef 100644
--- a/hyperdrive-vars.el
+++ b/hyperdrive-vars.el
@@ -380,7 +380,7 @@ values are alists mapping version range starts to plists 
with
 ; Internals
 
 (defvar h/gateway-version-expected
-  '(:name "hyper-gateway-ushin" :version "3.9.1"))
+  '(:name "hyper-gateway-ushin" :version "3.9.2"))
 
 (defvar h/gateway-version-checked-p nil
   "Non-nil if the gateway's version has been checked.
diff --git a/hyperdrive.el b/hyperdrive.el
index 1c4cccd746..6253257ed5 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1397,21 +1397,21 @@ Intended for relative (i.e. non-full) URLs."
   ;; TODO: sr.ht build ()
   ;; fail due to a kernel issue: https://github.com/nodejs/node/issues/53051
   '((gnu/linux
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.1/hyper-gateway-ushin-linux";
-   :sha256 
"972d593f1d73cece0c2758c7e41f4eb4792e590df2b5b67ba1ad39fa55320d92")
- ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.1/hyper-gateway-linux-v3.9.1";
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.2/hyper-gateway-ushin-linux";
+   :sha256 
"f0cb3e793b3d27ce159e8e034e03b5a14cbdc53d47bd8f0761310792d5b6a7aa")
+ ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.2/hyper-gateway-linux-v3.9.2";
  ;;   :sha256 
"331dbc0048decd42d197667f96aabdaf25306ba4e7ba0451dd9a2f31868fa86c")
  )
 (darwin
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.1/hyper-gateway-ushin-macos";
-   :sha256 
"b49af09dfa89aebbb07d6255f594917ea051473ec983eb89171581b4e5c908a3")
- ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.1/hyper-gateway-macos-v3.9.1";
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.2/hyper-gateway-ushin-macos";
+   :sha256 
"bb472bf7a536eb30bc2443ce90cfca1bf2aa71177afdc1377f4fc9b61414c24c")
+ ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.2/hyper-gateway-macos-v3.9.2";
  ;;   :sha256 
"e78d3c1394774fc49212d86827eb615d46ae1a04c82fc0328ac31bbbdb201aa0")
  )
 (windows-nt
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.1/hyper-gateway-ushin-windows.exe";
-   :sha256 
"4a9420fa4d47f52cd2155ee745d697bdd3ad65b32c535ccd1368aa19d5853694")
- ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.1/hyper-gateway-windows-v3.9.1.exe";
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.2/hyper-gateway-ushin-windows.exe";
+   :sha256 
"7a72010cd7bc1b0357673838f5ccb069e58bf3c229bc873bedd0ee9faa805188")
+ ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.2/hyper-gateway-windows-v3.9.2.exe";
  ;;   :sha256 
"d4fa29aca473148e2d13215d042e4be40657080035caa2d3a699b741b6a45845")
  ))
   "Alist mapping `system-type' to URLs where the gateway can be downloaded.")



[nongnu] elpa/hyperdrive dcbb6c2e15 16/31: Meta: Update hyper-gateway-ushin to 3.9.1: More X-Drive-Size headers

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit dcbb6c2e15ff37f7c3d7298fef6896d57180d6a3
Author: Joseph Turner 
Commit: Joseph Turner 

Meta: Update hyper-gateway-ushin to 3.9.1: More X-Drive-Size headers

Now, GET and POST requests with a seed, which get the associated
public key and create a new drive, respectively, now also return the
X-Drive-Size header.  This allows us to display the size of an empty
drive to the user.
---
 hyperdrive-vars.el |  2 +-
 hyperdrive.el  | 29 +
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el
index 1252b9f7e8..5422f32c99 100644
--- a/hyperdrive-vars.el
+++ b/hyperdrive-vars.el
@@ -380,7 +380,7 @@ values are alists mapping version range starts to plists 
with
 ; Internals
 
 (defvar h/gateway-version-expected
-  '(:name "hyper-gateway-ushin" :version "3.9.0"))
+  '(:name "hyper-gateway-ushin" :version "3.9.1"))
 
 (defvar h/gateway-version-checked-p nil
   "Non-nil if the gateway's version has been checked.
diff --git a/hyperdrive.el b/hyperdrive.el
index a0e8fef2de..891a9c2a4c 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1360,21 +1360,26 @@ Intended for relative (i.e. non-full) URLs."
 ; Installation
 
 (defvar h/gateway-urls-and-hashes
+  ;; TODO: sr.ht build ()
+  ;; fail due to a kernel issue: https://github.com/nodejs/node/issues/53051
   '((gnu/linux
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.0/hyper-gateway-ushin-linux";
-   :sha256 
"d024f8baf169a331adbd215b2d056811cbe1b3d90dbf60ebf0996b345b3d4375")
- ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.0/hyper-gateway-linux-v3.9.0";
-   :sha256 
"331dbc0048decd42d197667f96aabdaf25306ba4e7ba0451dd9a2f31868fa86c"))
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.1/hyper-gateway-ushin-linux";
+   :sha256 
"972d593f1d73cece0c2758c7e41f4eb4792e590df2b5b67ba1ad39fa55320d92")
+ ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.1/hyper-gateway-linux-v3.9.1";
+ ;;   :sha256 
"331dbc0048decd42d197667f96aabdaf25306ba4e7ba0451dd9a2f31868fa86c")
+ )
 (darwin
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.0/hyper-gateway-ushin-macos";
-   :sha256 
"5347ac71a04bb2a6cb0f9f956561de4c33fff59dac01287b3721a3687615cdb1")
- ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.0/hyper-gateway-macos-v3.9.0";
-   :sha256 
"e78d3c1394774fc49212d86827eb615d46ae1a04c82fc0328ac31bbbdb201aa0"))
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.1/hyper-gateway-ushin-macos";
+   :sha256 
"b49af09dfa89aebbb07d6255f594917ea051473ec983eb89171581b4e5c908a3")
+ ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.1/hyper-gateway-macos-v3.9.1";
+ ;;   :sha256 
"e78d3c1394774fc49212d86827eb615d46ae1a04c82fc0328ac31bbbdb201aa0")
+ )
 (windows-nt
- ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.0/hyper-gateway-ushin-windows.exe";
-   :sha256 
"52e1ad217a6cca972a434ab57646e84c0c3363c8909511f17906d0aa0aa5f2b6")
- ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.0/hyper-gateway-windows-v3.9.0.exe";
-   :sha256 
"d4fa29aca473148e2d13215d042e4be40657080035caa2d3a699b741b6a45845")))
+ ( :url 
"https://codeberg.org/USHIN/hyper-gateway-ushin/releases/download/v3.9.1/hyper-gateway-ushin-windows.exe";
+   :sha256 
"4a9420fa4d47f52cd2155ee745d697bdd3ad65b32c535ccd1368aa19d5853694")
+ ;; ( :url 
"https://git.sr.ht/~ushin/hyper-gateway-ushin/refs/download/v3.9.1/hyper-gateway-windows-v3.9.1.exe";
+ ;;   :sha256 
"d4fa29aca473148e2d13215d042e4be40657080035caa2d3a699b741b6a45845")
+ ))
   "Alist mapping `system-type' to URLs where the gateway can be downloaded.")
 
 ;;;###autoload



[nongnu] elpa/hyperdrive 857edd0a9b 04/31: Comment: (h/handler-streamable) Note limitation regarding disk-usage

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 857edd0a9ba94c3c19252f980bd2db3f8b638424
Author: Joseph Turner 
Commit: Joseph Turner 

Comment: (h/handler-streamable) Note limitation regarding disk-usage
---
 hyperdrive-lib.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 56d78543a9..7a0704b1fc 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1390,8 +1390,10 @@ If then, then call THEN with no arguments.  Default 
handler."
 (cl-defun h/handler-streamable (entry &key _then)
   ;; TODO: Is there any reason to not pass THEN through?
   "Stream ENTRY."
-  (h/message "Streaming %s..." (h//format-entry-url entry))
-  (pcase-let ((`(,command . ,args) (split-string h/stream-player-command)))
+  ;; NOTE: Since data is streamed to an external process, disk usage will not 
be
+  ;; updated until a later request.
+  (h/message "Streaming %s..."  (h//format-entry-url entry))
+  (pcase-let ((`(,command .  ,args) (split-string h/stream-player-command)))
 (apply #'start-process "hyperdrive-stream-player"
nil command (cl-substitute (h//httpify-url
(he/url entry))



[nongnu] elpa/hyperdrive e2685023a7 18/31: Add: (h/clear-cache) Clear local cache for file or directory

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit e2685023a7598962c94882c8ca1035de7d4c69c8
Author: Joseph Turner 
Commit: Joseph Turner 

Add: (h/clear-cache) Clear local cache for file or directory
---
 hyperdrive.el | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/hyperdrive.el b/hyperdrive.el
index 87aef7f4b7..71017e669a 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -181,6 +181,25 @@ Interactively, prompt for hyperdrive and action."
 (propertize "safe" 'face 'success)
   (propertize "unsafe" 'face 'error))
 
+(defun h/clear-cache (entry)
+  "Clear local cache for file or directory ENTRY.
+Only clears the cache for the file or directory at ENTRY's
+version; other versions of the file or directory are not cleared."
+  ;; TODO: Considering support an :all-versions key for clearing the cache for
+  ;; all versions of the file/directory.
+  (interactive (list (hyperdrive--context-entry)))
+  (let ((url (he/url entry)))
+(h/api 'delete url
+  :headers '(("Cache-Control" . "no-store"))
+  :as 'response
+  :else (lambda (err)
+  (h/error "Unable to clear cache for `%s': %S" url err))
+  :then (lambda (response)
+  (h//fill entry (plz-response-headers response))
+  ;; TODO: When file sizes in hyperdrive-dir-mode are colorized
+  ;; based locally downloaded sizes, refresh ewoc entry here.
+  
+
 ;;;###autoload
 (defun hyperdrive-purge (hyperdrive)
   "Purge all data corresponding to HYPERDRIVE."



[nongnu] elpa/hyperdrive 019c9f3c6a 13/31: Fix: (h//fill) Only fill version range when Etag is non-nil

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 019c9f3c6a041e63b5b14fe87d45093358f9e406
Author: Joseph Turner 
Commit: Joseph Turner 

Fix: (h//fill) Only fill version range when Etag is non-nil
---
 hyperdrive-lib.el | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 281e1e1e84..c2ff1f70d2 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -725,17 +725,17 @@ Returns filled ENTRY."
 ;; but no public-key.
 (cl-pushnew domain (h/domains (he/hyperdrive entry)) :test 
#'equal)))
   (setf (h/public-key hyperdrive) public-key))
-(if (and (h//entry-directory-p entry)
- (null (he/version entry)))
-;; Version-less directory HEAD/GET request ETag header always have the
-;; hyperdrive's latest version. We don't currently store
-;; version ranges for directories (since they don't
-;; technically have versions in hyperdrive).
-(h//fill-latest-version hyperdrive headers)
-  ;; File HEAD/GET request ETag header does not retrieve the
-  ;; hyperdrive's latest version, so `h/update-existent-version-range'
-  ;; will not necessarily fill in the entry's last range.
-  (when etag
+(when etag
+  (if (and (h//entry-directory-p entry)
+   (null (he/version entry)))
+  ;; Version-less directory HEAD/GET request ETag header always have 
the
+  ;; hyperdrive's latest version. We don't currently store
+  ;; version ranges for directories (since they don't
+  ;; technically have versions in hyperdrive).
+  (h//fill-latest-version hyperdrive headers)
+;; File HEAD/GET request ETag header does not retrieve the
+;; hyperdrive's latest version, so `h/update-existent-version-range'
+;; will not necessarily fill in the entry's last range.
 (h/update-existent-version-range entry (string-to-number etag
 entry))
 



[nongnu] elpa/hyperdrive 499a591d4b 22/31: Change: (h/clear-cache) Use POST instead of DELETE to clear cache

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 499a591d4b1862fe2636d985b1c4fde66ea0245e
Author: Joseph Turner 
Commit: Joseph Turner 

Change: (h/clear-cache) Use POST instead of DELETE to clear cache

hyper-gateway-ushin v3.9.2 uses POST instead of DELETE.
---
 hyperdrive.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hyperdrive.el b/hyperdrive.el
index 76d9141880..b401e54da7 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -190,7 +190,7 @@ version; other versions of the file or directory are not 
cleared."
   ;; all versions of the file/directory.
   (interactive (list (hyperdrive--context-entry)))
   (let ((url (he/url entry)))
-(h/api 'delete url
+(h/api 'post url
   :headers '(("Cache-Control" . "no-store"))
   :as 'response
   :else (lambda (err)



[nongnu] elpa/hyperdrive ad488cd057 05/31: Fix: (h/url-loader) Fill disk-usage from GET request

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit ad488cd057b9e306251dd9cefc8f091b01754fe3
Author: Joseph Turner 
Commit: Joseph Turner 

Fix: (h/url-loader) Fill disk-usage from GET request
---
 hyperdrive.el | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/hyperdrive.el b/hyperdrive.el
index e5f7f9eaba..6be4b6f32b 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -783,12 +783,17 @@ PARSED-URL must be a URL-struct like the output of
 
 The return value of this function is the retrieval buffer."
   (cl-check-type parsed-url url "Need a pre-parsed URL.")
-  (let* ((url (url-recreate-url parsed-url))
- ;; response-buffer will contain the loaded HTML, and will be deleted 
at the end of `eww-render'.
- (response-buffer (h/api 'get url :as 'buffer)))
-(with-current-buffer response-buffer
+  (pcase-let* ((url (url-recreate-url parsed-url))
+   ;; TODO: When `plz.el' adds :as 'response-with-buffer, use that.
+   ;; response-buffer will contain the loaded HTML, and will be 
deleted at the end of `eww-render'.
+   ((cl-struct plz-response headers body)
+(h/api 'get url :as 'response)))
+;; Filling entry is necessary in order to update hyperdrive disk-usage.
+(h//fill (h/url-entry url) headers)
+(with-current-buffer (generate-new-buffer " *hyperdrive-eww*")
   (widen)
   (goto-char (point-min))
+  (insert body)
   (while (search-forward (string ?\C-m) nil t)
 ;; Strip CRLF from headers so that `eww-parse-headers' works correctly.
 ;; MAYBE: As an alternative, look at buffer coding systems to



[nongnu] elpa/hyperdrive 24f4c589cc 15/31: Comment: Add TODOs

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 24f4c589cc70cdee688e17ddd7209d324bcfe7e6
Author: Joseph Turner 
Commit: Joseph Turner 

Comment: Add TODOs
---
 hyperdrive.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hyperdrive.el b/hyperdrive.el
index 1c28187dac..a0e8fef2de 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -143,6 +143,7 @@ hyperdrive, the new hyperdrive's petname will be set to 
SEED."
 (setf (h/writablep hyperdrive) t)
 (unwind-protect
 (h/set-petname seed hyperdrive)
+  ;; TODO: Hyperdrive disk usage should be set here.
   (h/persist hyperdrive)
   (h/open (h/url-entry url)
 
@@ -693,6 +694,7 @@ After successful upload, call THEN.  When QUEUE, use it."
   :body `(file ,filename)
   :headers `(("Last-Modified" . ,last-modified))
   :then then)
+;; TODO: Hyperdrive disk usage should be set here.
 (unless queue
   (h/message "Uploading to \"%s\"..." url
 



[nongnu] elpa/hyperdrive a857869c48 23/31: Change: (h/menu) Add binding for h/clear-cache

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit a857869c486bd74e11d85e7ae047d713d9b8c56d
Author: Joseph Turner 
Commit: Joseph Turner 

Change: (h/menu) Add binding for h/clear-cache
---
 hyperdrive-menu.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hyperdrive-menu.el b/hyperdrive-menu.el
index 55b6a6bfd6..c0ecb4b506 100644
--- a/hyperdrive-menu.el
+++ b/hyperdrive-menu.el
@@ -166,7 +166,9 @@
   (h/menu--scope)))
(or version (not (h/writablep hyperdrive))
 ("d" "Download" h/download
- :if-not-mode h/dir-mode)]
+ :if-not-mode h/dir-mode)
+("C" "Clear cache" h/clear-cache
+ :transient t)]
;; TODO: Consider adding a defcustom to hide the "Selected" and
;; "Current" groups when in a directory buffer.
[;; Selected



[nongnu] elpa/hyperdrive 2446113d98 25/31: Meta: Update changelog

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 2446113d989bf6b9daf34a8e16e7a4cf92023851
Author: Joseph Turner 
Commit: Joseph Turner 

Meta: Update changelog
---
 CHANGELOG.org | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index aa026e75d1..9783d8beb5 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -28,6 +28,8 @@ installation with ~M-x hyperdrive-install~, and a faster 
directory UI!
 - When visiting an old version of a hyperdrive file, press ~n~ and ~p~ to
   traverse the version history.  Press ~q~ to kill the current buffer.
 - View hyperdrive disk usage with ~hyperdrive-describe~ and ~hyperdrive-menu~.
+- Clear local copy of a file or directory with ~hyperdrive-clear-cache~,
+  also bound in ~hyperdrive-menu~ and menu bar.
 
 ** Changed
 



[elpa] externals/greader a79f321146 3/3: greader version 0.11.1

2024-06-12 Thread ELPA Syncer
branch: externals/greader
commit a79f32114694fb2d520e3327bcd00a722fe66796
Author: Michelangelo Rodriguez 
Commit: Michelangelo Rodriguez 

greader version 0.11.1

Simplified the function `greader-audiobook--get-block.
The process of getting the current block is faster, as it is not
necessary to count words in the current buffer anymore.
---
 greader.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/greader.el b/greader.el
index 36b67522a9..2b45f4ec70 100644
--- a/greader.el
+++ b/greader.el
@@ -7,7 +7,7 @@
 ;; Keywords: tools, accessibility
 ;; URL: https://www.gitlab.com/michelangelo-rodriguez/greader
 ;; package-requires: ((google-translate))
-;; Version: 0.11.0
+;; Version: 0.11.1
 
 ;; 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



[elpa] externals/greader c621404b46 1/3: greader-audiobook.el: function `greader-audiobook--get-block-size' simplified.

2024-06-12 Thread ELPA Syncer
branch: externals/greader
commit c621404b46c763cd9cfa4c18ef828fac8a601847
Author: Michelangelo Rodriguez 
Commit: Michelangelo Rodriguez 

greader-audiobook.el: function `greader-audiobook--get-block-size' 
simplified.
---
 greader-audiobook.el | 31 ---
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/greader-audiobook.el b/greader-audiobook.el
index c0b480eb00..6766b66b50 100644
--- a/greader-audiobook.el
+++ b/greader-audiobook.el
@@ -147,6 +147,7 @@ Only the final report will be printed."
   :type '(boolean))
 
 ;; functions
+
 (defun greader-audiobook--get-block ()
   "Get a block of text in current buffer.
 This function uses `greader-audiobook-block-size' to determine the
@@ -157,8 +158,7 @@ Return a cons with start and end of the block or nil if at 
end of the buffer."
 
   (save-excursion
 (let ((start (point))
- (end (point-max))
- (words (count-words (point) (point-max
+ (end (point-max)))
   (if (assq major-mode greader-audiobook-modes)
  (progn
(search-forward
@@ -167,26 +167,19 @@ Return a cons with start and end of the block or nil if 
at end of the buffer."
(setq end (point)))
(pcase greader-audiobook-block-size
  ((pred numberp)
-  (when
-  (< (+ (point) greader-audiobook-block-size) (point-max))
-(cond
- ((> greader-audiobook-block-size 0)
-  (goto-char (+ (point) greader-audiobook-block-size))
-  (when (thing-at-point 'sentence)
-(forward-sentence))
-  (setq end (point))
+  (when (> greader-audiobook-block-size 0)
+(goto-char (+ (point) greader-audiobook-block-size))
+(when (thing-at-point 'sentence)
+  (forward-sentence)
+  (setq end (point)
  ((pred stringp)
   (cond
((> (string-to-number greader-audiobook-block-size) 0)
-(when (< (*
-  (string-to-number greader-audiobook-block-size)
-  (greader-get-rate))
- words)
-  (forward-word (* (string-to-number
-greader-audiobook-block-size)
-   (greader-get-rate)))
-  (when (thing-at-point 'sentence)
-(forward-sentence)))
+(forward-word (* (string-to-number
+  greader-audiobook-block-size)
+ (greader-get-rate)))
+(when (thing-at-point 'sentence)
+  (forward-sentence))
 (setq end (point)
  (_
   (error "Cannot determine the block size"



[elpa] externals/greader 1d9fc00c5a 2/3: Merge branch 'personal' into function-get-block

2024-06-12 Thread ELPA Syncer
branch: externals/greader
commit 1d9fc00c5aef2066b22894a1bea7536787bbd7f7
Merge: c621404b46 d655f3636c
Author: Michelangelo Rodriguez 
Commit: Michelangelo Rodriguez 

Merge branch 'personal' into function-get-block
---
 greader-audiobook.el |  24 
 greader-espeak.el|  13 +--
 greader-translate.el | 108 +++
 greader.el   |  45 ++---
 4 files changed, 157 insertions(+), 33 deletions(-)

diff --git a/greader-audiobook.el b/greader-audiobook.el
index 6766b66b50..a7258353be 100644
--- a/greader-audiobook.el
+++ b/greader-audiobook.el
@@ -256,14 +256,16 @@ COUNTER represents the current file name."
 (filename nil)
 (counter-chars 0))
 (while (< counter-chars (- (length
-total-blocks-string)(length counter-string)))
+total-blocks-string)
+  (length counter-string)))
   (setq filename (concat filename "0"))
   (setq counter-chars (+ counter-chars 1)))
 (setq filename (concat filename counter-string ".wav"
 
 (defun greader-audiobook-compress (book-directory)
   "Compress given BOOK-DIRECTORY."
-  (let ((zip-args (append (list "-rj")greader-audiobook-zip-args (list (concat
+  (let ((zip-args (append (list "-rj")greader-audiobook-zip-args (list
+ (concat

(string-remove-suffix
 "/"
 book-directory)
@@ -287,7 +289,8 @@ This function will create a directory under
 buffer without the extension, if any."
 
   (interactive "P")
-  (unless greader-audiobook-buffer-quietly(message "Preparing for conversion 
(this could take some time...)"))
+  (unless greader-audiobook-buffer-quietly
+(message "Preparing for conversion (this could take some time...)"))
   (let ((end-position (point-max)))
 (cond
  ((not start-position)
@@ -314,20 +317,24 @@ buffer without the extension, if any."
   (total-blocks (greader-audiobook--count-blocks)))
  (unless (file-exists-p default-directory)
(make-directory default-directory))
- (unless greader-audiobook-buffer-quietly(message "Starting conversion 
of %s ."
+ (unless greader-audiobook-buffer-quietly
+   (message "Starting conversion of %s ."
   book-directory))
  (while (greader-audiobook--get-block)
(setq output-file-name
  (greader-audiobook--calculate-file-name
   output-file-counter total-blocks))
-   (unless greader-audiobook-buffer-quietly(message "converting block 
%d of %d"
-
output-file-counter total-blocks))
+   (unless greader-audiobook-buffer-quietly
+ (message "converting block %d of %d"
+output-file-counter
+total-blocks))
(setq output-file-name
  (greader-audiobook-convert-block output-file-name))
(if output-file-name
(progn
  (when greader-audiobook-transcode-wave-files
-   (unless greader-audiobook-buffer-quietly(message 
"Transcoding block to %s..."
+   (unless greader-audiobook-buffer-quietly
+ (message "Transcoding block to %s..."
 
greader-audiobook-transcode-format))
(greader-audiobook-transcode-file
 output-file-name)
@@ -338,7 +345,8 @@ buffer without the extension, if any."
  (error "An error has occurred while converting")))
  (when greader-audiobook-compress
(setq default-directory greader-audiobook-base-directory)
-   (unless greader-audiobook-buffer-quietly(message "compressing 
%s..." book-directory))
+   (unless greader-audiobook-buffer-quietly
+ (message "compressing %s..." book-directory))
(greader-audiobook-compress book-directory)
(when greader-audiobook-compress-remove-original
  (delete-directory book-directory t t)
diff --git a/greader-espeak.el b/greader-espeak.el
index e8f461073a..138d2eaaef 100644
--- a/greader-espeak.el
+++ b/greader-espeak.el
@@ -1,5 +1,10 @@
-;; greader-espeak.el  -*- lexical-binding: t; -*-
+;;; greader-espeak.el --- greader back-end for espeak. -*- lexical-binding: t; 
-*-
 ;; Copyright (C) 2017-2024  Free Software Foundation, Inc.
+
+;;; commentary:
+
+;;; code:
+(require 'ring)
 (defgroup greader-espeak
   nil
   "Back-end of espeak for greader."
@@ -57,8 +62,9 @@ LANG

[elpa] externals/greader updated (d655f3636c -> a79f321146)

2024-06-12 Thread ELPA Syncer
elpasync pushed a change to branch externals/greader.

  from  d655f3636c greader: fixed version issue.
   new  c621404b46 greader-audiobook.el: function 
`greader-audiobook--get-block-size' simplified.
   new  1d9fc00c5a Merge branch 'personal' into function-get-block
   new  a79f321146 greader version 0.11.1


Summary of changes:
 greader-audiobook.el | 35 +--
 greader.el   |  2 +-
 2 files changed, 14 insertions(+), 23 deletions(-)



[elpa] externals/greader d1c3e08484: greader version 0.11.2

2024-06-12 Thread ELPA Syncer
branch: externals/greader
commit d1c3e08484d3f3d93838fe543adeef19310d0533
Author: Michelangelo Rodriguez 
Commit: Michelangelo Rodriguez 

greader version 0.11.2

Now the string associated with a particular mode in the variable
`greader-audiobook-modes' is interpreted as a regular expression.
The default value of the variable `greader-audiobook-modes' reflects
this change, to avoid empty blocks to be incorporated in the resulting
audiobook.
---
 greader-audiobook.el | 4 ++--
 greader.el   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/greader-audiobook.el b/greader-audiobook.el
index a7258353be..b154507c97 100644
--- a/greader-audiobook.el
+++ b/greader-audiobook.el
@@ -107,7 +107,7 @@ this variable will be ignored to honor the mode specified in
   :type '(choice (natnum :tag "size in characters") (string :tag "size
   in minutes")))
 
-(defcustom greader-audiobook-modes '((ereader-mode . ""))
+(defcustom greader-audiobook-modes '((ereader-mode . "\\W*"))
   "Different treatment of block based on the current major mode.
 Instead of numerical block size, use a string to determine the end of
 each block."
@@ -161,7 +161,7 @@ Return a cons with start and end of the block or nil if at 
end of the buffer."
  (end (point-max)))
   (if (assq major-mode greader-audiobook-modes)
  (progn
-   (search-forward
+   (re-search-forward
 (cdr (assq major-mode greader-audiobook-modes))
 nil t 1)
(setq end (point)))
diff --git a/greader.el b/greader.el
index 2b45f4ec70..730a96c4d0 100644
--- a/greader.el
+++ b/greader.el
@@ -7,7 +7,7 @@
 ;; Keywords: tools, accessibility
 ;; URL: https://www.gitlab.com/michelangelo-rodriguez/greader
 ;; package-requires: ((google-translate))
-;; Version: 0.11.1
+;; Version: 0.11.2
 
 ;; 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



[nongnu] elpa/hyperdrive 554648a7f8: Docs: Remove suggestion to reset persist variables

2024-06-12 Thread ELPA Syncer
branch: elpa/hyperdrive
commit 554648a7f8c024e18346a5e9f244cf8314472d81
Author: Joseph Turner 
Commit: Joseph Turner 

Docs: Remove suggestion to reset persist variables

We originally added this suggestion when the two persisted variables
were still changing rapidly.  It seems unlikely now that bad persist
variables are the root of user issues, and we don't want users to
delete their data for no reason.  Also, if there is an issue with the
persist variables, we'd prefer for users keep the invalid data so they
can pass it along to the maintainers for diagnosis.
---
 doc/hyperdrive.org  | 13 -
 doc/hyperdrive.texi | 16 
 2 files changed, 29 deletions(-)

diff --git a/doc/hyperdrive.org b/doc/hyperdrive.org
index 06419a74f3..320fe36026 100644
--- a/doc/hyperdrive.org
+++ b/doc/hyperdrive.org
@@ -1259,19 +1259,6 @@ to the relevant section in the ~hyperdrive.el~ manual.
 Please ensure that you have the expected version of the gateway by
 running ~M-x hyperdrive-install~.
 
-** Reset bad persist variables
-
-It is possible that the persisted values of ~hyperdrive-hyperdrives~
-and/or ~hyperdrive-version-ranges~ are wrong.  Reset them by evaluating:
-
-#+begin_src emacs-lisp
-  (progn
-(persist-reset 'hyperdrive-hyperdrives)
-(persist-save 'hyperdrive-hyperdrives)
-(persist-reset 'hyperdrive-version-ranges)
-(persist-save 'hyperdrive-version-ranges))
-#+end_src
-
 * Contributing/Getting help
 
 You're welcome to join our public XMPP chat room!
diff --git a/doc/hyperdrive.texi b/doc/hyperdrive.texi
index 4572a6e60b..f787d9c931 100644
--- a/doc/hyperdrive.texi
+++ b/doc/hyperdrive.texi
@@ -176,7 +176,6 @@ Tips
 Troubleshooting
 
 * Reinstall/upgrade the gateway::
-* Reset bad persist variables::
 
 Indices
 
@@ -1709,7 +1708,6 @@ to the relevant section in the @code{hyperdrive.el} 
manual.
 
 @menu
 * Reinstall/upgrade the gateway::
-* Reset bad persist variables::
 @end menu
 
 @node Reinstall/upgrade the gateway
@@ -1718,20 +1716,6 @@ to the relevant section in the @code{hyperdrive.el} 
manual.
 Please ensure that you have the expected version of the gateway by
 running @code{M-x hyperdrive-install}.
 
-@node Reset bad persist variables
-@section Reset bad persist variables
-
-It is possible that the persisted values of @code{hyperdrive-hyperdrives}
-and/or @code{hyperdrive-version-ranges} are wrong.  Reset them by evaluating:
-
-@lisp
-(progn
-  (persist-reset 'hyperdrive-hyperdrives)
-  (persist-save 'hyperdrive-hyperdrives)
-  (persist-reset 'hyperdrive-version-ranges)
-  (persist-save 'hyperdrive-version-ranges))
-@end lisp
-
 @node Contributing/Getting help
 @chapter Contributing/Getting help