branch: externals/hyperbole
commit 82b146470dfbc5d7c1e19a31ae67d5f3348acd11
Merge: 435938fe84 8d5638ba33
Author: bw <[email protected]>
Commit: bw <[email protected]>

    Merge branch 'master' into rsw
---
 ChangeLog          |  8 ++++++
 MANIFEST           |  1 +
 Makefile           |  4 +--
 hsys-activities.el | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 92 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 91752ff96e..965f6eb0a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,14 @@
 * MANIFEST: Add "HY-TALK/HYPERBOLEQA.kotl" from EmacsConf2025 talk.
   HY-TALK/HYPERBOLEQA.kotl - Add.
 
+2025-12-11  Mats Lidell  <[email protected]>
+
+* MANIFEST:
+  Makefile (EL_COMPILE): Add hsys-activities.el.
+
+* hsys-activities.el (hsys-activities): Add action button support for
+    external package activities.
+
 2025-12-07  Bob Weiner  <[email protected]>
 
 * hpath.el (hpath:shorten): Expand and abbreviate but don't shorten paths if
diff --git a/MANIFEST b/MANIFEST
index 12d6c67442..2c371de1ed 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -107,6 +107,7 @@ topwin.py            - Python script to find the topmost 
macOS app window at a s
 .hypb & _hypb        - Button data files used by the GNU Hyperbole DEMO file
 
 * --- EXTERNAL SYSTEM ENCAPSULATIONS ---
+hsys-activities.el   - GNU Hyperbole support functions for Activities
 hsys-consult.el      - Hyperbole interactive consult-grep convenience functions
 hsys-ert.el          - Hyperbole support for jumping to ert 'should' source 
lines
 hsys-flymake.el      - Add missing source buffer keymap to flymake linter
diff --git a/Makefile b/Makefile
index 9bb2d51e44..50e3a44987 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 # Author:       Bob Weiner
 #
 # Orig-Date:    15-Jun-94 at 03:42:38
-# Last-Mod:     29-Nov-25 at 19:19:51 by Mats Lidell
+# Last-Mod:     11-Dec-25 at 09:51:43 by Mats Lidell
 #
 # Copyright (C) 1994-2025  Free Software Foundation, Inc.
 # See the file HY-COPY for license information.
@@ -216,7 +216,7 @@ EL_COMPILE = hact.el hactypes.el hargs.el hbdata.el 
hbmap.el hbut.el \
             hinit.el hload-path.el hmail.el hmh.el hmoccur.el hmouse-info.el \
             hmouse-drv.el hmouse-key.el hmouse-mod.el hmouse-sh.el 
hmouse-tag.el \
             hpath.el hproperty.el hrmail.el hsettings.el hsmail.el 
hsys-consult.el \
-             hsys-ert.el hsys-flymake.el \
+             hsys-ert.el hsys-flymake.el hsys-activities.el \
              hsys-org.el hsys-org-roam.el hsys-www.el hsys-xref.el 
hsys-youtube.el htz.el \
             hycontrol.el hui-jmenu.el hui-menu.el hui-mini.el hui-mouse.el 
hui-select.el \
             hui-treemacs.el hui-window.el hui.el hvar.el hversion.el hynote.el 
hypb.el hyperbole.el \
diff --git a/hsys-activities.el b/hsys-activities.el
new file mode 100644
index 0000000000..9131ae13ab
--- /dev/null
+++ b/hsys-activities.el
@@ -0,0 +1,81 @@
+;;; hsys-activities.el --- action button support for activities -*- 
lexical-binding: t; -*-
+;;
+;; Author:       Mats Lidell
+;;
+;; Orig-Date:     7-Dec-25 at 22:48:29
+;; Last-Mod:     11-Dec-25 at 22:26:21 by Mats Lidell
+;;
+;; SPDX-License-Identifier: GPL-3.0-or-later
+;;
+;; Copyright (C) 2025  Free Software Foundation, Inc.
+;; See the "HY-COPY" file for license information.
+;;
+;; This file is part of GNU Hyperbole.
+
+;;; Commentary:
+;;
+;; Use as action button <hsys-activity "Activity">
+;;
+;; Create "Activity" if it does not exist.  If "Activity" is not
+;; active, switch to its latest state.  If "Activity" is active,
+;; revert it to its default state.  If "Activity" is active and the
+;; action button is called with a prefix argument a new default state
+;; is set.
+
+;;; Code:
+
+;;; ************************************************************************
+;;; Requirements
+;;; ************************************************************************
+
+(require 'hypb)
+
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(defvar activities-name-prefix)
+
+(declare-function activities-current "ext:activities")
+(declare-function activities-define "ext:activities")
+(declare-function activities-name-for "ext:activities")
+(declare-function activities-named "ext:activities")
+(declare-function activities-names "ext:activities")
+(declare-function activities-resume "ext:activities")
+(declare-function activities-revert "ext:activities")
+
+;;; ************************************************************************
+;;; Public functions
+;;; ************************************************************************
+
+;;;###autoload
+(defun hsys-activities (name)
+  "Create, resume and revert activity NAME in one function.
+- Create activity with NAME if it does not exist.
+- If activity NAME is not active, switch to its latest state.
+- If activity NAME is active and current, revert to its default state.
+- If activity NAME is active and hsys-activity is called with
+  `current-prefix-arg' set then set the default state."
+  (interactive (list (completing-read "Activity: " (activities-names) nil 
nil)))
+  (hypb:require-package 'activities)
+  (let ((activity (activities-named name)))
+    (cond ((not activity)
+           (activities-define name)
+           (message "Activity %s defined." name))
+          ((let ((current-activity (activities-current)))
+             (and current-activity
+                  (string=
+                   (activities-name-for activity)
+                   (activities-name-for current-activity))))
+           (if current-prefix-arg
+               (progn
+                 (activities-define name :forcep t)
+                 (message "Activity %s set to new default." name))
+             (activities-revert activity)
+             (message "Activity %s reverted." name)))
+          (t
+           (activities-resume activity)
+           (message "Activity %s resumed." name)))))
+
+(provide 'hsys-activities)
+;;; hsys-activities.el ends here

Reply via email to