[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive d0d444aab2 040/102: Change: (hyperdrive-mirror)
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/hyperdrive d0d444aab2 040/102: Change: (hyperdrive-mirror) Rename PREDICATE argument to FILTER |
|
Date: |
Wed, 29 Nov 2023 04:00:50 -0500 (EST) |
branch: elpa/hyperdrive
commit d0d444aab267eca9071330aa20a33d5953807aa9
Author: Joseph Turner <joseph@ushin.org>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Change: (hyperdrive-mirror) Rename PREDICATE argument to FILTER
Since this argument is user-facing and we already say filter in
hyperdrive-menu-hyperdrive, let's consistently use the simpler term.
---
doc/hyperdrive.org | 12 ++++++------
doc/hyperdrive.texi | 12 ++++++------
hyperdrive-menu.el | 4 ++--
hyperdrive-mirror.el | 34 +++++++++++++++++-----------------
4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/doc/hyperdrive.org b/doc/hyperdrive.org
index b9c8083407..d84022528d 100644
--- a/doc/hyperdrive.org
+++ b/doc/hyperdrive.org
@@ -489,37 +489,37 @@ t~. Interactively, use two universal prefix arguments
~C-u C-u~.
*** Mirror files by tag or other attributes
-~hyperdrive-mirror~ can accept a ~PREDICATE~ argument, which you can
+~hyperdrive-mirror~ can accept a ~FILTER~ argument, which you can
use to upload only certain files. Interactively, one universal prefix
-argument ~C-u~ make this command prompt you for ~PREDICATE~.
+argument ~C-u~ make this command prompt you for ~FILTER~.
Let's say that you have some files on your filesystem in the ~~/blog/~
directory, but you only want to upload those files which have been
tagged as "public" using Protesilaos Stavrou's
[[https://protesilaos.com/emacs/denote][Denote]] file-naming
scheme.
-The following snippet includes a ~PREDICATE~ key whose value is a
+The following snippet includes a ~FILTER~ key whose value is a
regular expression against which every expanded filename inside will
be tested.
#+begin_src elisp
(hyperdrive-mirror "~/blog/" (hyperdrive-by-slot 'petname "foo")
:target-dir "/blog/"
- :predicate ".*_public.*")
+ :filter ".*_public.*")
#+end_src
Alternatively, you could select files by tag with Karl Voit's
[[https://github.com/novoid/filetags/][filetags]]. Either way allows for a
"non-splitting" approach where
public and private files exist in the same directory.
-~PREDICATE~ may also be a function, which receives the expanded filename
+~FILTER~ may also be a function, which receives the expanded filename
as its only argument. For example, the following snippet will mirror
only those files in ~~/blog/~ which are smaller than 5MB:
#+begin_src elisp
(hyperdrive-mirror "~/blog/" (hyperdrive-by-slot 'petname "foo")
:target-dir "/blog/"
- :predicate (lambda (file) (> (* 5 1024 1024)
+ :filter (lambda (file) (> (* 5 1024 1024)
(file-attribute-size
(file-attributes file)))))
#+end_src
diff --git a/doc/hyperdrive.texi b/doc/hyperdrive.texi
index a4845873e4..5b750f84d7 100644
--- a/doc/hyperdrive.texi
+++ b/doc/hyperdrive.texi
@@ -818,37 +818,37 @@ t}. Interactively, use two universal prefix arguments
@code{C-u C-u}.
@node Mirror files by tag or other attributes
@subsection Mirror files by tag or other attributes
-@code{hyperdrive-mirror} can accept a @code{PREDICATE} argument, which you can
+@code{hyperdrive-mirror} can accept a @code{FILTER} argument, which you can
use to upload only certain files. Interactively, one universal prefix
-argument @code{C-u} make this command prompt you for @code{PREDICATE}.
+argument @code{C-u} make this command prompt you for @code{FILTER}.
Let's say that you have some files on your filesystem in the @code{~/blog/}
directory, but you only want to upload those files which have been
tagged as ``public'' using Protesilaos Stavrou's
@uref{https://protesilaos.com/emacs/denote, Denote} file-naming
scheme.
-The following snippet includes a @code{PREDICATE} key whose value is a
+The following snippet includes a @code{FILTER} key whose value is a
regular expression against which every expanded filename inside will
be tested.
@lisp
(hyperdrive-mirror "~/blog/" (hyperdrive-by-slot 'petname "foo")
:target-dir "/blog/"
- :predicate ".*_public.*")
+ :filter ".*_public.*")
@end lisp
Alternatively, you could select files by tag with Karl Voit's
@uref{https://github.com/novoid/filetags/, filetags}. Either way allows for a
``non-splitting'' approach where
public and private files exist in the same directory.
-@code{PREDICATE} may also be a function, which receives the expanded filename
+@code{FILTER} may also be a function, which receives the expanded filename
as its only argument. For example, the following snippet will mirror
only those files in @code{~/blog/} which are smaller than 5MB:
@lisp
(hyperdrive-mirror "~/blog/" (hyperdrive-by-slot 'petname "foo")
:target-dir "/blog/"
- :predicate (lambda (file) (> (* 5 1024 1024)
+ :filter (lambda (file) (> (* 5 1024 1024)
(file-attribute-size
(file-attributes file)))))
@end lisp
diff --git a/hyperdrive-menu.el b/hyperdrive-menu.el
index 1df34e4cb3..38ec12a59a 100644
--- a/hyperdrive-menu.el
+++ b/hyperdrive-menu.el
@@ -275,7 +275,7 @@
(hyperdrive-mirror (or hyperdrive-mirror-source default-directory)
(hyperdrive-menu--scope)
:target-dir hyperdrive-mirror-target
- :predicate hyperdrive-mirror-filter
+ :filter hyperdrive-mirror-filter
:no-confirm (not hyperdrive-mirror-confirm)))
;; TODO(transient): Use a suffix class, so these commands can be invoked
@@ -338,7 +338,7 @@
;; TODO: Fontify the whole lambda.
((and (pred consp) it) (propertize (prin1-to-string it)
'face 'default))))
:reader (lambda (_prompt _default _history)
- (hyperdrive-mirror-read-predicate)))
+ (hyperdrive-mirror-read-filter)))
(transient-define-infix hyperdrive-mirror-set-confirm ()
:class 'hyperdrive-mirror-variable
diff --git a/hyperdrive-mirror.el b/hyperdrive-mirror.el
index 78d197b184..72224586bb 100644
--- a/hyperdrive-mirror.el
+++ b/hyperdrive-mirror.el
@@ -145,11 +145,11 @@ Runs `hyperdrive-mirror' again with the same query."
;;;###autoload
(cl-defun hyperdrive-mirror
- (source hyperdrive &key target-dir (predicate #'always) no-confirm)
+ (source hyperdrive &key target-dir (filter #'always) no-confirm)
"Mirror SOURCE to TARGET-DIR in HYPERDRIVE.
-Only mirror paths within SOURCE for which PREDICATE returns
-non-nil. PREDICATE may be a function, which receives the expanded
+Only mirror paths within SOURCE for which FILTER returns
+non-nil. FILTER may be a function, which receives the expanded
filename path as its argument, or a regular expression, which is
tested against each expanded filename path. SOURCE is a directory
name.
@@ -164,10 +164,10 @@ be uploaded and the URL at which each file will be
published. See
When NO-CONFIRM is non-nil, upload without prompting.
Interactively, with one universal prefix argument
-\\[universal-argument], prompt for predicate, otherwise mirror
+\\[universal-argument], prompt for filter, otherwise mirror
all files. With two universal prefix arguments
\\[universal-argument] \\[universal-argument], prompt for
-predicate and set NO-CONFIRM to t."
+filter and set NO-CONFIRM to t."
(interactive
(let ((source (read-directory-name "Mirror directory: " nil nil t))
(hyperdrive (hyperdrive-complete-hyperdrive :predicate
#'hyperdrive-writablep
@@ -177,16 +177,16 @@ predicate and set NO-CONFIRM to t."
;; auto-fill (or add as "future history") in target-dir prompt.
:target-dir (hyperdrive-read-path :hyperdrive hyperdrive :prompt
"Target directory in «%s»" :default "/")
:no-confirm (equal '(16) current-prefix-arg)
- :predicate (if current-prefix-arg
- (hyperdrive-mirror-read-predicate)
- #'always))))
+ :filter (if current-prefix-arg
+ (hyperdrive-mirror-read-filter)
+ #'always))))
(cl-callf expand-file-name source)
(setf target-dir (hyperdrive--format-path target-dir :directoryp t))
- (when (stringp predicate)
- (let ((regexp predicate))
- (setf predicate (lambda (filename)
- (string-match-p regexp filename)))))
- (let* ((files (cl-remove-if-not predicate (directory-files-recursively
source ".")))
+ (when (stringp filter)
+ (let ((regexp filter))
+ (setf filter (lambda (filename)
+ (string-match-p regexp filename)))))
+ (let* ((files (cl-remove-if-not filter (directory-files-recursively source
".")))
(parent-entry (hyperdrive-entry-create :hyperdrive hyperdrive :path
target-dir))
(buffer (unless no-confirm
(get-buffer-create "*hyperdrive-mirror*")))
@@ -194,7 +194,7 @@ predicate and set NO-CONFIRM to t."
(num-of (length files))
metadata-queue files-and-urls)
(unless files
- (hyperdrive-user-error "No files selected for mirroring (double-check
predicate)"))
+ (hyperdrive-user-error "No files selected for mirroring (double-check
filter)"))
(if no-confirm
(hyperdrive--mirror files-and-urls parent-entry)
(with-current-buffer buffer
@@ -208,7 +208,7 @@ predicate and set NO-CONFIRM to t."
'face
'font-lock-comment-face)))))))
(hyperdrive-mirror-mode)
(setq-local hyperdrive-mirror-query
- `(,source ,hyperdrive :target-dir ,target-dir
:predicate ,predicate)
+ `(,source ,hyperdrive :target-dir ,target-dir :filter
,filter)
hyperdrive-mirror-parent-entry parent-entry)
;; TODO: Add command to clear plz queue.
(setf metadata-queue
@@ -339,7 +339,7 @@ grouping keys, as in `hyperdrive-mirror-default-keys'."
(taxy-magit-section-insert taxy :items 'first :initial-depth 0))
taxy))))
-(defun hyperdrive-mirror-read-predicate ()
+(defun hyperdrive-mirror-read-filter ()
"Read a function for filtering source files for mirroring."
(let* ((readers
'(("Mirror all files" . nil)
@@ -351,7 +351,7 @@ grouping keys, as in `hyperdrive-mirror-default-keys'."
(lambda () (intern (completing-read "Named function: " obarray
#'functionp t))))))
;; TODO(transient): Implement returning values from prefixes,
;; allowing us to use a sub-prefix here instead of completing-read.
- (reader (completing-read "Predicate type: " readers nil t))
+ (reader (completing-read "Filter type: " readers nil t))
(reader (alist-get reader readers nil nil #'equal)))
(and reader (funcall reader))))
- [nongnu] elpa/hyperdrive fdf2b7cbff 078/102: Docs: Fix typo, (continued)
- [nongnu] elpa/hyperdrive fdf2b7cbff 078/102: Docs: Fix typo, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 211a0c7cba 087/102: Tidy: Indentation, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 4108f968aa 080/102: Tidy: Typo, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive af5daac737 017/102: Change: (-menu-hyperdrive) Use default-directory as default source, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 1e71cec4d0 074/102: Docs: Improve versioning section, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive c6c9bdbb77 082/102: Meta: Depend on transient v0.5.0, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 4aff066a9d 073/102: Docs: Improve naming section, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 5ef8e22cfd 019/102: Change: (hyperdrive-menu-hyperdrive) Simplify wording, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 69d0d16b18 063/102: Use format-spec to customize hyperdrive and entry display, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 9bc9cf44d8 018/102: Fix: (hyperdrive-mirror-read-predicate) Return symbol for named func, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive d0d444aab2 040/102: Change: (hyperdrive-mirror) Rename PREDICATE argument to FILTER,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 3a778929b8 041/102: Change: (hyperdrive-menu-hyperdrive) Wording of Mirror command, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive fea9674bd2 047/102: Change: (hyperdrive--format-entry) Add faces, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 30f378df0a 065/102: Fix: Fix indentation, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive e640a14d84 067/102: Change: (hyperdrive-{message, error}) Call substitute-command-keys, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 6f56f99d7d 071/102: Fix: (-org--open-at-point) Only call -open on hyper:// links, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 88948716a3 049/102: Docs: Document entry format defcustoms, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 853068609b 095/102: Tidy: Appease spellcheck linter, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 7c52a96078 092/102: Change: Don't autoload register-definition-prefixes, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 32658e6c5f 089/102: Notes: Update, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 902e52ad58 098/102: Merge: Add hyperdrive-menu transient, shorthands..., ELPA Syncer, 2023/11/29