[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/taxy aa0fe08 20/39: Change: taxy-copy -> taxy-emptied
From: |
ELPA Syncer |
Subject: |
[elpa] externals/taxy aa0fe08 20/39: Change: taxy-copy -> taxy-emptied |
Date: |
Fri, 27 Aug 2021 10:57:33 -0400 (EDT) |
branch: externals/taxy
commit aa0fe08de8676b61c3d633893b537839478d3434
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Change: taxy-copy -> taxy-emptied
This is more descriptive and accurate.
---
README.org | 12 ++++++------
taxy.el | 7 ++++---
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/README.org b/README.org
index eca198c..9c46940 100644
--- a/README.org
+++ b/README.org
@@ -233,7 +233,7 @@ The ~:predicate~ function determines whether an object fits
into that taxy. If
The ~:then~ function determines what happens to an object after being taken
in: if the function, called with the object, returns a non-nil value, that
value is applied to other taxys at the same level until one of their ~:then~
functions returns nil or no more taxys remain. The function defaults to
~ignore~, which makes a taxy "consume" its objects by default. Setting the
function to, e.g. ~identity~, makes it not consume them, leaving them eligible
to also be taken into subsequent tax [...]
-After defining a taxy, call ~taxy-fill~ with it and a list of objects to fill
the taxy's hierarchy. *Note:* ~taxy-fill~ modifies the taxy given to it
(filling its ~:objects~ and those of its ~:taxys~), so when using a statically
defined taxy (e.g. one defined with ~defvar~), you should pass ~taxy-fill~ a
taxy copied with ~taxy-copy~, which recursively copies a taxy without
~:objects~.
+After defining a taxy, call ~taxy-fill~ with it and a list of objects to fill
the taxy's hierarchy. *Note:* ~taxy-fill~ modifies the taxy given to it
(filling its ~:objects~ and those of its ~:taxys~), so when using a statically
defined taxy (e.g. one defined with ~defvar~), you should pass ~taxy-fill~ a
taxy copied with ~taxy-emptied~, which recursively copies a taxy without
~:objects~.
To return a taxy in a more human-readable format (with only relevant fields
included), use ~taxy-plain~. You may also use ~taxy-map~ to replace objects in
a taxy with, e.g. a more useful representation.
@@ -253,10 +253,10 @@ You may not always know in advance what taxonomy a set of
objects fits into, so
:name "Modes"
:take (apply-partially #'taxy-take-keyed
#'buffery-major-mode)))))
- ;; Note the use of `taxy-copy' to avoid mutating the original taxy
definition.
+ ;; Note the use of `taxy-emptied' to avoid mutating the original taxy
definition.
(taxy-plain
(taxy-fill (buffer-list)
- (taxy-copy buffery)))
+ (taxy-emptied buffery)))
#+END_SRC
The taxy's ~:take~ function is set to the ~taxy-take-keyed~ function,
partially applied with the ~buffery-major-mode~ function as its ~key-fn~
(~taxy-fill~ supplies the buffer and the taxy as arguments), and it produces
this taxonomy of buffers:
@@ -296,7 +296,7 @@ The taxy's ~:take~ function is set to the ~taxy-take-keyed~
function, partially
** Reusable taxys
-Since taxys are structs, they may be stored in variables and used in other
structs (being sure to copy the root taxy with ~taxy-copy~ before filling).
For example, this shows using =taxy= to classify Matrix rooms in
[[https://github.com/alphapapa/ement.el][Ement.el]]:
+Since taxys are structs, they may be stored in variables and used in other
structs (being sure to copy the root taxy with ~taxy-emptied~ before filling).
For example, this shows using =taxy= to classify Matrix rooms in
[[https://github.com/alphapapa/ement.el][Ement.el]]:
#+BEGIN_SRC elisp
(defun ement-roomy-buffer (room)
@@ -347,7 +347,7 @@ Using those defined taxys, we then fill the ~ement-roomy~
taxy with all of the r
(list (ement-room--room-display-name room)
(ement-room-id room)))
(taxy-fill (ement-session-rooms ement-session)
- (taxy-copy ement-roomy))))
+ (taxy-emptied ement-roomy))))
#+END_SRC
This produces:
@@ -388,7 +388,7 @@ If you happen to like macros, ~taxy~ works well with
threading (i.e. ~thread-las
#+BEGIN_SRC elisp
(thread-last ement-roomy
- taxy-copy
+ taxy-emptied
(taxy-fill (ement-session-rooms ement-session))
(taxy-map (lambda (room)
(list (ement-room--room-display-name room)
diff --git a/taxy.el b/taxy.el
index 935b404..7f181f6 100644
--- a/taxy.el
+++ b/taxy.el
@@ -72,12 +72,13 @@
(taxy-objects taxy)
(mapcar #'taxy-plain (taxy-taxys taxy)))))
-(defun taxy-copy (taxy)
+(defun taxy-emptied (taxy)
"Return a copy of TAXY without objects.
-Clears TAXY's objects and those of its descendant taxys."
+Omits TAXY's objects and those of its descendant taxys. Useful
+when reusing taxy definitions."
(setf taxy (copy-taxy taxy)
(taxy-objects taxy) nil
- (taxy-taxys taxy) (mapcar #'taxy-copy (taxy-taxys taxy)))
+ (taxy-taxys taxy) (mapcar #'taxy-emptied (taxy-taxys taxy)))
taxy)
(defun taxy-map (fn taxy)
- [elpa] externals/taxy f115919 06/39: Add: taxy-copy and reverse args to taxy-fill, (continued)
- [elpa] externals/taxy f115919 06/39: Add: taxy-copy and reverse args to taxy-fill, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy a94ab1c 05/39: Tidy, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 751e9d7 08/39: Show reusable taxys, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy d355d3a 14/39: Docs: Add mascot, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 3b253a6 21/39: Tidy: (taxy-fill) Argument order in labeled function, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy f5458d0 29/39: Change: taxy-map -> taxy-mapcar, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 35c8f61 33/39: Add: (taxy-magit-section-indent), ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 4686e03 36/39: Add: (taxy-size), ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 34aa94d 23/39: Add: taxy-magit-section, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy a17e540 35/39: Docs: Show examples, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy aa0fe08 20/39: Change: taxy-copy -> taxy-emptied,
ELPA Syncer <=
- [elpa] externals/taxy c60a96f 12/39: Change: Rename taxy-simple, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 1699d3a 15/39: Docs: Clarify, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy fcc780f 27/39: Add: (taxy-take-keyed*), ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 4e132ab 28/39: Docs: Tidy, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 524b151 19/39: Tidy: (taxy-fill), ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 906d387 30/39: Fix: (taxy-magit-section-pp) Use magit-section-mode, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy a7ffe21 37/39: Change: (diredy) Sort taxys, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 2c044ed 39/39: Add: (taxy-take-keyed*) :then, and examples, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 5a1b055 38/39: Docs: Add magit-loggy example, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 3cf0d46 25/39: Docs: Export Info manual, ELPA Syncer, 2021/08/27