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

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

[elpa] externals-release/activities 0a5bdc6f1a 044/103: Add: (activity-n


From: ELPA Syncer
Subject: [elpa] externals-release/activities 0a5bdc6f1a 044/103: Add: (activity-new) Use prefix to redefine
Date: Tue, 30 Jan 2024 03:57:49 -0500 (EST)

branch: externals-release/activities
commit 0a5bdc6f1aa69fa59ca57123546fbc5174f8d5a1
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Add: (activity-new) Use prefix to redefine
---
 README.org  |  3 ++-
 activity.el | 11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/README.org b/README.org
index 21a2502fa3..894f60cb03 100644
--- a/README.org
+++ b/README.org
@@ -66,7 +66,8 @@ If you choose to install it otherwise, you'll need to load 
both the ~activity~ a
 4. Change window configuration, change tab, close the tab, or even restart 
Emacs.
 5. Call ~activity-resume~ (~C-x C-a C-a~) to resume the activity where you 
left off.
 6. Return to the original activity state with ~activity-revert~ (~C-x C-a g~).
-7. Suspend the activity with ~activity-suspend~ (~C-x C-a s~) (which saves its 
last state and closes its frame/tab).
+7. Call ~activity-new~ with a universal prefix argument (~C-u C-x C-a n~) to 
redefine an activity's default state.
+8. Suspend the activity with ~activity-suspend~ (~C-x C-a s~) (which saves its 
last state and closes its frame/tab).
 
 ** Bookmarks
 
diff --git a/activity.el b/activity.el
index 6ed4425f65..94bfe99539 100644
--- a/activity.el
+++ b/activity.el
@@ -260,11 +260,14 @@ Called with one argument, the activity."
 
 ;;;; Commands
 
-(defun activity-new (name)
-  "Save current state as a new activity with NAME."
+(cl-defun activity-new (name &key forcep)
+  "Save current state as a new activity with NAME.
+If FORCEP (interactively, with prefix), overwrite existing
+activity."
   ;; Not sure if this is needed, but let's experiment.
-  (interactive (list (read-string "New activity name: ")))
-  (when (member name (activity-names))
+  (interactive
+   (list (read-string "New activity name: ") :forcep current-prefix-arg))
+  (when (and (not forcep) (member name (activity-names)))
     (user-error "Activity named %S already exists" name))
   (let ((activity (make-activity :name name)))
     (activity--set activity)



reply via email to

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