You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 into a ~tab-bar~ tab or frame, 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. Resuming an activity loads the last-used state, or the initial/default state when a universal argument is provided.
5
+
Inspired by Genera's and KDE's concepts of "activities", this Emacs library allows the user to manage frames/tabs, windows, and buffers according to their purpose. An "activity" comprises a frame or tab, its window configuration, and the buffers displayed in them--its "state"; this state would be related to a certain task the user performs at various times, such as developing a certain software project, reading and writing email, working with one's Org mode system, etc.
6
6
7
-
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.
7
+
"Suspending" an activity saves the activity's state and closes its frame/tab; the user would do this when finished with the activity's task for the time being. "Resuming" the activity restores its buffers and windows to its frame/tab; the user would do this when ready to resume the task at a later time. This saves the user from having to manually arrange the same windows and buffers each time the task is to be done.
8
8
9
-
Integration with Emacs's ~tab-bar-mode~ is provided: a window configuration or can be restored to a ~tab-bar~ tab or to a frame.
9
+
Each activity saves two states: the default state, set when the activity is defined by the user, and the last-used state, which was how the user left it when the activity was suspended (or when Emacs exited, etc). This allows the user to resume the activity where the task was left off, while also allowing it to be reverted to the default state, providing a consistent entry point into the activity.
10
+
11
+
Internally, the Emacs ~bookmark~ library is used to save and restore 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 often trivial.
10
12
11
13
Various hooks are (or will be--feedback is welcome) provided, both globally and per-activity, so that the user can define functions to be called when an activity is saved, restored, or switched from/to. For example, this could be used to limit the set of buffers offered for switching to within an activity, or to track the time spent in an activity.
12
14
@@ -64,6 +66,7 @@ This is the recommended configuration, in terms of a ~use-package~ form to be pl
64
66
("C-x C-a C-k" . activities-kill)
65
67
;; This binding mirrors, e.g. "C-x t RET".
66
68
("C-x C-a RET" . activities-switch)
69
+
("C-x C-a b" . activities-switch-buffer)
67
70
("C-x C-a g" . activities-revert)
68
71
("C-x C-a l" . activities-list)))
69
72
#+END_SRC
@@ -115,6 +118,8 @@ Key bindings are, as always, ultimately up to the user. However, in [[Configura
115
118
+ ~activities-resume~ (~C-x C-a C-a~) :: Resume an activity, switching to a new frame or tab for its window configuration, and restoring its buffers. With prefix argument, restore its default state rather than its last.
116
119
+ ~activities-revert~ (~C-x C-a g~) :: Revert an activity to its default state.
117
120
+ ~activities-switch~ (~C-x C-a RET~) :: Switch to an already-active activity.
121
+
+ ~activities-switch-buffer~ (~C-x C-a b~) :: Switch to a buffer associated with the current activity (or, with prefix argument, another activity).
122
+
+ ~activities-rename~ :: Rename an activity.
118
123
+ ~activities-discard~ :: Discard an activity permanently.
119
124
+ ~activities-save-all~ :: Save all active activities' states. (~activities-mode~ does this automatically, so this command should rarely be needed.)
120
125
@@ -126,7 +131,7 @@ When option ~activities-bookmark-store~ is enabled, an Emacs bookmark is stored
126
131
127
132
+ How is this different from [[https://github.com/alphapapa/burly.el][Burly.el]] or [[https://github.com/alphapapa/bufler.el/][Bufler.el]]? :: Burly is a well-polished tool for restoring window and frame configurations, which could be considered an incubator for some of the ideas furthered here. Bufler's ~bufler-workspace~ library uses Burly to provide some similar functionality, which is at an exploratory stage. ~activities~ hopes to provide a longer-term solution more suitable for integration into Emacs.
128
133
129
-
+ How does this differ from "workspace" packages? :: Yes, there are many Emacs packages that provide "workspace"-like features in one way or another. To date, only Burly and Bufler seem to offer the ability to restore one across Emacs sessions. As mentioned, ~activities~ is intended to be more refined and easier to use (e.g. automatically saving activities' states when ~activities-mode~ is enabled). Comparisons to other packages are left to the reader; suffice to say that ~activities~ is intended to provide what other tools haven't, in an idiomatic, intuitive way. (Feedback is welcome.)
134
+
+ How does this differ from "workspace" packages? :: Yes, there are many Emacs packages that provide "workspace"-like features in one way or another. To date, only Burly and Bufler seem to offer the ability to restore one across Emacs sessions, including non-file-backed buffers. As mentioned, ~activities~ is intended to be more refined and easier to use (e.g. automatically saving activities' states when ~activities-mode~ is enabled). Comparisons to other packages are left to the reader; suffice to say that ~activities~ is intended to provide what other tools haven't, in an idiomatic, intuitive way. (Feedback is welcome.)
130
135
131
136
+ How does this differ from the built-in ~desktop-mode~? :: As best this author can tell, ~desktop-mode~ saves and restores one set of buffers, with various options to control its behavior. It does not use ~bookmark~ internally, which prevents it from restoring non-file-backed buffers. As well, it is not intended to be used on-demand to switch between sets of buffers, windows, or frames (i.e. "activities").
132
137
@@ -138,6 +143,19 @@ When option ~activities-bookmark-store~ is enabled, an Emacs bookmark is stored
138
143
139
144
* Changelog
140
145
146
+
** v0.6
147
+
148
+
*Additions*
149
+
+ Command ~activities-switch-buffer~ switches to a buffer associated with the current activity (or, with prefix argument, another activity). (A buffer is considered to be associated with an activity if it has been displayed in its tab. Note that this feature currently requires ~activities-tabs-mode~.)
150
+
+ Command ~activities-rename~ renames an activity.
151
+
+ Option ~activities-after-switch-functions~, a hook called after switching to an activity.
152
+
+ Option ~activities-set-frame-name~ sets the frame name after switching to an activity. ([[https://github.com/alphapapa/activities.el/issues/33][#33]]. Thanks to [[https://github.com/jdtsmith][JD Smith]].)
153
+
+ Option ~activities-kill-buffers~, when suspending an activity, kills buffers that were only shown in that activity.
154
+
155
+
*Changes*
156
+
+ Default time format in activities list.
157
+
+ When saving all activities, don't persist to disk for each activity. ([[https://github.com/alphapapa/activities.el/issues/34][#34]]. Thanks to [[https://github.com/yrns][Al M.]] for reporting.)
0 commit comments