[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals-release/activities 9f566e9523 020/103: WIP (Stuff is br
From: |
ELPA Syncer |
Subject: |
[elpa] externals-release/activities 9f566e9523 020/103: WIP (Stuff is broken, don't use yet) |
Date: |
Tue, 30 Jan 2024 03:57:47 -0500 (EST) |
branch: externals-release/activities
commit 9f566e9523f875815457df887dc6f308ee781e5e
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
WIP (Stuff is broken, don't use yet)
---
README.org | 2 ++
activity.el | 37 ++++++++++++++++++++-----------------
2 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/README.org b/README.org
index 9cd2bb02be..d7b1888f5c 100644
--- a/README.org
+++ b/README.org
@@ -1,5 +1,7 @@
#+TITLE: activity.el
+*NOTE:* This is currently broken. Don't use it yet. (It's only a day old.)
+
Inspired by Genera's and KDE's concepts of "activities", this library allows
the user to select an "activity", the loading of which restores a window
configuration and/or frameset, along with the buffers shown in each window.
Saving an activity saves the state for later restoration. Switching away from
an activity saves the last-used state for later switching back to, while still
allowing the activity's initial or default state to be restored on demand.
Restoring an activity loads the [...]
The implementation uses the bookmark system to save buffers' states--that is,
any major mode that supports the bookmark system is compatible. A buffer whose
major mode does not support the bookmark system (or does not support it well
enough to restore useful state) is not compatible and can't be fully restored,
or perhaps not at all; but solving that is as simple as implementing bookmark
support for the mode, which is usually trivial.
diff --git a/activity.el b/activity.el
index 778ae14c67..abe1f87e7d 100644
--- a/activity.el
+++ b/activity.el
@@ -224,15 +224,15 @@ Called with one argument, the activity."
;;;; Commands
(defun activity-new (name)
- "Switch to a new, empty activity named NAME."
+ "Save current state as a new activity with NAME."
;; Not sure if this is needed, but let's experiment.
(interactive (list (read-string "New activity name: ")))
(when (member name (activity-names))
(user-error "Activity named %S already exists" name))
- (scratch-buffer)
- (delete-other-windows)
(let ((activity (make-activity :name name)))
- (run-hook-with-args 'activity-after-resume-functions activity)))
+ (activity--set activity)
+ (activity-save name :defaultp t :lastp t)
+ activity))
(cl-defun activity-resume (activity &key resetp)
"Resume ACTIVITY.
@@ -250,22 +250,21 @@ closed."
(activity-save activity :lastp t)
(activity-close activity))
-(cl-defun activity-save (activity &key defaultp lastp)
- "Save ACTIVITY's states.
+(cl-defun activity-save (name &key defaultp lastp)
+ "Save states of activity having NAME.
If DEFAULTP, save its default state; if LASTP, its last."
- (interactive (list (activity-completing-read :prompt "Save activity as: ")
- :defaultp t :lastp t))
(unless (or defaultp lastp)
(user-error "Neither DEFAULTP nor LASTP specified"))
- (activity-with activity
- (pcase-let* (((cl-struct activity name default last) activity)
- (default (if defaultp (activity-state) default))
- (last (if lastp (activity-state) last))
- (props `((handler . activity-bookmark-handler)
- (activity . ,(prog1 activity
- (setf (activity-default activity)
default
- (activity-last activity)
last))))))
- (bookmark-store name props nil))))
+ (let ((activity (or (activity-named name) (activity-new name))))
+ (activity-with activity
+ (pcase-let* (((cl-struct activity name default last) activity)
+ (default (if defaultp (activity-state) default))
+ (last (if lastp (activity-state) last))
+ (props `((handler . activity-bookmark-handler)
+ (activity . ,(prog1 activity
+ (setf (activity-default activity)
default
+ (activity-last activity)
last))))))
+ (bookmark-store name props nil)))))
(defun activity-save-all ()
"Save all active activities' last states.
@@ -350,6 +349,10 @@ closed."
;; Not only frame: delete it.
(delete-frame frame))))
+(defun activity-named (name)
+ "Return activity having NAME."
+ (cl-find name (activity-activities) :key #'activity-name :test #'equal))
+
(defun activity-switch (activity)
"Switch to ACTIVITY.
Its STATE is loaded into the current frame. Does not modify its
- [elpa] externals-release/activities 10783f474f 012/103: WIP, (continued)
- [elpa] externals-release/activities 10783f474f 012/103: WIP, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 11bf7557c8 034/103: Notes: Add, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 4707587d15 037/103: Docs: Update readme, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities ab283c95ad 038/103: Update: Readme, commentary, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 29d96dc378 050/103: Fix, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities ee287a1986 015/103: WIP, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities a45ca6dd3a 021/103: WIP: Use multisession, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 552704ed45 004/103: Meta: makem.sh, .gitignore, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities d8b3264b95 017/103: Add README, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 03427b803c 016/103: Reasonably functional, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 9f566e9523 020/103: WIP (Stuff is broken, don't use yet),
ELPA Syncer <=
- [elpa] externals-release/activities 6725048041 024/103: Tidy: Header, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 7a3bba7b26 028/103: Add/Fix, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 760877b5eb 029/103: Set name of new activities' tabs/frames, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities a6b7ec1816 032/103: Fix: Mutation of window state, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 46a2346ea6 035/103: Update docs, bindings, alias, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 77852faab7 039/103: Add/Change: activity-switch, activity--switch, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities c7c3224aaa 045/103: Notes: Update, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 09b5d7f5f3 041/103: Remove: (activity-major-mode-alist), ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities 2372117021 040/103: Tidy, ELPA Syncer, 2024/01/30
- [elpa] externals-release/activities f41e4d0736 051/103: Notes: Update, ELPA Syncer, 2024/01/30