Sure:

(defun bill/restore-calc-point (result)
  (when bill/calc-point
    (goto-char bill/calc-point)
    (setq bill/calc-point nil))
  result)

(advice-add 'hmouse-function :filter-return 'bill/restore-calc-point)

If my recalc function matches, it sets bill/restore-calc-point to a marker like this:

(setq bill/calc-point (make-marker))

Since it's normally nil, the advice normally just ignores it.


-- Bill


On Wed, Jun 22, 2022 at 9:05 PM David Masterson <dsmasterson@gmail.com> wrote:
Bill Burdick <bill.burdick@gmail.com> writes:

> Anywhere you use a link or button, you can probably use an emacs
> command instead. I think maybe the value of links and buttons is that
> they're explicit. It's a reminder in the text and you don't have to
> learn it.
>
> One thing I noticed in my little "recalc" exercise is that Hyperbole
> really really wants the cursor to stay on the button. I used function
> advice to make the cursor stay where it was when you clicked the
> button. This allows "menubars" to work, lists of buttons that can
> operate on the text without warping the cursor to the buttons. This is
> how Oberon and WIly work and I think Hyperbole (for my use cases
> anyway) will benefit from this usage style.

Could you provide an example of that function advice?
--
David Masterson