[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive 62ef2a260d 069/102: Change: Require at least Em
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/hyperdrive 62ef2a260d 069/102: Change: Require at least Emacs 28.1 |
|
Date: |
Wed, 29 Nov 2023 04:00:54 -0500 (EST) |
branch: elpa/hyperdrive
commit 62ef2a260d53a6a833d80f76e0a29c44ab2d64f4
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Change: Require at least Emacs 28.1
We want to do this to be able to use shorthands.
We can do this because the package is still young.
This takes care of various TODO items that were previously
added to be taken care of at this point.
This reverts kludges added or modified in these commits:
- 5d710be Tidy: Compiler warning
- 8613211 Tidy: Compilation warning
- 5e7af43 Tests: Fix pcase/map bindings on Emacs 27
- TODO 94f7476 Tidy: Imenu compiler warning
- f71c199 Fix: (hyperdrive--kill-buffer-possibly-save) read-multiple-choice
- 01594b0 Tests: Fix on Emacs <28
- 677ccc0 Tests: Fix test on older Orgs
- (partial) e54c8c9 Meta: Display all build manifest badges
---
README.md | 1 -
hyperdrive-lib.el | 66 +++++++++++++++++---------------------------
hyperdrive-org.el | 8 ++----
hyperdrive.el | 57 +++++++++++++++-----------------------
tests/test-hyperdrive-org.el | 24 +++-------------
5 files changed, 56 insertions(+), 100 deletions(-)
diff --git a/README.md b/README.md
index 9b8ee27e7a..decfedcc00 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,5 @@
# hyperdrive.el - P2P filesystem in Emacs
-27.2: [](https://builds.sr.ht/~ushin/hyperdrive.el/commits/master/emacs-27.2.yml?)
28.2: [](https://builds.sr.ht/~ushin/hyperdrive.el/commits/master/emacs-28.2.yml?)
29.1: [](https://builds.sr.ht/~ushin/hyperdrive.el/commits/master/emacs-29.1.yml?)
snapshot: [](https://builds.sr.ht/~ushin/hyperdrive.el/commits/master/emacs-snapshot.yml?)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 8d590aaa0b..47d545fa45 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -44,10 +44,6 @@
(declare-function hyperdrive-mode "hyperdrive")
(declare-function hyperdrive-dir-mode "hyperdrive-dir")
-(eval-and-compile
- (when (< emacs-major-version 28)
- (cl-pushnew '(modes ignore) defun-declarations-alist :test #'equal)))
-
;;;; Errors
(define-error 'hyperdrive-error "hyperdrive error")
@@ -979,31 +975,22 @@ according to FORMATS, by default `hyperdrive-formats',
which see."
(propertize value 'face face))
"")))
(format-spec format
- ;; TODO(deprecate-28): Use lambdas in each specifier.
- `((?H . ,(and (string-match-p (rx "%"
- ;; Flags
- (optional (1+ (or " " "0"
"-" "<" ">" "^" "_")))
- (0+ digit) ;; Width
- (0+ digit) ;; Precision
- "H")
- format)
- ;; HACK: Once using lambdas in this specifier,
- ;; remove the `string-match-p' check.
- (hyperdrive--preferred-format hyperdrive)))
- (?P . ,(fmt 'petname petname 'hyperdrive-petname))
- (?N . ,(fmt 'nickname nickname 'hyperdrive-nickname))
- (?k . ,(fmt 'short-key public-key 'hyperdrive-public-key))
- (?K . ,(fmt 'public-key public-key
'hyperdrive-public-key))
- (?S . ,(fmt 'seed seed 'hyperdrive-seed))
- (?D . ,(if (car domains)
- (format (alist-get 'domains formats)
- (string-join
- (mapcar (lambda (domain)
- (propertize domain
- 'face
'hyperdrive-domain))
- domains)
- ","))
- "")))))))
+ `((?H . ,(lambda () (hyperdrive--preferred-format
hyperdrive)))
+ (?P . ,(lambda () (fmt 'petname petname
'hyperdrive-petname)))
+ (?N . ,(lambda () (fmt 'nickname nickname
'hyperdrive-nickname)))
+ (?k . ,(lambda () (fmt 'short-key public-key
'hyperdrive-public-key)))
+ (?K . ,(lambda () (fmt 'public-key public-key
'hyperdrive-public-key)))
+ (?S . ,(lambda () (fmt 'seed seed 'hyperdrive-seed)))
+ (?D . ,(lambda ()
+ (if (car domains)
+ (format (alist-get 'domains formats)
+ (string-join
+ (mapcar (lambda (domain)
+ (propertize domain
+ 'face
'hyperdrive-domain))
+ domains)
+ ","))
+ ""))))))))
(defun hyperdrive--preferred-format (hyperdrive &optional naming formats)
"Return HYPERDRIVE's formatted hostname, or nil.
@@ -1391,17 +1378,16 @@ according to FORMATS, by default `hyperdrive-formats',
which see."
"")))
(propertize
(format-spec (or format hyperdrive-default-entry-format)
- ;; TODO(deprecate-28): Use lambdas in each specifier.
- `((?n . ,(fmt 'name name))
- (?p . ,(fmt 'path path))
- (?v . ,(fmt 'version version))
- (?H . ,(hyperdrive--preferred-format hyperdrive nil
formats))
- (?D . ,(hyperdrive--format hyperdrive "%D" formats))
- (?k . ,(hyperdrive--format hyperdrive "%k" formats))
- (?K . ,(hyperdrive--format hyperdrive "%K" formats))
- (?N . ,(hyperdrive--format hyperdrive "%N" formats))
- (?P . ,(hyperdrive--format hyperdrive "%P" formats))
- (?S . ,(hyperdrive--format hyperdrive "%S" formats))))
+ `((?n . ,(lambda () (fmt 'name name)))
+ (?p . ,(lambda () (fmt 'path path)))
+ (?v . ,(lambda () (fmt 'version version)))
+ (?H . ,(lambda () (hyperdrive--preferred-format
hyperdrive nil formats)))
+ (?D . ,(lambda () (hyperdrive--format hyperdrive "%D"
formats)))
+ (?k . ,(lambda () (hyperdrive--format hyperdrive "%k"
formats)))
+ (?K . ,(lambda () (hyperdrive--format hyperdrive "%K"
formats)))
+ (?N . ,(lambda () (hyperdrive--format hyperdrive "%N"
formats)))
+ (?P . ,(lambda () (hyperdrive--format hyperdrive "%P"
formats)))
+ (?S . ,(lambda () (hyperdrive--format hyperdrive "%S"
formats)))))
'help-echo (hyperdrive-entry-url entry)))))
(defun hyperdrive--entry-directory-p (entry)
diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index 63725b4245..f0f2e877d1 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -75,11 +75,9 @@ which see."
"Return Org alist for current Org buffer.
Attempts to link to the entry at point. If RAW-URL-P, return a
raw URL, not an Org link."
- ;; NOTE: We would like to return a plist rather than an alist, but
- ;; the version of `map' included with Emacs 27 doesn't support that,
- ;; and depending on a later version won't force Emacs to actually
- ;; use it when compiling this package, so for now we avoid
- ;; destructuring plists with `pcase-let'.
+ ;; TODO: Since we depend on Emacs 28 now, we can rely on `map'
+ ;; being able to destructure a plist inside `pcase-let', so we
+ ;; should switch to using a plist instead of an alist.
;; NOTE: Ideally we would simply reuse Org's internal functions to
;; store links, like `org-store-link'. However, its API is not
;; designed to be used by external libraries, and requires ugly
diff --git a/hyperdrive.el b/hyperdrive.el
index 0cc21ce246..8cfea50fbb 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -7,7 +7,7 @@
;; Maintainer: Joseph Turner <~ushin/ushin@lists.sr.ht>
;; Created: 2022
;; Version: 0.3-pre
-;; Package-Requires: ((emacs "27.1") (map "3.0") (compat "29.1.4.0") (plz
"0.7") (persist "0.5") (taxy-magit-section "0.12.1") (transient "0.4.4"))
+;; Package-Requires: ((emacs "28.1") (map "3.0") (compat "29.1.4.0") (plz
"0.7") (persist "0.5") (taxy-magit-section "0.12.1") (transient "0.4.4"))
;; Homepage: https://git.sr.ht/~ushin/hyperdrive.el
;; This program is free software; you can redistribute it and/or
@@ -33,7 +33,7 @@
;;;; Installation:
-;; hyperdrive.el requires Emacs version 27.1 or later.
+;; hyperdrive.el requires Emacs version 28.1 or later.
;; hyperdrive.el is available on MELPA:
;; https://melpa.org/#/getting-started
@@ -85,13 +85,12 @@
"Browse hyperdrive URL."
(hyperdrive-open-url url))
-(when (version<= "28.1" emacs-version)
- (require 'browse-url)
- (require 'thingatpt)
+(require 'browse-url)
+(require 'thingatpt)
- (cl-pushnew (cons (rx bos "hyper://") #'hyperdrive-browse-url)
- browse-url-handlers :test #'equal)
- (cl-pushnew "hyper://" thing-at-point-uri-schemes :test #'equal))
+(cl-pushnew (cons (rx bos "hyper://") #'hyperdrive-browse-url)
+ browse-url-handlers :test #'equal)
+(cl-pushnew "hyper://" thing-at-point-uri-schemes :test #'equal)
;;;; Commands
@@ -780,13 +779,11 @@ The return value of this function is the retrieval
buffer."
expand-file-name url-default-expander)
url-scheme-registry)
-(defvar eww-use-browse-url)
-(when (version<= "28.1" emacs-version)
- (require 'eww)
- (setf eww-use-browse-url
- (if eww-use-browse-url
- (rx-to-string `(or ,eww-use-browse-url (seq bos "hyper://")))
- (rx bos "hyper://"))))
+(require 'eww)
+(setf eww-use-browse-url
+ (if eww-use-browse-url
+ (rx-to-string `(or ,eww-use-browse-url (seq bos "hyper://")))
+ (rx bos "hyper://")))
;;;; `kill-buffer-query-functions' integration
@@ -795,25 +792,17 @@ The return value of this function is the retrieval
buffer."
;; Mostly copied from `kill-buffer--possibly-save'.
(cl-assert (and hyperdrive-mode hyperdrive-current-entry))
(let ((response
- (cadr
- (if (< emacs-major-version 28)
- (read-multiple-choice
- (format "Hyperdrive file %s modified; kill anyway?"
- (hyperdrive--format-entry hyperdrive-current-entry))
- '((?y "yes" "kill buffer without saving")
- (?n "no" "exit without doing anything")
- (?s "save and then kill" "save the buffer and then kill it")))
- (with-suppressed-warnings ((free-vars use-short-answers))
- (compat-call read-multiple-choice
- (format "Hyperdrive file %s modified; kill anyway?"
- (hyperdrive--format-entry
hyperdrive-current-entry))
- '((?y "yes" "kill buffer without saving")
- (?n "no" "exit without doing anything")
- (?s "save and then kill" "save the buffer and
then kill it"))
- nil nil (and (not use-short-answers)
- (not (when (fboundp 'use-dialog-box-p)
- (with-no-warnings
- (use-dialog-box-p)))))))))))
+ (cadr (compat-call
+ read-multiple-choice
+ (format "Hyperdrive file %s modified; kill anyway?"
+ (hyperdrive--format-entry hyperdrive-current-entry))
+ '((?y "yes" "kill buffer without saving")
+ (?n "no" "exit without doing anything")
+ (?s "save and then kill" "save the buffer and then kill it"))
+ nil nil (and (not use-short-answers)
+ (not (when (fboundp 'use-dialog-box-p)
+ (with-no-warnings
+ (use-dialog-box-p)))))))))
(if (equal response "no")
nil
(unless (equal response "yes")
diff --git a/tests/test-hyperdrive-org.el b/tests/test-hyperdrive-org.el
index 1772fa7d94..a18e3ab570 100644
--- a/tests/test-hyperdrive-org.el
+++ b/tests/test-hyperdrive-org.el
@@ -94,11 +94,7 @@ Point is indicated by ★."
(setq-local hyperdrive-current-entry entry)
(goto-char (point-min))
(search-forward "★")
- (org-store-link nil 'interactive)
- ;; Disable the mode because on Emacs 27, `with-temp-buffer'
- ;; calls kill-buffer hooks and stuff like that which cause
- ;; prompting to kill the buffer when running the tests.
- (hyperdrive-mode -1))
+ (org-store-link nil 'interactive))
org-stored-links))
(defmacro hyperdrive-test-org-store-link-deftest (scenario)
@@ -106,7 +102,7 @@ Point is indicated by ★."
(let ((test-name (intern
(format "hyperdrive-test-org-store-link/%s" scenario))))
`(ert-deftest ,test-name ()
- (pcase-let* (((map (:public-key public-key) (:path path) (:content
content)
+ (pcase-let* (((map :public-key :path :content
(:url expected-url) (:desc expected-desc))
;; TODO: Is there a better syntax that explicit `quote'?
(alist-get (quote ,scenario)
@@ -115,14 +111,7 @@ Point is indicated by ★."
(hyperdrive-test-org-store-link content
:public-key public-key :path path)))
(should (string= expected-url got-url))
- (should (string= ,(if ;; TODO(deprecate-27): Remove this hack someday.
- (and (version<= org-version "9.4.4")
- (equal scenario 'org-mode-before-heading))
- '(progn
- (ignore expected-desc)
- expected-url)
- 'expected-desc)
- got-desc))))))
+ (should (string= expected-desc got-desc))))))
;; TODO: Loop through `hyperdrive-test-org-store-link-scenarios'?
(hyperdrive-test-org-store-link-deftest org-mode-before-heading)
@@ -139,8 +128,7 @@ Point is indicated by ★."
(cl-defun hyperdrive-test-org-insert-link-string (scenario &key public-key
path)
"Return link for SCENARIO inserted into entry with PUBLIC-KEY and PATH."
(declare (indent defun))
- (pcase-let (((map (:url url) (:desc desc))
- (alist-get scenario hyperdrive-test-org-store-link-scenarios)))
+ (pcase-let (((map :url :desc) (alist-get scenario
hyperdrive-test-org-store-link-scenarios)))
(with-temp-buffer
;; TODO: Initialize this buffer only once for this file's tests.
(org-mode)
@@ -148,10 +136,6 @@ Point is indicated by ★."
(setq-local hyperdrive-current-entry (hyperdrive-test-org-entry-create
:public-key public-key :path path))
(org-insert-link nil url desc)
- ;; Disable the mode because on Emacs 27, `with-temp-buffer'
- ;; calls kill-buffer hooks and stuff like that which cause
- ;; prompting to kill the buffer when running the tests.
- (hyperdrive-mode -1)
(buffer-string))))
(cl-defmacro hyperdrive-test-org-insert-link-deftest (name &key public-key
path results)
- [nongnu] elpa/hyperdrive 1b17526619 076/102: Docs: Improve wording of acknowledgment, (continued)
- [nongnu] elpa/hyperdrive 1b17526619 076/102: Docs: Improve wording of acknowledgment, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 281d686f15 083/102: Chore: Remove 27.2 build script, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 456257e607 020/102: Change: (hyperdrive-mirror-set-target) Propertize values, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive e7a01e7f5a 043/102: Fix: Silence byte-compiler, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 70362a6a7e 061/102: Tidy: Simplify labeled function and custom value, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive ab0e45fee3 034/102: Change: (hyperdrive-mirror-read-predicate) Remove rx form option, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive d76de4842b 072/102: Change: (-preferred-formats) Move into hyperdrive-entry-format group, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 484c799d05 075/102: Docs: Add missing vindex, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 2da7cdd6b9 096/102: Fix: Declare h/menu-hyperdrive, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive a9867d69a5 100/102: Tidy: Add missing declare-function, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 62ef2a260d 069/102: Change: Require at least Emacs 28.1,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive d0c30a9742 008/102: Change: (-menu-hyperdrive) Define remaining suffixes separately, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive cf227607db 038/102: Change: (hyperdrive-mirror-confirm) Add :info-manual, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 0a1a306009 024/102: Tidy: Rename hyperdrive-menu--entry to hyperdrive-menu--scope, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive caa7b0d4df 055/102: Tidy, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive cf557ee68d 015/102: Change (-menu-hyperdrive) Bind mirror suffixes after "m", ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive e9cb8f348e 016/102: Change: (-menu-hyperdrive) Remove hyperdrive-mirror-hyperdrive, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 0124153ffa 066/102: Change: Replace guillemet with grave and apostrophe, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 758c2444a5 102/102: Comment: Remove TODO, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 7af8897825 101/102: Tidy: (transient-format-value) Add missing docstring, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 8e591ae396 086/102: Tidy: Move applicable modes into interactive block, ELPA Syncer, 2023/11/29