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

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

[elpa] externals-release/activities 77852faab7 039/103: Add/Change: acti


From: ELPA Syncer
Subject: [elpa] externals-release/activities 77852faab7 039/103: Add/Change: activity-switch, activity--switch
Date: Tue, 30 Jan 2024 03:57:49 -0500 (EST)

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

    Add/Change: activity-switch, activity--switch
---
 README.org       |  1 +
 activity-tabs.el |  6 +++---
 activity.el      | 19 ++++++++++++++-----
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/README.org b/README.org
index 0fd5cea6d3..6b2c7368f5 100644
--- a/README.org
+++ b/README.org
@@ -35,6 +35,7 @@ Until this library is available from a package archive, it's 
recommended to inst
      ;; user need not lift the Control key.  This makes it easier to
      ;; quickly switch between activities.
      ("C-x C-a C-a" . activity-resume)
+     ("C-x C-a RET" . activity-switch)
      ("C-x C-a g" . activity-revert)
      ("C-x C-a n" . activity-new)
      ("C-x C-a s" . activity-suspend))
diff --git a/activity-tabs.el b/activity-tabs.el
index 60022b80ae..9cf32c00da 100644
--- a/activity-tabs.el
+++ b/activity-tabs.el
@@ -58,7 +58,7 @@ accordingly."
   :group 'activity
   (let ((override-map '((activity-active-p . activity-tabs-activity-active-p)
                         (activity--set . activity-tabs-activity--set)
-                        (activity-switch . activity-tabs-switch)
+                        (activity--switch . activity-tabs--switch)
                         (activity-current . activity-tabs-current)
                         (activity-close . activity-tabs-close))))
     (if activity-tabs-mode
@@ -77,10 +77,10 @@ accordingly."
   "Close ACTIVITY.
 Its state is not saved, and its frames, windows, and tabs are
 closed."
-  (activity-switch activity)
+  (activity--switch activity)
   (tab-bar-close-tab))
 
-(defun activity-tabs-switch (activity)
+(defun activity-tabs--switch (activity)
   "Switch to ACTIVITY.
 Selects its tab, making one if needed.  Its state is not changed."
   (if-let ((tab (activity-tabs--tab activity)))
diff --git a/activity.el b/activity.el
index 2ffd60f506..ee2135fbec 100644
--- a/activity.el
+++ b/activity.el
@@ -152,7 +152,7 @@ Selects ACTIVITY's frame/tab and then switches back."
          (error "Activity %S not active" (activity-name ,activity)))
        (unwind-protect
            (progn
-             (activity-switch ,activity)
+             (activity--switch ,activity)
              ,@body)
          (pcase-let (((map :frame :window :tab-index) ,original-state-var))
            (when frame
@@ -253,7 +253,7 @@ Called with one argument, the activity."
   (let ((activity (make-activity :name name)))
     (activity--set activity)
     (activity-save activity :defaultp t :lastp t)
-    (activity-switch activity)
+    (activity--switch activity)
     activity))
 
 (cl-defun activity-resume (activity &key resetp)
@@ -262,7 +262,7 @@ If RESETP (interactively, with universal prefix), reset to
 ACTIVITY's default state; otherwise, resume its last state, if
 available."
   (interactive (list (activity-completing-read) :resetp current-prefix-arg))
-  (activity-switch activity)
+  (activity--switch activity)
   (activity-set activity :state (if resetp 'default 'last)))
 
 (defun activity-suspend (activity)
@@ -384,7 +384,7 @@ See option `activity-always-persist'."
   "Close ACTIVITY.
 Its state is not saved, and its frames, windows, and tabs are
 closed."
-  (activity-switch activity)
+  (activity--switch activity)
   ;; TODO: Set frame parameter when resuming.
   (delete-frame))
 
@@ -394,6 +394,15 @@ closed."
 
 (defun activity-switch (activity)
   "Switch to ACTIVITY.
+Interactively, offers active activities."
+  (interactive
+   (list (activity-completing-read
+          :activities (cl-remove-if-not #'activity-active-p 
activity-activities :key #'cdr)
+          :prompt "Switch to: ")))
+  (activity--switch activity))
+
+(defun activity--switch (activity)
+  "Switch to ACTIVITY.
 Select's ACTIVITY's frame, making a new one if needed.  Its state
 is not changed."
   (select-frame (or (activity--frame activity)
@@ -624,7 +633,7 @@ PROMPT is passed to `completing-read', which see."
 
 (defun activity-bookmark-handler (bookmark)
   "Switch to BOOKMARK's activity."
-  (activity-switch (map-elt activity-activities (car bookmark))))
+  (activity--switch (map-elt activity-activities (car bookmark))))
 
 (defun activity--buffer-local-variables (variables)
   "Return alist of buffer-local VARIABLES for current buffer.



reply via email to

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