emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/satchel a6f72c3e1c 6/9: Do the fanny dance


From: ELPA Syncer
Subject: [elpa] externals/satchel a6f72c3e1c 6/9: Do the fanny dance
Date: Tue, 22 Feb 2022 16:57:52 -0500 (EST)

branch: externals/satchel
commit a6f72c3e1c993f3898476a818d5025146053ac8f
Author: Theodor Thornhill <theo@thornhill.no>
Commit: Theodor Thornhill <theo@thornhill.no>

    Do the fanny dance
---
 fannypack.el | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/fannypack.el b/fannypack.el
index 45bc07e40b..3a640532d9 100644
--- a/fannypack.el
+++ b/fannypack.el
@@ -48,13 +48,17 @@
   "Where the fannypacks will be saved."
   :type 'string)
 
+(defvar fannypack--default-directory nil
+  "Default directory override.")
+
 (defun fannypack--ensure-directory ()
   (make-directory (file-truename fannypack-directory) t))
 
 (defun fannypack--name ()
   (cl-flet ((normalize (file-name)
               (string-replace "/" "---" file-name)))
-    (let ((default-directory (project-root (project-current t))))
+    (let ((default-directory (or fannypack--default-directory
+                                 (project-root (project-current t)))))
       (file-truename
        (concat fannypack-directory
                (concat
@@ -114,8 +118,11 @@
 
 ;;;###autoload
 (defun fannypack-feeling-lucky (fannypack)
-  (interactive (list (caar (fannypack--read))))
-  (find-file fannypack))
+  (interactive
+   (list (caar (remove (list buffer-file-name) (fannypack--read)))))
+  (if fannypack
+      (find-file fannypack)
+    (user-error "Fannypack is empty!")))
 
 ;;;###autoload
 (defun fannypack-burn ()
@@ -164,5 +171,15 @@
     (message "Demoted %s to bottom in fannypack"
              (file-name-nondirectory (car entry)))))
 
+;;;###autoload
+(defun fannypack-default-directory (arg)
+  (interactive "P")
+  (setq fannypack--default-directory
+        (cond
+         ((equal arg '(4))
+          (project-root (project-current t)))
+         ((equal arg '(16))
+          (read-file-name "Default fannypack: " nil default-directory 
'mustmatch)))))
+
 (provide 'fannypack)
 ;;; fannypack.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]