hyperbole-users
[Top][All Lists]
Advanced

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

How to detect programmatically if M-RET has been invoked?


From: Jean Louis
Subject: How to detect programmatically if M-RET has been invoked?
Date: Sat, 08 Oct 2022 00:57:05 +0300

I use:  Editor:      GNU Emacs 29.0.50
        Hyperbole:   8.0.0
        Sys Type:    x86_64-pc-linux-gnu
        OS Type:     gnu/linux
        Window Sys:  x
        News Reader: Gnus v5.13
        Install:     elpa, 8.0.0

I would like to programmatically detect if M-RET has been invoked, in
other words, I want `defil' to know that it was invoked by Hyperbole.

My `defil' is:

(when (fboundp 'hyperbole)
  (defil rcd-template-eval "⟦ " " ⟧" ".*" "{M-: \\& RET}"))

thus I can make buttons like:

;;; GNU HYPERBOLE FUNCTIONS
;; ⟦ (people 318672) ⟧

where by M-RET on that link would invoke:

(defun cf-people-hypb-org (id)
  (cf-people id)
  "")

(defalias 'people 'cf-people-hypb-org)

which means to show person by it's ID.

However, I would like my hyperlink to disappear, as ⟦ something ⟧
represents also links which are interpolated to something. And I would
like to interpolate them to empty string "".

That way I can inject in lightweight markup languages any kind of
Hyerbole buttons, and with my decision have them interpolate to
nothing when it comes to document creation, export or sharing.

The function I wish to make is something like:

(defun cf-people-hypb-org (id)
  (cond ((Hyperbole-called-me) (cf-people id))
        (t "")))

It can also makes hyperlinks executable in 2 ways which can be quite
seperate from each other, first by Hyperbole, second by the
lightweight markup language.

Let us say if link can disappear, it will not disturb the export of
for example Org mode. But then such link may store so much more
information related to heading of the Org mode and accessible by
Hyperbole mechanism.

I can then do action X on the hyperlink by Hyperbole and interpolate
the link to anything.

It allows me to have universally accepted links in lightweight markup
languages. For example, I could have link such as:

⟦ (link "Lassie come home" 123) ⟧

which could then detect the major mode used and then interpolate
itself in org-mode into something like
[[https://www.example.com/movie-about-lassie][Movie about Lassie]] or
in markdown into something like:
[Movie about Lassie](https://www.example.com/movie-about-lassie)
or in asciidoc into something like this:
https://www.example.com/movie-about-lassie[Movie about Lassie]



--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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