[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/satchel 2514ae9c2b 3/9: Cleaning the fannypack
From: |
ELPA Syncer |
Subject: |
[elpa] externals/satchel 2514ae9c2b 3/9: Cleaning the fannypack |
Date: |
Tue, 22 Feb 2022 16:57:52 -0500 (EST) |
branch: externals/satchel
commit 2514ae9c2b005c21bd73eb8f89454eac0a74119a
Author: Theodor Thornhill <theo@thornhill.no>
Commit: Theodor Thornhill <theo@thornhill.no>
Cleaning the fannypack
---
fannypack.el | 65 ++++++++++++++++++++++++++++++++++++------------------------
1 file changed, 39 insertions(+), 26 deletions(-)
diff --git a/fannypack.el b/fannypack.el
index 26a99744d7..ffd623651b 100644
--- a/fannypack.el
+++ b/fannypack.el
@@ -60,7 +60,7 @@
"#"
(normalize (car (vc-git-branches))))))))
-(defun fannypack--read-fannypack ()
+(defun fannypack--read ()
(let ((filename (fannypack--name)))
(when (file-exists-p filename)
(with-temp-buffer
@@ -76,21 +76,28 @@
(pp fannypack (current-buffer)))
(write-region nil nil filename nil 'silent))))
+(defun fannypack--keep-sort-order (completions)
+ (lambda (string pred action)
+ (if (eq action 'metadata)
+ `(metadata (display-sort-function . ,#'identity))
+ (complete-with-action action completions string pred))))
+
(defun fannypack--completing-read (prompt fannypack)
(let ((default (caar fannypack)))
(if fannypack
(completing-read
(format prompt (file-name-nondirectory default))
- fannypack nil t nil nil default)
- (user-error "Fannypack empty!"))))
+ (fannypack--keep-sort-order fannypack) nil t nil nil default)
+ (user-error "Fannypack is empty!"))))
;;;###autoload
(defun fannypack-place ()
(interactive)
(fannypack--ensure-directory)
- (let ((fannypack (fannypack--read-fannypack)))
- (unless (member (list buffer-file-name) fannypack)
- (push (list buffer-file-name) fannypack)
+ (let ((fannypack (fannypack--read))
+ (entry (list buffer-file-name)))
+ (unless (member entry fannypack)
+ (setq fannypack (append fannypack (list entry)))
(fannypack--persist fannypack)
(message "Placed in fannypack!"))))
@@ -101,21 +108,27 @@
(fannypack--completing-read
"Fannypack pick [%s]: "
(remove (list buffer-file-name)
- (fannypack--read-fannypack)))))
+ (fannypack--read)))))
;;;###autoload
(defun fannypack-feeling-lucky (fannypack)
- (interactive (list (caar (fannypack--read-fannypack))))
+ (interactive (list (caar (fannypack--read))))
(find-file fannypack))
+;;;###autoload
+(defun fannypack-burn ()
+ (interactive)
+ (when (y-or-n-p "Burn this fannypack?")
+ (fannypack--persist nil)))
+
;;;###autoload
(defun fannypack-drop (fannypack)
- (interactive (list (fannypack--read-fannypack)))
- (when-let* ((entry
- (list
- (fannypack--completing-read
- "Fannypack drop [%s]: "
- fannypack))))
+ (interactive (list (fannypack--read)))
+ (when-let ((entry
+ (list
+ (fannypack--completing-read
+ "Fannypack drop [%s]: "
+ fannypack))))
(setq fannypack (remove entry fannypack))
(fannypack--persist fannypack)
(message "Dropped %s from fannypack"
@@ -123,12 +136,12 @@
;;;###autoload
(defun fannypack-promote (fannypack)
- (interactive (list (fannypack--read-fannypack)))
- (let* ((entry
- (list
- (fannypack--completing-read
- "Fannypack promote [%s]: "
- fannypack))))
+ (interactive (list (fannypack--read)))
+ (let ((entry
+ (list
+ (fannypack--completing-read
+ "Fannypack promote [%s]: "
+ fannypack))))
(setq fannypack (remove entry fannypack))
(push entry fannypack)
(fannypack--persist fannypack)
@@ -137,12 +150,12 @@
;;;###autoload
(defun fannypack-demote (fannypack)
- (interactive (list (fannypack--read-fannypack)))
- (let* ((entry
- (list
- (fannypack--completing-read
- "Fannypack demote [%s]: "
- fannypack))))
+ (interactive (list (fannypack--read)))
+ (let ((entry
+ (list
+ (fannypack--completing-read
+ "Fannypack demote [%s]: "
+ fannypack))))
(setq fannypack (remove entry fannypack))
(setq fannypack (append fannypack (list entry)))
(fannypack--persist fannypack)
- [elpa] branch externals/satchel created (now d27a006d33), ELPA Syncer, 2022/02/22
- [elpa] externals/satchel 2514ae9c2b 3/9: Cleaning the fannypack,
ELPA Syncer <=
- [elpa] externals/satchel e9f5146e79 2/9: Feelin' lucky, ELPA Syncer, 2022/02/22
- [elpa] externals/satchel 8481917960 4/9: Fanny the default-directory, ELPA Syncer, 2022/02/22
- [elpa] externals/satchel 2f14e833a6 5/9: Require project.el, ELPA Syncer, 2022/02/22
- [elpa] externals/satchel a6f72c3e1c 6/9: Do the fanny dance, ELPA Syncer, 2022/02/22
- [elpa] externals/satchel 26a5ef383a 8/9: Rename to satchel, ELPA Syncer, 2022/02/22
- [elpa] externals/satchel 3ad0a7968d 1/9: Fannypack, go!, ELPA Syncer, 2022/02/22
- [elpa] externals/satchel 90d2ad1deb 7/9: Add some docs to the defuns, ELPA Syncer, 2022/02/22
- [elpa] externals/satchel d27a006d33 9/9: Flesh out the readme a little more, ELPA Syncer, 2022/02/22