emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Eduardo Ochs <eduardoochs@gmail.com>
Cc: Robert Weiner <rswgnu@gmail.com>, emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Org, Hyperbole, and eev
Date: Sat, 8 Oct 2022 04:25:53 +0300	[thread overview]
Message-ID: <Y0DRoZVoMznuMoA9@protected.localdomain> (raw)
In-Reply-To: <CADs++6jT1ty-vVqBSyVz5R4_+Yzv3LNDhLTYgLt76HeMetTu7g@mail.gmail.com>

* Eduardo Ochs <eduardoochs@gmail.com> [2022-10-08 03:28]:
> On Thu, 29 Sept 2022 at 06:22, Jean Louis <bugs@gnu.support> wrote:
> >
> > I am definitely interested, make prototype please. Just can't answer properly on travel.
> 
> Hi Jean Louis,
> 
> Sorry, I will have to put that on hold until my holidays... I wrote a
> very primitive prototype, but I never had to write much code that
> generates text with text properties, my friends are not interested in
> playing with that together with me, and I don't know where to borrow
> ideas from, so adding each new small feature by myself is a
> struggle... and right now writing code "whose inner details don't
> matter" is exactly the opposite of my notion of fun... =(

Fine, solution will come up with time. 

In the sense is similar to Org links, though just universal. With the
RCD Template Interpolation System for Emacs:
https://hyperscope.link/3/7/1/3/3/RCD-Template-Interpolation-System-for-Emacs.html
and this function, I can easily replace such snippets as below to their values:

** Hello heading

⟦ (format "[[https://www.example.com][Hello there %s]]" user-full-name) ⟧

(defun rcd-org-interpolate ()
  "Extrapolate Org buffer before dispatch."
  (interactive)
 (let ((my-org (buffer-substring (point-min) (point-max))))
 (with-temp-buffer
   (insert (rcd-template-eval my-org))
   (org-export-dispatch))))

(keymap-set org-mode-map "C-c C-e" 'rcd-org-interpolate)

to get Org hyperlinks. Or any other type of a link?

(defun hyperscope-hyperlink (id &optional markup)
  (let ((name (hyperscope-name id))
	(link (hyperscope-hyperdocument-url id))
	(markup (or markup (hyperscope-markup-type id))))
    ;; (unless (or (eq (last-key-binding) 'newline)
    ;; 		(= (last-key) 13))
    ;;(rcd-button-insert name (lambda (_) (hyperscope id))))
    (cond ((or (eq major-mode 'markdown-mode)
	       (and (not rcd-current-table-id)
		    (or (= markup 2)
			(= markup 3)
			(= markup 6))))
	   (format "[%s](%s \"%s\")" name link name))
	   ((eq major-mode 'adoc-mode) (format "%s[%s]" (hyperscope-hyperdocument-url id) name))
	   ((eq major-mode 'org-mode) (format "[[%s][%s]]" link name)))))

Same may be used to insert buttons:

(defun rcd-button-insert (button-text action-function &optional how-many)
  "Insert button BUTTON-TEXT with ACTION-FUNCTION.

Optional number HOW-MANY adds superscript digits to BUTTON-TEXT."
  (insert-text-button button-text
		      'action
                      action-function
		      'follow-link t)
  (when how-many
    (insert (rcd-superscript-digits how-many))))

(rcd-button-insert "Hello" (lambda (_) (message "I said Hello")))

now if button can be inserted, it means ⟦ (could insert button as well) ⟧ 
and make the link invisible part of text. Once toggled, invisible
part could become visible and saved as such link.


-- 
Jean

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

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


  reply	other threads:[~2022-10-08  5:03 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26 15:56 Org, Hyperbole, and eev Eduardo Ochs
2022-06-26 16:28 ` Robert Weiner
2022-06-26 17:51   ` Eduardo Ochs
2022-06-26 18:23     ` Robert Weiner
2022-06-26 19:45       ` Eduardo Ochs
2022-06-26 20:23         ` Robert Weiner
2022-06-26 23:25           ` Eduardo Ochs
2022-06-27  0:49           ` Robert Weiner
2022-06-27  3:48             ` Eduardo Ochs
2022-06-27  4:11               ` Robert Weiner
2022-06-28  4:43                 ` Eduardo Ochs
2022-09-27 15:10                   ` Jean Louis
2022-09-27 16:22                     ` Eduardo Ochs
2022-09-27 21:16                       ` Jean Louis
2022-09-27 21:58                         ` Jean Louis
2022-09-28  0:52                           ` Eduardo Ochs
2022-09-28  6:04                             ` Jean Louis
2022-09-28 10:15                               ` Eduardo Ochs
2022-09-29  9:22                                 ` Jean Louis
2022-10-08  0:28                                   ` Eduardo Ochs
2022-10-08  1:25                                     ` Jean Louis [this message]
2022-10-11  2:42                                       ` Robert Weiner
2022-10-11  4:59                                         ` Jean Louis
2022-09-29  9:42                                 ` Jean Louis
2022-09-29 11:55                                   ` Quiliro Ordóñez
2022-09-28  3:52                         ` Ihor Radchenko
2022-09-28  9:16                           ` Jean Louis
2022-09-29  4:07                             ` Ihor Radchenko
2022-09-29  9:59                               ` Jean Louis
2022-06-28  4:48             ` Eduardo Ochs
2022-06-28  6:26               ` Robert Weiner
2022-09-27 14:43             ` Jean Louis
2022-09-27 14:16       ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y0DRoZVoMznuMoA9@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=eduardoochs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rswgnu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).