emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Org and Hyperbole


From: Juan Manuel Macías
Subject: Re: Org and Hyperbole
Date: Sat, 08 Oct 2022 21:43:32 +0000

Robert Weiner writes:

> Hi Juan:
>
> I just tried your ':' technique for Hyperbole button activation with
> Avy and it works well.  But what is the advantage over just using Avy
> to jump to the button and then pressing {M-RET}.  With your technique,
> you have to think about activating the button before you are there
> versus when you are on it, as you normally do.

Hi, Robert,

Thanks for your comment. I agree with what you say. I'm afraid this
action, as I proposed it, is impractical. The proof is that I haven't
used it too much :-). Avy also includes some factory keys where the
action is performed on the target without losing focus or cursor
position. For example, to copy a "distant" word and paste at point. This
would be a more reasonable use case. Taking inspiration from Avy's code
for these actions, I've defined this new version:

(add-to-list 'avy-dispatch-alist '(?: . (lambda (pt)
                                          (goto-char pt)
                                          (hkey-either)
                                          (let ((dat (ring-ref avy-ring 0)))
                                            (select-frame-set-input-focus
                                             (window-frame (cdr dat)))
                                            (select-window (cdr dat))
                                            (goto-char (car dat))))))

Now hkey-either would run without losing the current focus and cursor
position. An example of use that occurs to me: for my translation of the
Odyssey into Spanish I have defined some implicit buttons that do the
following: if they are activated in a certain positions of the verse
(for example, at the beginning of the verse), it is shown in a temporary
postframe: a) the verse translated by me if the action is performed on
the original Greek verse and b) the original Greek verse if the action
is on the translated verse.

I think that is better seen in this short video:

https://cloud.disroot.org/s/4c7ZFCAPTercgMS

Best regards,

Juan Manuel



reply via email to

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