branch: externals/hyperbole
commit 105f1836ec3de9ac841d8cf819eea4dbace8bcc1
Author: Mats Lidell <[email protected]>
Commit: GitHub <[email protected]>
Add action button support for external package activities (#828)
---
ChangeLog | 8 ++++++
MANIFEST | 1 +
Makefile | 4 +--
hsys-activities.el | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4c5df4d26d..ca193db90b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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-06 Bob Weiner <[email protected]>
* hpath.el (hpath:absolute-to): Rewrite to fix when given multiple
'default-dirs'
diff --git a/MANIFEST b/MANIFEST
index e828abef7b..4d4173ab34 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -106,6 +106,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..64a15a0439
--- /dev/null
+++ b/hsys-activities.el
@@ -0,0 +1,80 @@
+;;; 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: 10-Dec-25 at 21:16:41 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
+;;; ************************************************************************
+
+(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