emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Org, Hyperbole, and eev


From: Jean Louis
Subject: Re: Org, Hyperbole, and eev
Date: Wed, 28 Sep 2022 09:04:16 +0300
User-agent: Mutt/+ () (2022-06-11)

* Eduardo Ochs <eduardoochs@gmail.com> [2022-09-28 03:54]:
> On Tue, 27 Sept 2022 at 18:59, Jean Louis <bugs@gnu.support> wrote:
> > (...)
> 
> What did you do to inspect an Org link?
> 
> Here's what I just tried: I created a file /tmp/foo.org containing
> " [[http://a/b/][ab]]\n"; - i.e., a space, a link, and a newline -
> and then I marked the whole buffer and ran `M-1 M-x find-eregionpp'
> on it to pretty-print the region as a string with properties, with
> the flag `print-circle' turned on... see:
> 
>   (find-efunction 'find-eregionpp)
>   http://angg.twu.net/eev-current/eev-blinks.el.html#find-eregionpp
> 
> Apparently Org divided that file into 8 subsegments, each one with
> different text properties... and they mention all these keywords:
> 
>   face follow-link font-lock-multiline fontified help-echo highlight
>   htmlize-link intangible invisible keymap mouse-2 mouse-3 mouse-face
>   org-find-file-at-mouse org-link org-linked-text org-open-at-mouse
>   rear-nonsticky
> 
> I _think_ that it should be possible to make this

I have followed it, though it helps me little. You know that better.

I would like to have non-Org links so that my function for links
interpolates into a button. It works now in the presentation mode. I
would like to make links descriptive or non descriptive just as in
Org, so that it works in editing mode.

>   ⟦ (hyperscope-wrap-eev "Hyperbole DEMO file" '(find-hyperbolefile "DEMO")) ⟧
> 
> into a kind of button using only three subregions with different text
> properties: a first invisible region with this,
> 
>   ⟦ (hyperscope-wrap-eev "
> 
> then a visible region with "button actions", with this,
> 
>   Hyperbole DEMO file
> 
> and then another invisible region with:
> 
>   " '(find-hyperbolefile "DEMO")) ⟧

Not like that really. Anything within ⟦  ⟧ or other delimiters, I wish
to get interpolated depending of settings. I would like to find or mae
general non-specific library for any kind of links to be customized. I
know this does not explain it well.

I am using:

RCD Template Interpolation System for Emacs:
https://hyperscope.link/3/7/1/3/3/RCD-Template-Interpolation-System-for-Emacs.html

Right now I use ⟦  ⟧ delimiters, but I could use as well ()

Let us say ⟦ emacs-version ⟧ I get easily visible with C-a a which
invokes:

(defun rcd-lightweight-markup-preview ()
  (interactive)
  (cond ((string= rcd-markup-language "asciidoc") (rcd-asciidoc-preview))
        ((string= rcd-markup-language "asciidoctor") (rcd-asciidoctor-preview))
        ((eq major-mode 'adoc-mode) (rcd-asciidoctor-preview))
        ((eq major-mode 'markdown-mode) (rcd-markdown-preview))
        ((eq major-mode 'html-mode) (rcd-markdown-preview))
        ((eq major-mode 'mhtml-mode) (rcd-markdown-preview))
        ((eq major-mode 't2t-mode) (rcd-txt2tags-html-preview))
        ((eq major-mode 'text-mode) (rcd-template-buffer-preview))
        ((eq major-mode 'mail-mode) (rcd-template-buffer-preview))
        (t (warn "I don't have preview for `%s'" major-mode))))

Example preview function:

(defun rcd-template-buffer-preview ()
  (interactive)
  (let* ((current (current-buffer))
         (buffer (format "Preview of buffer %s" current))
         (string (buffer-string))
         (mode major-mode)
         (point (point)))
    (pop-to-buffer-same-window buffer)
    (insert (rcd-template-eval string))
    (goto-char point)
    (funcall mode)
    (message buffer)))

That function uses rcd-template-eval so it means:

⟦ emacs-version ⟧ becomes "29.0.50"

Thus I would like to cover ⟦ ⟧ delimiters to become button which name
and action will be returned by the function itself. I know how to
replace the buffer with interpolated values, and links would appear,
but when I save buffer, ⟦ ⟧ links would not appear. I can use any
delimiters.

It would be good to have generalized Org-link descriptive and
non-descriptive links for any kinds of links.

- let us say that buffer is in markdown-mode

- let us imagine that link is (link "Name of link" 12) where by 12 is
  ID of the link and where by "link" is function that provides button
  with button name "Name of link" and action that could be anything.

- function "link" would then recognize that it is in major-mode like
  "markdown", and thus invoke formatting proper for markdown,
  something like this:

⟦ (cond (rcd::description (format "[%s](%s \"%s\") - %s" rcd::name rcd::link 
rcd::name rcd::description))
        (rcd::name (format "[%s](%s \"%s\")" rcd::name rcd::link rcd::name))
        (t (format "<%s>" rcd::link))) ⟧

but if text is in Org mode, it would invoke different formatting:

⟦ (format "[[%s][%s \"%s\"]" rcd::link rcd::name)) ⟧

For that to work in editing mode (not only in presentation), I would
need generic library to capture my ⟦ ⟧ delimiters (or others) and that
when buffer is interpolated, that it can be saved so that links are
also saved, and not that interpolated values are saved instead of
links; also that one can show back the buffer without interpolated
values.

-- 
Jean

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

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

⟦ (hyperscope-link 72828) ⟧



reply via email to

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