* Org, Hyperbole, and eev
@ 2022-06-26 15:56 Eduardo Ochs
2022-06-26 16:28 ` Robert Weiner
0 siblings, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-06-26 15:56 UTC (permalink / raw)
To: Org Mode
Hi all,
this message is slightly off-topic, and a shameless plug...
Eev can do many things that Org and Hyperbole and do, but it makes
very little sense to people who can play the role of "users" well, in
the sense of people who can "use" Emacs packages without looking at
the elisp source and hacking it, i.e.: reading the source of the
package, inspecting and understanding its data structures, and
creating sexps that call the package's functions directly...
Eev still has a couple of parts whose data structures are hard to
inspect. I don't regard these parts as "real" bugs, but I do regard
them as hugely embarassing - and I have just fixed one of them:
`find-here-links', that is explained in this section of the main
tutorial,
http://angg.twu.net/eev-intros/find-eev-quick-intro.html#4.1
and in this other tutorial:
http://angg.twu.net/eev-intros/find-here-links-intro.html
The way to run `find-here-links' in debug mode is explained here,
http://angg.twu.net/eev-current/eev-hlinks.el.html
in the second part of the ";;; Commentary:" at the top - look for
"Debug mode".
As I mentioned in the other thread
https://lists.gnu.org/archive/html/emacs-orgmode/2022-06/msg00524.html
https://lists.gnu.org/archive/html/emacs-orgmode/2022-06/threads.html#00524
and in these pages,
http://angg.twu.net/2021-org-for-non-users.html
http://angg.twu.net/find-elisp-intro.html
http://angg.twu.net/eev-wconfig.html
http://angg.twu.net/hyperbole.html
I find Org and Hyperbole difficult mainly because they are
hacker-unfriendly. It _may be_ that some of the people who said that
they find Org very hard in this thread
https://lists.gnu.org/archive/html/emacs-devel/2022-06/threads.html#00186
would also benefit from a bit more of hacker-friendliness... and so it
would be great if more ideas could flow between Org, eev, and Hyperbole.
Cheers and sorry the noise =P,
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
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
0 siblings, 1 reply; 33+ messages in thread
From: Robert Weiner @ 2022-06-26 16:28 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 3218 bytes --]
Hi Eduardo:
I really think that you are confused in saying that Hyperbole and Org are
hacker-unfriendly. Yes, they are targeted at users who don't have to
understand the programming, but if you do understand Lisp programming well,
the interactive features are available as Lisp functions in almost all
cases, so you simply have to dive in, find the functions you want and
utilize or change them.
In fact, Hyperbole offers 'action implicit buttons' that utilize
angle-bracket syntax to turn any Lisp function (or hyperbole button type
call or variable reference) into a hyperbutton that runs the function with
arguments or displays the variable, e.g. <find-file "~/.org/my-org-file.org
">.
With Hyperbole, much of the behavior is factored into class-like libraries
with the 'methods' alphabetized and separated into public and private
groupings. Now some of this code is complex in order to handle many
contexts and make things simple to the user but that is a matter of you
understanding this complexity if you want to hack on it.
I'm not sure what else you could ask for in packages.
-- rsw
On Sun, Jun 26, 2022 at 11:58 AM Eduardo Ochs <eduardoochs@gmail.com> wrote:
> Hi all,
>
> this message is slightly off-topic, and a shameless plug...
>
> Eev can do many things that Org and Hyperbole and do, but it makes
> very little sense to people who can play the role of "users" well, in
> the sense of people who can "use" Emacs packages without looking at
> the elisp source and hacking it, i.e.: reading the source of the
> package, inspecting and understanding its data structures, and
> creating sexps that call the package's functions directly...
>
> Eev still has a couple of parts whose data structures are hard to
> inspect. I don't regard these parts as "real" bugs, but I do regard
> them as hugely embarassing - and I have just fixed one of them:
> `find-here-links', that is explained in this section of the main
> tutorial,
>
> http://angg.twu.net/eev-intros/find-eev-quick-intro.html#4.1
>
> and in this other tutorial:
>
> http://angg.twu.net/eev-intros/find-here-links-intro.html
>
> The way to run `find-here-links' in debug mode is explained here,
>
> http://angg.twu.net/eev-current/eev-hlinks.el.html
>
> in the second part of the ";;; Commentary:" at the top - look for
> "Debug mode".
>
> As I mentioned in the other thread
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2022-06/msg00524.html
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2022-06/threads.html#00524
>
> and in these pages,
>
> http://angg.twu.net/2021-org-for-non-users.html
> http://angg.twu.net/find-elisp-intro.html
> http://angg.twu.net/eev-wconfig.html
> http://angg.twu.net/hyperbole.html
>
> I find Org and Hyperbole difficult mainly because they are
> hacker-unfriendly. It _may be_ that some of the people who said that
> they find Org very hard in this thread
>
>
> https://lists.gnu.org/archive/html/emacs-devel/2022-06/threads.html#00186
>
> would also benefit from a bit more of hacker-friendliness... and so it
> would be great if more ideas could flow between Org, eev, and Hyperbole.
>
> Cheers and sorry the noise =P,
> Eduardo Ochs
> http://angg.twu.net/#eev
>
>
[-- Attachment #2: Type: text/html, Size: 5748 bytes --]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-26 16:28 ` Robert Weiner
@ 2022-06-26 17:51 ` Eduardo Ochs
2022-06-26 18:23 ` Robert Weiner
0 siblings, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-06-26 17:51 UTC (permalink / raw)
To: Robert Weiner; +Cc: Org Mode
On Sun, 26 Jun 2022 at 13:29, Robert Weiner <rsw@gnu.org> wrote:
> Hi Eduardo:
>
> I really think that you are confused in saying that Hyperbole and Org are hacker-unfriendly. Yes, they are targeted at users who don't have to understand the programming, but if you do understand Lisp programming well, the interactive features are available as Lisp functions in almost all cases, so you simply have to dive in, find the functions you want and utilize or change them.
>
> In fact, Hyperbole offers 'action implicit buttons' that utilize angle-bracket syntax to turn any Lisp function (or hyperbole button type call or variable reference) into a hyperbutton that runs the function with arguments or displays the variable, e.g. <find-file "~/.org/my-org-file.org">.
>
> With Hyperbole, much of the behavior is factored into class-like libraries with the 'methods' alphabetized and separated into public and private groupings. Now some of this code is complex in order to handle many contexts and make things simple to the user but that is a matter of you understanding this complexity if you want to hack on it.
>
> I'm not sure what else you could ask for in packages.
Hi Robert,
let me see if I can find something useful to say...
Most of the people that I know who became active users of eev were
"beginner programmers" when they started using eev - by "beginner
programmers" I mean that their mental buffers were still quite small,
and they couldn't understand well functions that were more than a few
lines long. I wanted to make eev more accessible to people like them,
and I treated their feedback very seriously.
One of the techniques that I used to make eev more accessible to them
is described in this video,
http://angg.twu.net/find-elisp-intro.html
(find-1stclassvideo-links "2022findelispintro")
(find-2022findelispintrovideo "14:36")
from 14:36 onwards - "put several similar examples close to one
another, starting by the most basic ones".
I treated that technique as "obvious" for many years - I just used it
in many places, and I thought that the users would notice that
pattern, and start to use it in their own notes. That didn't work, and
I saw that I had to spell out that technique explicitly, and repeat it
often.
When I asked you questions about how to create eev-style sexps that
would behave as hyperbole-style buttons, in some of the e-mails that I
point to here,
http://angg.twu.net/hyperbole.html
I was signaling that my mental buffers were almost full... at that
point explanations in English helped me very little, and I was trying
to write "several similar examples close to one another, starting by
the most basic ones" to factor your code conceptually via tests.
I _still_ think that your buttons and menus are hacker-unfriendly. The
source code is available, yes, but I spent several evenings trying to
understand them in my "non-user" way, and I got a mental buffer
overflow instead of enlightenment... and I also spent many hours
writing e-mails to the Hyperbole mailing list, but the answers left me
very frustrated.
Hope that helps, =/
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-26 17:51 ` Eduardo Ochs
@ 2022-06-26 18:23 ` Robert Weiner
2022-06-26 19:45 ` Eduardo Ochs
2022-09-27 14:16 ` Jean Louis
0 siblings, 2 replies; 33+ messages in thread
From: Robert Weiner @ 2022-06-26 18:23 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 6046 bytes --]
Hi Eduardo:
I do get this and see this is why you have not leveraged Hyperbole or Org
for eev implementation. (I do feel eev has a number of interesting and
useful ideas, and as I've said to you personally, I just hoped you could
use Hyperbole or other existing Emacs infrastructure to avoid embedding so
much code within eev).
I took a brief look today at some of the code in the latest packaged
release of eev from ELPA, as well as a bit at some of your email archives
and video links. What I see is that you like things extraordinarily
concrete and packages like Hyperbole and Org try to build up generalized
abstractions that can be used in many contexts. When you try to break down
how these abstractions work at the very low-level concrete mental model you
like, you find them too complex and therefore have to set them aside. If
you can't bend on that, then I think your choice is right, to just build
large amounts of low-level code that meets your needs. I think the way you
archive long lists of hyperlinks into videos for every few words spoken in
the video speaks to this style. I see the utility but this is not a common
style or need. It feels like we are offering a 'pour a glass of water'
function and you are trying to understand the physics of the molecular
movement within the water while it is pouring. Because you struggle to do
so, you decide you can't use our functions/capabilities, which is fine if
this is how your mind works, but really should not be a commentary upon the
packages provided.
You see each day new people are coming to these packages and figuring out
not only how to use them but to extend them to meet their needs, either
through new hyperbutton types or snippets of additional code. So they can
be bent to people's wills but you have to be willing to deal with
abstractions, not the equivalent of assembly language to do so.
Maybe if you could pick a single eev function that you think could be
implemented with Org and Hyperbole and pointed us to the documentation for
that, then we could show you an equivalent one using these packages and
begin to give you a better sense of how you would go about leveraging what
has been built. You document everything in detail, so this should be
pretty simple.
From my perspective, I do really like your idea of replayable notebooks for
training and interaction purposes. And you have certainly made that easy
to use via eev. But your implementation could use much better organization
and abstraction which would likely greatly reduce the code size as well.
You should separate out computation of what you want to display from how
and where you will display it as one technique.
-- rsw
On Sun, Jun 26, 2022 at 1:52 PM Eduardo Ochs <eduardoochs@gmail.com> wrote:
> On Sun, 26 Jun 2022 at 13:29, Robert Weiner <rsw@gnu.org> wrote:
> > Hi Eduardo:
> >
> > I really think that you are confused in saying that Hyperbole and Org
> are hacker-unfriendly. Yes, they are targeted at users who don't have to
> understand the programming, but if you do understand Lisp programming well,
> the interactive features are available as Lisp functions in almost all
> cases, so you simply have to dive in, find the functions you want and
> utilize or change them.
> >
> > In fact, Hyperbole offers 'action implicit buttons' that utilize
> angle-bracket syntax to turn any Lisp function (or hyperbole button type
> call or variable reference) into a hyperbutton that runs the function with
> arguments or displays the variable, e.g. <find-file "~/.org/
> my-org-file.org">.
> >
> > With Hyperbole, much of the behavior is factored into class-like
> libraries with the 'methods' alphabetized and separated into public and
> private groupings. Now some of this code is complex in order to handle
> many contexts and make things simple to the user but that is a matter of
> you understanding this complexity if you want to hack on it.
> >
> > I'm not sure what else you could ask for in packages.
>
>
> Hi Robert,
>
> let me see if I can find something useful to say...
>
> Most of the people that I know who became active users of eev were
> "beginner programmers" when they started using eev - by "beginner
> programmers" I mean that their mental buffers were still quite small,
> and they couldn't understand well functions that were more than a few
> lines long. I wanted to make eev more accessible to people like them,
> and I treated their feedback very seriously.
>
> One of the techniques that I used to make eev more accessible to them
> is described in this video,
>
> http://angg.twu.net/find-elisp-intro.html
> (find-1stclassvideo-links "2022findelispintro")
> (find-2022findelispintrovideo "14:36")
>
> from 14:36 onwards - "put several similar examples close to one
> another, starting by the most basic ones".
>
> I treated that technique as "obvious" for many years - I just used it
> in many places, and I thought that the users would notice that
> pattern, and start to use it in their own notes. That didn't work, and
> I saw that I had to spell out that technique explicitly, and repeat it
> often.
>
> When I asked you questions about how to create eev-style sexps that
> would behave as hyperbole-style buttons, in some of the e-mails that I
> point to here,
>
> http://angg.twu.net/hyperbole.html
>
> I was signaling that my mental buffers were almost full... at that
> point explanations in English helped me very little, and I was trying
> to write "several similar examples close to one another, starting by
> the most basic ones" to factor your code conceptually via tests.
>
> I _still_ think that your buttons and menus are hacker-unfriendly. The
> source code is available, yes, but I spent several evenings trying to
> understand them in my "non-user" way, and I got a mental buffer
> overflow instead of enlightenment... and I also spent many hours
> writing e-mails to the Hyperbole mailing list, but the answers left me
> very frustrated.
>
> Hope that helps, =/
> Eduardo Ochs
> http://angg.twu.net/#eev
>
[-- Attachment #2: Type: text/html, Size: 8027 bytes --]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-26 18:23 ` Robert Weiner
@ 2022-06-26 19:45 ` Eduardo Ochs
2022-06-26 20:23 ` Robert Weiner
2022-09-27 14:16 ` Jean Louis
1 sibling, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-06-26 19:45 UTC (permalink / raw)
To: Robert Weiner; +Cc: Org Mode
On Sun, 26 Jun 2022 at 15:23, Robert Weiner <rsw@gnu.org> wrote:
>
> Maybe if you could pick a single eev function that you think could
> be implemented with Org and Hyperbole and pointed us to the
> documentation for that, then we could show you an equivalent one
> using these packages and begin to give you a better sense of how you
> would go about leveraging what has been built. You document
> everything in detail, so this should be pretty simple.
I am not sure if I understood your proposal correctly, but let me
propose three tasks that would be pretty natural in eev-land... In all
cases below "explain" means "explain step by step, with links to the
source code and to the docs, and with sexps that inspect the data
structures".
1) explain what happens when we type M-RET on this button:
"subr.el"
2) explain what happens when we type:
C-h h d d
3) suppose that we have a function that plays a local copy of your
video "GNU Hyperbole - Overview and Demo". Let's use this fake
function instead of a real one:
;; Test: (fake-play-oand "2:34")
;;
(defun fake-play-oand (time &rest comments)
(move-beginning-of-line 2)
(insert (format "[Play Overview and Demo from: %s]\n" time)))
Explain how you would implement buttons - choose your favorite
syntax for them - that play "GNU Hyperbole - Overview and Demo"
starting from a given timemark.
Is that a good starting point? Note the unusual meaning for
"explain"... how would you use Hyperbole to prepare these
"explanations"?
> From my perspective, I do really like your idea of replayable
> notebooks for training and interaction purposes. And you have
> certainly made that easy to use via eev. But your implementation
> could use much better organization and abstraction which would
> likely greatly reduce the code size as well. You should separate out
> computation of what you want to display from how and where you will
> display it as one technique.
I'm very interested in seeing your suggestions! Can you be more
concrete?
[[]],
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
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
0 siblings, 2 replies; 33+ messages in thread
From: Robert Weiner @ 2022-06-26 20:23 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 3434 bytes --]
That was not the offer. The offer was to show you how to implement a
discrete eev command using another framework, possibly simplifying its
implementation. Hopefully, from seeing the code used to do this, you could
dig in yourself and follow the flow to whatever level you like. Hyperbole,
for example, has been implemented across years of part-time work. Of
course, it has complexities in its implementation and if the non-abstract
parts of that interest you, then use edebug or trace commands to explore
the code flow but I wouldn't expect anyone to write that out for you.
#3 is closer to the offer. If you want to see a Hyperbole function or
button type equivalent, I can show you that, i.e. you load Hyperbole and
then you use Hyperbole or eev syntax to jump to a point in a video that is
done through a Hyperbole implementation. But I can't explain the Hyperbole
dispatching mechanisms except at a high level. hkey-alist in Hyperbole is
not hard to understand. The prioritized list of implicit buttons types in
Hyperbole is not that hard to understand. That kind of level I can discuss.
-- rsw
-- rsw
On Sun, Jun 26, 2022 at 3:45 PM Eduardo Ochs <eduardoochs@gmail.com> wrote:
> On Sun, 26 Jun 2022 at 15:23, Robert Weiner <rsw@gnu.org> wrote:
> >
> > Maybe if you could pick a single eev function that you think could
> > be implemented with Org and Hyperbole and pointed us to the
> > documentation for that, then we could show you an equivalent one
> > using these packages and begin to give you a better sense of how you
> > would go about leveraging what has been built. You document
> > everything in detail, so this should be pretty simple.
>
> I am not sure if I understood your proposal correctly, but let me
> propose three tasks that would be pretty natural in eev-land... In all
> cases below "explain" means "explain step by step, with links to the
> source code and to the docs, and with sexps that inspect the data
> structures".
>
> 1) explain what happens when we type M-RET on this button:
>
> "subr.el"
>
> 2) explain what happens when we type:
>
> C-h h d d
>
> 3) suppose that we have a function that plays a local copy of your
> video "GNU Hyperbole - Overview and Demo". Let's use this fake
> function instead of a real one:
>
> ;; Test: (fake-play-oand "2:34")
> ;;
> (defun fake-play-oand (time &rest comments)
> (move-beginning-of-line 2)
> (insert (format "[Play Overview and Demo from: %s]\n" time)))
>
> Explain how you would implement buttons - choose your favorite
> syntax for them - that play "GNU Hyperbole - Overview and Demo"
> starting from a given timemark.
>
> Is that a good starting point? Note the unusual meaning for
> "explain"... how would you use Hyperbole to prepare these
> "explanations"?
>
> > From my perspective, I do really like your idea of replayable
> > notebooks for training and interaction purposes. And you have
> > certainly made that easy to use via eev. But your implementation
> > could use much better organization and abstraction which would
> > likely greatly reduce the code size as well. You should separate out
> > computation of what you want to display from how and where you will
> > display it as one technique.
>
> I'm very interested in seeing your suggestions! Can you be more
> concrete?
>
> [[]],
> Eduardo Ochs
> http://angg.twu.net/#eev
>
[-- Attachment #2: Type: text/html, Size: 4748 bytes --]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-26 20:23 ` Robert Weiner
@ 2022-06-26 23:25 ` Eduardo Ochs
2022-06-27 0:49 ` Robert Weiner
1 sibling, 0 replies; 33+ messages in thread
From: Eduardo Ochs @ 2022-06-26 23:25 UTC (permalink / raw)
To: Robert Weiner; +Cc: Org Mode
On Sun, 26 Jun 2022 at 17:24, Robert Weiner <rsw@gnu.org> wrote:
>
> That was not the offer. The offer was to show you how to implement a
> discrete eev command using another framework, possibly simplifying
> its implementation. Hopefully, from seeing the code used to do this,
> you could dig in yourself and follow the flow to whatever level you
> like. Hyperbole, for example, has been implemented across years of
> part-time work. Of course, it has complexities in its implementation
> and if the non-abstract parts of that interest you, then use edebug
> or trace commands to explore the code flow but I wouldn't expect
> anyone to write that out for you.
Hi Robert,
That's bad news. In the last years I became a specialist on helping
people with the "non-abstract parts", usually via chat... we discuss
until we find together what are the parts that are not clear to them,
them we write tests that show how those parts work, and then we go
back to the high-level functions.
In eev the two sexp hyperlinks below
(find-efunction 'hkey-initialize)
(find-efunction 'hkey-initialize "Bind the Action Key to {M-RET}")
point to the source code of `hkey-initialize', but the second one is a
"refinement" of the first one in this sense:
(find-refining-intro)
http://angg.twu.net/eev-intros/find-refining-intro.html
I often use sequences of sexp hyperlinks, with and without
refinements, to record an "explanation" of how something is done. For
example, this block
(code-c-d "hyperbole" "~/.emacs.d/elpa/hyperbole-8.0.0/")
(find-hyperbolefile "DEMO")
(find-hyperbolefile "DEMO" "Action Key is {M-RET}")
(find-hyperbolegrep "grep -nH --null -e M-RET *")
(find-efunction 'hkey-initialize)
(find-efunction 'hkey-initialize "Bind the Action Key to {M-RET}")
(find-ekeymapdescr hyperbole-mode-map)
(find-ekeymapdescr hyperbole-mode-map "M-RET")
(find-ekeymapdescr hyperbole-mode-map "M-RET" "hkey-either")
(find-efunction 'hkey-either)
(find-efunction 'assist-key)
(find-efunction 'assist-key-internal)
(find-efunction 'action-key)
(find-efunction 'action-key-internal)
(find-efunction 'hkey-execute)
(find-efunction 'hkey-execute "hkey-alist")
(find-evardescr 'hkey-alist)
(find-eppp hkey-alist)
(find-evariable 'hkey-alist)
(find-evariable 'hkey-alist "If on a Hyperbole button")
(find-efunction 'hbut:at-p)
(find-efunction 'hbut:at-p "ebut:at-p")
(find-efunction 'hbut:at-p "ibut:at-p")
(find-efunction 'ebut:at-p)
(find-efunction 'ebut:get)
(find-efunction 'ibut:at-p)
is an attempt to understand how M-RET treats hkey-alist as a kind of
program to be run...
How would you rewrite the sexps above as Hyperbole buttons?
I downloaded a local copy of
(find-hyperbolefile "FAST-DEMO")
(find-hyperbolefile "FAST-DEMO" "GNU Hyperbole Videos")
(find-hyperbolefile "FAST-DEMO" "Overview and Demo")
(find-hyperbolefile "FAST-DEMO" "https://youtu.be/WKwZHSbHmPg")
with
(find-youtubedl-links nil nil "WKwZHSbHmPg" nil "hoandd")
Docs: (find-efunction 'find-youtubedl-links)
and I found - via the transcript -
(find-yttranscript-links "hoandd" "WKwZHSbHmPg")
Docs: (find-efunction 'find-yttranscript-links)
that starting on 5:14
(find-hypoanddvideo "05:14" "and so it's very easy to create these")
(find-hypoanddvideo "05:17" "live")
(find-hypoanddvideo "05:18" "uh interactive tutorials if you want")
you say that you can use Hyperbole buttons to create interactive
tutorials... I do that with eev all the time, but my "buttons" are
sexps.
Imagine for a moment that a group of, say, 42 Emacs users asks you to
prepare a video tutorial on how exactly hkey-alist works, because they
want to create their own extensions - button types? - and they think
that it would be nice, and useful to the world, etc, etc, if you could
record a video explaining that... would you still answer something
like this,
"then use edebug or trace commands to explore the code flow but I
wouldn't expect anyone to write that out for you"
or would you use Hyperbole to create an interactive tutorial
explaining the details, and record a video demo-ing it?
[[]] =/,
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
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
` (2 more replies)
1 sibling, 3 replies; 33+ messages in thread
From: Robert Weiner @ 2022-06-27 0:49 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 6558 bytes --]
So here is a simple implementation that is not unlike your own though the
functions are a bit simpler and more clearly documented without a listing
of every possible test case type and requires neither Hyperbole nor Org
until you want to activate things as buttons:
(require 'browse-url)
(defun youtube-normalize-link (video-link)
"Return a URL to a youtube video. ViDEO-LINK must be a string and can be
a video identifier, e.g. WkwZHSbHmPg, or a full URL to the video."
(if (or (string-prefix-p "https://" video-link)
(string-prefix-p "www." video-link))
video-link
(concat "https://www.youtube.com/watch?v=" video-link)))
(defun youtube-normalize-time (time-string)
"Given a colon-separated TIME-STRING, with optional hours and minutes,
e.g. 1:2:44 (1 hour, two minutes, 45 seconds into a video), return the
normalized time for a Youtube url.
If the TIME-STRING format is invalid, return nil."
(if (string-match-p ":" time-string)
(let* ((time-parts (split-string time-string ":"))
(num-of-parts (length time-parts)))
(cond ((zerop num-of-parts)
"0s")
((= num-of-parts 1)
(concat (nth 0 time-parts) "s"))
((= num-of-parts 2)
(format "%sm%ss" (nth 0 time-parts) (nth 1 time-parts)))
((= num-of-parts 3)
(format "%sh%sm%ss" (nth 0 time-parts) (nth 1 time-parts) (nth 2
time-parts)))))
time-string))
(defun youtube-url-from-time (video-link time-string)
"Given a VIDEO-LINK and a colon-separated TIME-STRING, e.g. 2:44 (two
minutes, 45 seconds into the video), return the url to play from that point
in the video.
Return nil if TIME-STRING is invalid."
(when (setq time-string (youtube-normalize-time time-string))
(format "%s&t=%s"
(youtube-normalize-link video-link)
time-string)))
(defun youtube-play-from-time (video-link time-string)
"Given a VIDEO-LINK and a colon-separated TIME-STRING, e.g. 2:44 (two
minutes, 45 seconds), play the video from that point."
(browse-url (youtube-url-from-time video-link time-string)))
;;;;;;;;;;;;;;;;;;
Then once you load the Hyperbole package, in any buffer you could use any
of the 3 buttons below which all do the same thing when pressed upon with
the Action Key, {M-RET}:
<youtube-play-from-time "WKwZHSbHmPg" "2:44">
<youtube-play-from-time "www.youtube.com/watch?v=WKwZHSbHmPg" "2:44">
<youtube-play-from-time "https://www.youtube.com/watch?v=WKwZHSbHmPg"
"2:44">
If you added these functions to eev, I think you would simply change the <>
to ():
(youtube-play-from-time "WKwZHSbHmPg" "2:44")
;;;;;;;;;;;;;;;;;;;;;;;;
I avoided creating implicit button and action types for this example to
show you that they are not needed as you don't like specialized syntax
anyway and want everything to be explicit, but in Hyperbole, we would
probably create
an implicit button type that recognized strings like "yt:WKwZHSbHmPg@2:44"
and invoked the calls shown above.
;;;;;;;;;;;;;;;;;;;;;;;;
For comparison, below is your eev code for the same purpose. You can see
that it has extra arguments for little reason, uses eval where not
necessary, and makes the URL assembly more complicated than needed. The
differences are not major but my point is this adds up both in amounts of
code and amounts of maintenance needed that you could reduce leveraging
existing capabilities, like Hyperbole's ability to turn arbitrary functions
into hyperbuttons.
;;; _ _ _ _
;;; _ _ ___ _ _| |_ _ _| |__ ___ __ _(_) __| | ___ ___
;;; | | | |/ _ \| | | | __| | | | '_ \ / _ \____\ \ / / |/ _` |/ _ \/ _ \
;;; | |_| | (_) | |_| | |_| |_| | |_) | __/_____\ V /| | (_| | __/ (_) |
;;; \__, |\___/ \__,_|\__|\__,_|_.__/ \___| \_/ |_|\__,_|\___|\___/
;;; |___/
;;
;; «find-youtube-video» (to ".find-youtube-video")
;; Play a video on youtube using a browser.
;; Tests: (ee-find-youtube-url "xQqWufQgzVY" nil)
;; (ee-find-youtube-url "xQqWufQgzVY" "1:23")
;; (ee-find-youtube-video "xQqWufQgzVY")
;; (ee-find-youtube-video "xQqWufQgzVY" "1:23")
;; (ee-find-youtube-video "xQqWufQgzVY" "1:23" "Bla")
;; (find-youtube-video "xQqWufQgzVY" "1:23")
;; (ee-find-youtube-video "FoAzpGzFCSE" "15:14" "nice")
;; (find-youtube-video "FoAzpGzFCSE" "15:14" "nice")
;;
(defvar ee-find-youtube-video-program 'find-googlechrome)
(defun find-youtube-video (youtubeid &optional time &rest rest)
(eval (ee-find-youtube-video youtubeid time)))
(defun ee-find-youtube-video (youtubeid &optional time &rest rest)
(list ee-find-youtube-video-program
(ee-find-youtube-url youtubeid time)))
(defun ee-find-youtube-url (youtubeid time)
(format "http://www.youtube.com/watch?v=%s%s"
youtubeid (or (ee-time-to-youtube-time (or time "")) "")))
;; «youtube-time» (to ".youtube-time")
;; Tests: (ee-time-to-youtube-time "")
;; (ee-time-to-youtube-time "!")
;; (ee-time-to-youtube-time "2")
;; (ee-time-to-youtube-time "23")
;; (ee-time-to-youtube-time "123")
;; (ee-time-to-youtube-time "1:23")
;; (ee-time-to-youtube-time "1:23:43")
;; (ee-time-to-youtube-time "1:23:43" "&")
;; (ee-time-to-youtube-time "" "&")
;;
(defun ee-time-to-youtube-time (str &optional c)
"Convert strings like \"1:23\" to strings like \"#t=1m23s\".
Supports the input formats \"ss\", \"mm:ss\", and \"hh:mm:ss\".
If the input does not match any of these formats, return nil.
When C is non nil then use it as the prefix character. The
default is \"#\", but in some situations we need \"&\" instead."
(setq c (or c "#"))
(save-match-data
(cond ((string-match "^\\([0-9]+\\)$" str)
(format "%st=%ss" c (match-string 1 str)))
((string-match "^\\([0-9]+\\):\\([0-9][0-9]\\)$" str)
(format "%st=%sm%ss" c (match-string 1 str) (match-string 2
str)))
((string-match "^\\([0-9]+\\):\\([0-9][0-9]\\):\\([0-9][0-9]\\)$"
str)
(format "%st=%sh%sm%ss" c (match-string 1 str) (match-string 2
str)
(match-string 3 str))))))
;; Tests: (ee-time-to-arg "")
;; (ee-time-to-arg nil)
;; (ee-time-to-arg "{time}")
;; (ee-time-to-arg "1:23")
;; See: (find-efunction 'ee-time-to-youtube-time)
;;
(defun ee-time-to-arg (time)
(setq time (or time ""))
(if (ee-time-to-youtube-time time)
(format " \"%s\"" time)
""))
[-- Attachment #2: Type: text/html, Size: 10000 bytes --]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
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:48 ` Eduardo Ochs
2022-09-27 14:43 ` Jean Louis
2 siblings, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-06-27 3:48 UTC (permalink / raw)
To: Robert Weiner; +Cc: Org Mode
On Sun, 26 Jun 2022 at 21:50, Robert Weiner <rsw@gnu.org> wrote:
>
> So here is a simple implementation (...)
Hi Robert,
thanks - but most functions of eev that deal with youtube URLs are
clearly marked either as "this is part of a 5-minute hack" or as "this
is part of an ex-5-minute hack that grew too much", so people are
encouraged to rewrite them...
What are the functions of Hyperbole that handle sexp buttons in the
<...> syntax? Are they called by an "ebut:..." function, by an
"ibut:..." function, or what? Do you remember the names of the
lower-level functions that run <...> buttons?
[[]],
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-27 3:48 ` Eduardo Ochs
@ 2022-06-27 4:11 ` Robert Weiner
2022-06-28 4:43 ` Eduardo Ochs
0 siblings, 1 reply; 33+ messages in thread
From: Robert Weiner @ 2022-06-27 4:11 UTC (permalink / raw)
To: Eduardo Ochs, emacs-org list
These are Action buttons run by the action button type defined via the defib macro in the “hibtypes.el” file. Just search for ‘defib action’ in there. You can invoke its implicit button type function from Lisp as (ibtypes::action) if I recall.
-- Bob
> On Jun 26, 2022, at 11:48 PM, Eduardo Ochs <eduardoochs@gmail.com> wrote:
>
> On Sun, 26 Jun 2022 at 21:50, Robert Weiner <rsw@gnu.org> wrote:
>>
>> So here is a simple implementation (...)
>
> Hi Robert,
>
> thanks - but most functions of eev that deal with youtube URLs are
> clearly marked either as "this is part of a 5-minute hack" or as "this
> is part of an ex-5-minute hack that grew too much", so people are
> encouraged to rewrite them...
>
> What are the functions of Hyperbole that handle sexp buttons in the
> <...> syntax? Are they called by an "ebut:..." function, by an
> "ibut:..." function, or what? Do you remember the names of the
> lower-level functions that run <...> buttons?
>
> [[]],
> Eduardo Ochs
> http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-27 4:11 ` Robert Weiner
@ 2022-06-28 4:43 ` Eduardo Ochs
2022-09-27 15:10 ` Jean Louis
0 siblings, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-06-28 4:43 UTC (permalink / raw)
To: Robert Weiner; +Cc: emacs-org list
On Mon, 27 Jun 2022 at 01:11, Robert Weiner <rswgnu@gmail.com> wrote:
>
> These are Action buttons run by the action button type defined via
> the defib macro in the “hibtypes.el” file. Just search for ‘defib
> action’ in there. You can invoke its implicit button type function
> from Lisp as (ibtypes::action) if I recall.
Hi Robert and other people,
I was finally able to understand a significant part of what happens
when we type M-RET on an action button like
<insert "foo">
with hyperbole-mode active... my notes are here - for the sake of
completeness; I don't expect them to be readable -
(code-c-d "hyperbole" "~/.emacs.d/elpa/hyperbole-8.0.0/")
(require 'hyperbole)
(hyperbole-mode 0)
(find-hyperbolefile "DEMO")
(find-hyperbolefile "DEMO" "Action Key is {M-RET}")
(find-hyperbolegrep "grep -nH --null -e M-RET *")
(find-efunction 'hkey-initialize)
(find-efunction 'hkey-initialize "Bind the Action Key to {M-RET}")
(find-ekeymapdescr hyperbole-mode-map)
(find-ekeymapdescr hyperbole-mode-map "M-RET")
(find-ekeymapdescr hyperbole-mode-map "M-RET" "hkey-either")
(find-efunction 'hkey-either)
(find-efunction 'assist-key)
(find-efunction 'assist-key-internal)
(find-efunction 'action-key)
(find-efunction 'action-key-internal)
(find-efunction 'hkey-execute)
(find-efunction 'hkey-execute "hkey-alist")
(find-evardescr 'hkey-alist)
(find-eppp hkey-alist)
(find-eppp hkey-alist "(hbut:at-p)")
(find-evariable 'hkey-alist)
(find-evariable 'hkey-alist "If on a Hyperbole button")
(find-evariable 'hkey-alist "If on a Hyperbole button" "(hbut:at-p)")
(find-efunction 'hbut:at-p)
(find-efunction 'hbut:at-p "ebut:at-p")
(find-efunction 'hbut:at-p "ibut:at-p")
(find-efunction 'ebut:at-p)
(find-efunction 'ebut:get)
(find-efunction 'ibut:at-p)
https://lists.gnu.org/archive/html/emacs-orgmode/2022-06/msg00765.html
^ mentions ibtypes::action and defib action
(find-efunction 'defib)
(find-hyperbolegrep "grep --color=auto -nH --null -e defib *.el")
(find-hyperbolegrep "grep -a -nH --null -e defib hibtypes.el")
(find-hyperbolefile "hibtypes.el" "(defib action")
(progn
(find-hyperbolefile "hibtypes.el" "(defib action")
(end-of-defun)
(setq ee-defib-defun (ee-last-sexp))
)
(find-estring ee-defib-defun)
(find-epp (read ee-defib-defun))
(find-eppm (read ee-defib-defun))
(find-efunction 'htype:create)
(find-efunction 'htype:symbol)
(htype:symbol 'action 'ibtypes)
(find-efunction 'ibtypes::action)
(find-efunctionpp 'ibtypes::action)
(load "hibtypes.elc")
(load "hibtypes.el")
(find-efunctionpp 'ibtypes::action)
(hyperbole-mode 1)
(debug-on-entry 'ibtypes::action)
(eek "2*<down> C-e <left>")
(eek "<down> C-e <left> M-RET")
<insert "foo">
(hyperbole-mode 0)
(find-efunction 'ibut:at-p)
(find-efunction 'ibut:at-p "(funcall itype)")
(find-eppp (htype:category 'ibtypes))
(find-hyperbolegrep "grep -a -nH --null -e defib hibtypes.el")
(find-efunction 'symtable:add)
(find-evardescr 'symtable:ibtypes)
(find-evariable 'symtable:ibtypes)
I still don't understand well the code of ibut:at-p between the
beginning and the point in which it calls (funcall itype), and I also
don't understand well the code of ibtypes::action...
Anyway, we are clearly using different notions of simplicity - see:
https://lists.gnu.org/archive/html/hyperbole-users/2020-09/msg00013.html
and I find it enviable that you can have that kind of complexity under
the hood and still have lots of users that agree that Hyperbole is
"simple"...
Most people find eev very weird, and I have the impression that I
wouldn't have half of my (few) users if I had code like that in eev.
If the people who like to look under the hood try to understand how
M-e in eev works they will end up trying to understand how
(forward-sexp -1)
works, and then they will read the comments of scan-sexps in
syntax.c... syntax.c is impeccably well-written, and they will
probably feel that their time was very well spent, and that their
curiosity has lead them to very good places. =\
Exhausted cheers,
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-27 0:49 ` Robert Weiner
2022-06-27 3:48 ` Eduardo Ochs
@ 2022-06-28 4:48 ` Eduardo Ochs
2022-06-28 6:26 ` Robert Weiner
2022-09-27 14:43 ` Jean Louis
2 siblings, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-06-28 4:48 UTC (permalink / raw)
To: Robert Weiner; +Cc: Org Mode
On Sun, 26 Jun 2022 at 21:50, Robert Weiner <rsw@gnu.org> wrote:
>
> So here is a simple implementation that is not unlike your own
> though the functions are a bit simpler and more clearly documented
> _without a listing of every possible test case type_ and requires
> neither Hyperbole nor Org until you want to activate things as
> buttons:
Hi Robert,
I think that the part in "_..._"s above deserves a detailed answer.
I started using GNU/Linux in the mid-90s. Before that my favorite
languages were Icon and Forth. In Forth I could do AMAZING things in
less than 50 lines of code, but my programs would usually become
confusing and unmanageable when they grew bigger than that.
There is a famous book by Fred Brooks called "The Mythical Man-Month",
and one of its chapters is called "Plan to Throw One Away":
https://wiki.c2.com/?PlanToThrowOneAway
I took that slogan seriously. Most of the time when I realized that
something that I was doing by hand could be automated I would write a
first attempt to automate it - _as a prototype_, that I regarded
partly a program and partly as a way to help me think how that task
could be structured, and that would probably be "thrown away" if I
needed a cleaner solution later.
In Forth it was very easy to implement both strange interfaces and
little languages, in this sense:
https://wiki.c2.com/?LittleLanguage
In Emacs less so, but I could still do lots of funny things using
eval-last-sexp to use sexps as buttons.
When we are writing throwaway code "planning to throw one away" then
using tests in comments is a very good way to document the code. And
when I rewrite my prototypes I usually prefer to document them using
text ***AND*** executable examples rather than just text. One of the
effects of using this style is that the users of eev see that they can
use that style in their notes too - and with that their notes become
much closer to being "executable notes", in this sense,
http://angg.twu.net/eev-intros/find-here-links-intro.html
than they would be if they believed that they had to write the docs of
their functions as just text.
You are sort of saying that having tests in comments is bad style.
Well, it's not. =/
[[]],
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-28 4:48 ` Eduardo Ochs
@ 2022-06-28 6:26 ` Robert Weiner
0 siblings, 0 replies; 33+ messages in thread
From: Robert Weiner @ 2022-06-28 6:26 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 4288 bytes --]
Hi Eduardo:
Many programmers refuse to document almost anything and expect the code to
speak for itself. Or they throw random comments throughout their code that
don't help elucidate things. The nice thing about most Elisp code is that
the inputs and outputs of functions are often pretty well documented, since
people learn from many good examples. I support you in wanting to document
and explain things very clearly for your readers. For most people,
Hyperbole is extensively documented down to the function-level. But you
want an 'atomic'-level description of the internals of Hyperbole which I
think would be useful to only a very small population.
Good programming is about producing and layering clean abstractions that
sometimes must mask internal complexity and expose only the interfaces
necessary for use (could be a UI, an API or a class abstraction). It's not
turtles all the way down as the 'physics' of different levels of
implementation varies. Hackers do build from lego blocks; they don't spend
their time trying to deconstruct everything just to get comfortable with
every component they use, in general. If you want to spend years trying to
wrap your mind around something a bit complex then read The Art of the
Meta-object Protocol many times. Then, if you survive, come back to
Hyperbole and its call tree will seem simple to you :-)
Seriously though, I get that you learn and document differently than many
other people, so just do your own thing, your own way. I am reminded of
the Hudsucker Proxy where the 'rube' is derided for his stupid idea until
later it turns out to be one of the most profitable inventions in history.
Maybe the rest of us just can't see what you see because of the way you
express it, though if we could, we would be enthralled. I know a bit what
that is like!
Best of luck,
-- rsw
On Tue, Jun 28, 2022 at 12:48 AM Eduardo Ochs <eduardoochs@gmail.com> wrote:
> On Sun, 26 Jun 2022 at 21:50, Robert Weiner <rsw@gnu.org> wrote:
> >
> > So here is a simple implementation that is not unlike your own
> > though the functions are a bit simpler and more clearly documented
> > _without a listing of every possible test case type_ and requires
> > neither Hyperbole nor Org until you want to activate things as
> > buttons:
>
>
> Hi Robert,
>
> I think that the part in "_..._"s above deserves a detailed answer.
>
> I started using GNU/Linux in the mid-90s. Before that my favorite
> languages were Icon and Forth. In Forth I could do AMAZING things in
> less than 50 lines of code, but my programs would usually become
> confusing and unmanageable when they grew bigger than that.
>
> There is a famous book by Fred Brooks called "The Mythical Man-Month",
> and one of its chapters is called "Plan to Throw One Away":
>
> https://wiki.c2.com/?PlanToThrowOneAway
>
> I took that slogan seriously. Most of the time when I realized that
> something that I was doing by hand could be automated I would write a
> first attempt to automate it - _as a prototype_, that I regarded
> partly a program and partly as a way to help me think how that task
> could be structured, and that would probably be "thrown away" if I
> needed a cleaner solution later.
>
> In Forth it was very easy to implement both strange interfaces and
> little languages, in this sense:
>
> https://wiki.c2.com/?LittleLanguage
>
> In Emacs less so, but I could still do lots of funny things using
> eval-last-sexp to use sexps as buttons.
>
> When we are writing throwaway code "planning to throw one away" then
> using tests in comments is a very good way to document the code. And
> when I rewrite my prototypes I usually prefer to document them using
> text ***AND*** executable examples rather than just text. One of the
> effects of using this style is that the users of eev see that they can
> use that style in their notes too - and with that their notes become
> much closer to being "executable notes", in this sense,
>
> http://angg.twu.net/eev-intros/find-here-links-intro.html
>
> than they would be if they believed that they had to write the docs of
> their functions as just text.
>
> You are sort of saying that having tests in comments is bad style.
> Well, it's not. =/
>
> [[]],
> Eduardo Ochs
> http://angg.twu.net/#eev
>
[-- Attachment #2: Type: text/html, Size: 6112 bytes --]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-26 18:23 ` Robert Weiner
2022-06-26 19:45 ` Eduardo Ochs
@ 2022-09-27 14:16 ` Jean Louis
1 sibling, 0 replies; 33+ messages in thread
From: Jean Louis @ 2022-09-27 14:16 UTC (permalink / raw)
To: rswgnu; +Cc: Eduardo Ochs, Org Mode
* Robert Weiner <rsw@gnu.org> [2022-06-26 21:25]:
> I took a brief look today at some of the code in the latest packaged
> release of eev from ELPA, as well as a bit at some of your email archives
> and video links. What I see is that you like things extraordinarily
> concrete and packages like Hyperbole and Org try to build up generalized
> abstractions that can be used in many contexts. When you try to break down
> how these abstractions work at the very low-level concrete mental model you
> like, you find them too complex and therefore have to set them aside. If
> you can't bend on that, then I think your choice is right, to just build
> large amounts of low-level code that meets your needs. I think the way you
> archive long lists of hyperlinks into videos for every few words spoken in
> the video speaks to this style. I see the utility but this is not a common
> style or need.
Let me add some new view point on that. What is common is not
necessarily what advances access to knowledge. If we think of children
who did not yet learn multiplication table, their common level of
knowledge is what it is. But once they learn multiplication table they
get empowered for life.
Finely grained information management systems are empowerment for
human. It is quite clear that minority of people will use such
systems, just as it is clear that advanced search engine features will
be used just by minority of people.
Computer programs are there to advanced human, not to keep them on the
level where they are. Though majority of corporations want exactly
that, keep the computer user entertained, not knowing the power that
one may gain.
In general, everybody has general benefit of knowledge and access to
knowledge. And in general not everybody will be able to access it.
That howevever shall not stop us of inventing new systems that are of
benefit for human.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-27 0:49 ` Robert Weiner
2022-06-27 3:48 ` Eduardo Ochs
2022-06-28 4:48 ` Eduardo Ochs
@ 2022-09-27 14:43 ` Jean Louis
2 siblings, 0 replies; 33+ messages in thread
From: Jean Louis @ 2022-09-27 14:43 UTC (permalink / raw)
To: rswgnu; +Cc: Eduardo Ochs, Org Mode
* Robert Weiner <rsw@gnu.org> [2022-06-27 03:51]:
> (defun youtube-url-from-time (video-link time-string)
> "Given a VIDEO-LINK and a colon-separated TIME-STRING, e.g. 2:44 (two
> minutes, 45 seconds into the video), return the url to play from that point
> in the video.
> Return nil if TIME-STRING is invalid."
> (when (setq time-string (youtube-normalize-time time-string))
> (format "%s&t=%s"
> (youtube-normalize-link video-link)
> time-string)))
Thanks for functions, I will not them down. I was collecting YouTube
video links directly from YouTube, so they look like:
Dog stands up:
https://youtu.be/LtCmlyKxKUU?t=384
And I can use your functions to improve system later.
> Then once you load the Hyperbole package, in any buffer you could use any
> of the 3 buttons below which all do the same thing when pressed upon with
> the Action Key, {M-RET}:
>
> <youtube-play-from-time "WKwZHSbHmPg" "2:44">
> <youtube-play-from-time "www.youtube.com/watch?v=WKwZHSbHmPg" "2:44">
> <youtube-play-from-time "https://www.youtube.com/watch?v=WKwZHSbHmPg"
> "2:44">
I have totally got the idea how it is analogue to eev styles of
links. What bothers me is the fact that links are ugly and not user
friendly. I would prefer some interpolation like Org does it with Org
links, so that links are shown as their names:
- Instruction on how to break the egg, cleaning of eggs;
- Using glass edge to break the egg;
Something like that, hyperlinked, in every buffer.
> an implicit button type that recognized strings like "yt:WKwZHSbHmPg@2:44"
> and invoked the calls shown above.
Just that it does not look nice. It misses the "name" part of the
link, just as in HTML. We shall work towards better representation of
links.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-06-28 4:43 ` Eduardo Ochs
@ 2022-09-27 15:10 ` Jean Louis
2022-09-27 16:22 ` Eduardo Ochs
0 siblings, 1 reply; 33+ messages in thread
From: Jean Louis @ 2022-09-27 15:10 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Robert Weiner, emacs-org list
* Eduardo Ochs <eduardoochs@gmail.com> [2022-06-28 09:54]:
> with hyperbole-mode active... my notes are here - for the sake of
> completeness; I don't expect them to be readable -
>
> (code-c-d "hyperbole" "~/.emacs.d/elpa/hyperbole-8.0.0/")
> (require 'hyperbole)
> (hyperbole-mode 0)
> (find-hyperbolefile "DEMO")
> (find-hyperbolefile "DEMO" "Action Key is {M-RET}")
I like that link above. Though I would like to see it a "Action Key is
{M-RET}" so is there a way or some general font lock package that can
make links similar like in Org mode but for all kinds of links, so
that links is hidden and name shown?
I would need that. This is great link:
(find-hyperbolefile "DEMO" "Action Key is {M-RET}")
But would not be better to have something like:
"Hyperbole's __action key is M-RET__ so try it out" without the actual
link there?
I tend towards interpolation, so that links like ⟦ (link 123) ⟧ are
just numbers, but shown as their names as the number is related to
name in the database.
Do you have way to go for something like that?
> (find-efunction 'action-key-internal)
> (find-efunction 'hkey-execute)
> (find-efunction 'hkey-execute "hkey-alist")
> (find-evardescr 'hkey-alist)
The way how you have listed it above is insightful. I get the
instructions and I get the point. It is way of teaching.
It can be done by any means, Org, eev, Hyperbole. Though one so
important part is missing, the presentation of links. It is cryptic.
Instead of:
> (find-evardescr 'hkey-alist)
I would like to see visually:
"Description of Emacs Lisp function `hkey-alist'"
What is really good is accessibility, I can click M-e or M-k to go
back, great. That is power. Similarly in Hyperbole, it is M-RET.
> (find-eppp hkey-alist)
> (find-eppp hkey-alist "(hbut:at-p)")
> (find-evariable 'hkey-alist)
> (find-evariable 'hkey-alist "If on a Hyperbole button")
> (find-evariable 'hkey-alist "If on a Hyperbole button" "(hbut:at-p)")
> (find-efunction 'hbut:at-p)
There must be some way of quickly generating above links, do you have
such?
Let us say you are in buffer A, you go to Emacs Lisp file at line 134, and
you just press there a key, and link is inserted in buffer A, leading
to Emacs Lisp file at line 134, you have that?
> (eek "2*<down> C-e <left>")
> (eek "<down> C-e <left> M-RET")
> <insert "foo">
Now you got it. I was following 90%
> Anyway, we are clearly using different notions of simplicity - see:
>
> https://lists.gnu.org/archive/html/hyperbole-users/2020-09/msg00013.html
>
> and I find it enviable that you can have that kind of complexity under
> the hood and still have lots of users that agree that Hyperbole is
> "simple"...
It is because users do not care what is under the hood...
But now we have various information management systems, and I would
like to get general Org-like presentation for any kind of links.
Does such package exist already? Do we really need to make it new for
each package?
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-27 15:10 ` Jean Louis
@ 2022-09-27 16:22 ` Eduardo Ochs
2022-09-27 21:16 ` Jean Louis
0 siblings, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-09-27 16:22 UTC (permalink / raw)
To: Eduardo Ochs, Robert Weiner, emacs-org list
On Tue, 27 Sept 2022 at 12:11, Jean Louis <bugs@gnu.support> wrote:
> (...)
Hi Jean Louis,
> Instead of:
>
> > (find-evardescr 'hkey-alist)
>
> I would like to see visually:
>
> "Description of Emacs Lisp function `hkey-alist'"
In cases like that there would be some key sequence that parses the
text and the text properties around point and produces a sexp that
goes to the target of the link when executed. Let me call that sexp
the "back-end" of the link.
I did play with some ways to buttonize back-end sexps, and with some
ways to parse the text around point to generate these back-end sexps,
but I didn't find those things much fun, and in all the cases I ended
up finding nice ways to solve my problems with just explicit sexps,
without hiding them behind a title. So I postponed the problem behind
your question - and I will deal with it again when someone who wants
"back-end sexps hidden behind titles" asks me for help, or asks me to
work together on their ideas.
> There must be some way of quickly generating above links, do you have
> such?
>
> Let us say you are in buffer A, you go to Emacs Lisp file at line 134, and
> you just press there a key, and link is inserted in buffer A, leading
> to Emacs Lisp file at line 134, you have that?
Yes, and I am working in a way to do that that requires fewer keys. I
submitted it to the EmacsConf2022:
http://angg.twu.net/emacsconf2022-kla.html
and I am asking my friends to test it. I haven't made commented
screenshots for it - like these ones:
http://angg.twu.net/eepitch.html#test-blocks
yet, so right now the best way to understand how it works is to try
the "Try:"s in the sections 1 and 8 of its docs:
http://angg.twu.net/eev-current/eev-kla.el.html#intro
Cheers,
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-27 16:22 ` Eduardo Ochs
@ 2022-09-27 21:16 ` Jean Louis
2022-09-27 21:58 ` Jean Louis
2022-09-28 3:52 ` Ihor Radchenko
0 siblings, 2 replies; 33+ messages in thread
From: Jean Louis @ 2022-09-27 21:16 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Robert Weiner, emacs-org list
[-- Attachment #1: Type: text/plain, Size: 2827 bytes --]
* Eduardo Ochs <eduardoochs@gmail.com> [2022-09-27 20:22]:
> On Tue, 27 Sept 2022 at 12:11, Jean Louis <bugs@gnu.support> wrote:
> > (...)
>
> Hi Jean Louis,
>
> > Instead of:
> >
> > > (find-evardescr 'hkey-alist)
> >
> > I would like to see visually:
> >
> > "Description of Emacs Lisp function `hkey-alist'"
>
> In cases like that there would be some key sequence that parses the
> text and the text properties around point and produces a sexp that
> goes to the target of the link when executed. Let me call that sexp
> the "back-end" of the link.
I was thinking only the display would be different while link would be
hidden. Just like Org links.
> I did play with some ways to buttonize back-end sexps, and with some
> ways to parse the text around point to generate these back-end sexps,
> but I didn't find those things much fun, and in all the cases I ended
> up finding nice ways to solve my problems with just explicit sexps,
Yes, you solved problem of hyperlinking, but not of
presentation. While Org has solved it for presentation very well.
I wish to create meta links. Today I have tried figuring out how Org
link work, but I am overwhelmed.
I like to have main source file which can be then converted to many
formats, that way is more creative.
Source file can be viewed or edited, when viewed, it would show links
as presented names. When edited, it could show source links.
But when exported, only names would be exported.
eev links I cannot export into text to be presentable or
understandable.
Right now I have working system where I can insert ⟦ (anything) ⟧ and
in representation it will be shown whatever the function returns
back. It is not a clickable link, rather automatically interpolated
link and displayed as such, but not editable directly.
I have got it working this way:
(defun hyperscope-wrap-eev (name &rest body)
(with-temp-buffer
(insert-text-button name
'action `(lambda (b) ,@body))
(buffer-string)))
Source:
⟦ (hyperscope-wrap-eev "Hyperbole DEMO file" '(find-hyperbolefile "DEMO")) ⟧
Visual representation:
Hyperbole DEMO file
Using enter on the link brings me to DEMO file, I can add mouse later.
It uses RCD Template Interpolation System for Emacs:
https://hyperscope.link/3/7/1/3/3/RCD-Template-Interpolation-System-for-Emacs.html
I could shorten it to:
⟦ (rcd-eev "Hyperbole DEMO file" '(find-hyperbolefile "DEMO")) ⟧
and I guess I could that way insert any of your links. 👀
See attached frameshot how it looks like.
Because you are generating buffers on the fly, your, mine and
Hyperbole system would benefit of visual representation of hyperlinks
just as Org does it.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
[-- Attachment #2: Screenshot-2022-09-28-00-11-30-710565620.png --]
[-- Type: image/png, Size: 99151 bytes --]
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-27 21:16 ` Jean Louis
@ 2022-09-27 21:58 ` Jean Louis
2022-09-28 0:52 ` Eduardo Ochs
2022-09-28 3:52 ` Ihor Radchenko
1 sibling, 1 reply; 33+ messages in thread
From: Jean Louis @ 2022-09-27 21:58 UTC (permalink / raw)
To: Eduardo Ochs, Robert Weiner, emacs-org list
* Jean Louis <bugs@gnu.support> [2022-09-28 00:20]:
> Source:
>
> ⟦ (hyperscope-wrap-eev "Hyperbole DEMO file" '(find-hyperbolefile "DEMO")) ⟧
>
> Visual representation:
>
> Hyperbole DEMO file
>
> Using enter on the link brings me to DEMO file, I can add mouse later.
I guess you could re-write the function that wraps your link to
temporarily something else that extracts '(find-hyperbolefile "DEMO")
and runs it with M-e
But once links are displayed as underline hyperlinks, your M-e would
need to search into properties to activate the link.
(hyperscope-capture-buffer) is my function that sorts buffer into
Hyperscope database.
Doing M-e on the below, inserts the link on bottom.
(hyperscope-capture-buffer-insert-hyperlink)
In the next step I could interpolate the text and get the actual
visible and clickable link at bottom, pointing to set of notes
or note we talked about.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
⟦ (hyperscope-link 72826) ⟧
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-27 21:58 ` Jean Louis
@ 2022-09-28 0:52 ` Eduardo Ochs
2022-09-28 6:04 ` Jean Louis
0 siblings, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-09-28 0:52 UTC (permalink / raw)
To: Eduardo Ochs, Robert Weiner, emacs-org list
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
⟦ (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")) ⟧
Let me play with this idea for a bit - I'll send some code as soon as
possible!
Cheers =),
Eduardo
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-27 21:16 ` Jean Louis
2022-09-27 21:58 ` Jean Louis
@ 2022-09-28 3:52 ` Ihor Radchenko
2022-09-28 9:16 ` Jean Louis
1 sibling, 1 reply; 33+ messages in thread
From: Ihor Radchenko @ 2022-09-28 3:52 UTC (permalink / raw)
To: Jean Louis; +Cc: Eduardo Ochs, Robert Weiner, emacs-org list
Jean Louis <bugs@gnu.support> writes:
> I wish to create meta links. Today I have tried figuring out how Org
> link work, but I am overwhelmed.
Have you looked at
https://orgmode.org/manual/Adding-Hyperlink-Types.html ?
If you find it confusing, please let us know.
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-28 0:52 ` Eduardo Ochs
@ 2022-09-28 6:04 ` Jean Louis
2022-09-28 10:15 ` Eduardo Ochs
0 siblings, 1 reply; 33+ messages in thread
From: Jean Louis @ 2022-09-28 6:04 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Robert Weiner, emacs-org list
* 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) ⟧
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-28 3:52 ` Ihor Radchenko
@ 2022-09-28 9:16 ` Jean Louis
2022-09-29 4:07 ` Ihor Radchenko
0 siblings, 1 reply; 33+ messages in thread
From: Jean Louis @ 2022-09-28 9:16 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Eduardo Ochs, Robert Weiner, emacs-org list
* Ihor Radchenko <yantar92@gmail.com> [2022-09-28 06:52]:
> Jean Louis <bugs@gnu.support> writes:
>
> > I wish to create meta links. Today I have tried figuring out how Org
> > link work, but I am overwhelmed.
>
> Have you looked at
> https://orgmode.org/manual/Adding-Hyperlink-Types.html ?
>
> If you find it confusing, please let us know.
That relates to adding different type of Org links. What I am looking
for is generic way of displaying links and not displaying links
similar to Org links, so that I can add any type of links beyond Org
links.
Let us say that link is:
(link "Duck" (browse-url "http://www.duckduckgo.com"))
such link should be displyed as:
__Duck__ (underlined)
but just as in Org mode to have toggle options descriptive or
non-descriptive links.
and that I can inject the format of the link like parenthesis and
simple into such generic way of making links. It would go beyond Org
that way and be available in any modes.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-28 6:04 ` Jean Louis
@ 2022-09-28 10:15 ` Eduardo Ochs
2022-09-29 9:22 ` Jean Louis
2022-09-29 9:42 ` Jean Louis
0 siblings, 2 replies; 33+ messages in thread
From: Eduardo Ochs @ 2022-09-28 10:15 UTC (permalink / raw)
To: Eduardo Ochs, Robert Weiner, emacs-org list
On Wed, 28 Sept 2022 at 03:17, Jean Louis <bugs@gnu.support> wrote:
> (...)
Hi Jean Louis,
I am not sure how to interpret the tone of your message. Does it mean
that you are not interested in a prototype that works in one case?
I.e., that you are only interested in something that has all the
flexibility that you need?
> 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.
You're hiding the technical details, and I don't know how to think in
these terms, sorry! =(
For me your "non-Org link" is a string composed of a few substrings
concatenated, and each of these substrings is either without text
properties or is built using "propertize" or "buttonize". In this
message
https://lists.gnu.org/archive/html/emacs-orgmode/2022-09/msg00725.html
I referred to those substrings as "subsegments", but I don't know what
is the correct term.
I am trying to factor your problem into several small functions in a
way that makes each of these small functions easy to test - with
one-liners if possible, like I do in the eev source code - and if we
do that factoring then the function that builds the "string composed
of a few substrings concatenated" that I mentioned above will not call
your rcd-template-eval and will not depend on the major mode...
I have the impression that the hard part _now_ is to write that
function that produces that string with text properties. Once we have
that we will have a clearer notion of what are the "non-Org links"
that we are dealing with, and it will be easier to think on the other
functions.
By the way, I mentioned here
https://lists.gnu.org/archive/html/emacs-orgmode/2022-09/msg00725.html
that the simple Org link that I inspected had about 8 subsegments with
different text properties... Org links need all that because they have
to handle correctly insertions and deletions at several points,
cutting and pasting, "following", conversion to fundamental mode, etc,
etc... I have the impression that we can start with a prototype in
which our prototype-ish non-Org links have only three subsegments, but
you will have to accept that in that prototype the links won't have
all the features that you want...
Cheers,
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-28 9:16 ` Jean Louis
@ 2022-09-29 4:07 ` Ihor Radchenko
2022-09-29 9:59 ` Jean Louis
0 siblings, 1 reply; 33+ messages in thread
From: Ihor Radchenko @ 2022-09-29 4:07 UTC (permalink / raw)
To: Jean Louis; +Cc: Eduardo Ochs, Robert Weiner, emacs-org list
Jean Louis <bugs@gnu.support> writes:
> Let us say that link is:
>
> (link "Duck" (browse-url "http://www.duckduckgo.com"))
>
> such link should be displyed as:
>
> __Duck__ (underlined)
>
> but just as in Org mode to have toggle options descriptive or
> non-descriptive links.
>
> and that I can inject the format of the link like parenthesis and
> simple into such generic way of making links. It would go beyond Org
> that way and be available in any modes.
org-open-at-point-global can work outside Org to open Org links.
For Org-like fontification, you can add an entry to font-lock-keywords
that will fontify anything matching org-link-any-re and apply
org-activate-links. However, you may need to rewrite org-activate-link
to work outside Org mode. It should not be prohibitively hard.
(I suspect that Hyperbole could be the right place to request the
fontification feature - they already take care about fontification of
implicit buttons; may as well extend it)
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-28 10:15 ` Eduardo Ochs
@ 2022-09-29 9:22 ` Jean Louis
2022-10-08 0:28 ` Eduardo Ochs
2022-09-29 9:42 ` Jean Louis
1 sibling, 1 reply; 33+ messages in thread
From: Jean Louis @ 2022-09-29 9:22 UTC (permalink / raw)
To: Eduardo Ochs, Robert Weiner, emacs-org list
I am definitely interested, make prototype please. Just can't answer properly on travel.
Jean
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-28 10:15 ` Eduardo Ochs
2022-09-29 9:22 ` Jean Louis
@ 2022-09-29 9:42 ` Jean Louis
2022-09-29 11:55 ` Quiliro Ordóñez
1 sibling, 1 reply; 33+ messages in thread
From: Jean Louis @ 2022-09-29 9:42 UTC (permalink / raw)
To: emacs-orgmode
On September 28, 2022 10:15:06 AM UTC, Eduardo Ochs <eduardoochs@gmail.com> wrote:
>> 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.
>
>You're hiding the technical details, and I don't know how to think in
>these terms, sorry! =(
Not hiding at all. If I would know technical details I would not need it. I have you examples with your links and wrapping then with name for link.
>For me your "non-Org link" is a string composed of a few substrings
>concatenated, and each of these substrings is either without text
>properties or is built using "propertize" or "buttonize". In this
>message
I don't think that way, that would make links specific just as they are specific in Org mode.
To make links not specific, but to liberate then from any mode, one would need to forget how link looks like inside some brackets and leave it to whatever function to interpolate itself into a button or anything else.
Did you try my interpolation package? It can already do that. But how can I read from properties and get back what was the link before? That is what I don't know how. And my way of doing links it is totally out of any frame I have seen before.
https://lists.gnu.org/archive/html/emacs-orgmode/2022-09/msg00725.html
There shall be no parsing of the link as that would make the link specific again.
If we make generic package than anybody else later will benefit. Generic links package is not tied to how link looks like, not tied to any function.
On the link above I my example.
Imagine (ln "name" (eev-funct do)) that would Interpolate to "name", but also {{{ name link }}} to to interpolate to something, and what does interpolation should be left to programmer.
Imagine having X+ of documents, and your link name is "New Yrk" mistakenly, by using generic approach one can keep the name outside of the document, correct it and in all documents it get corrected upon invocation or opening of it.
I use that system to inject my contact details, no matter if contact details change, I need not correct theđ one by one.
>I am trying to factor your problem into several small functions in a
>way that makes each of these small functions easy to test - with
>one-liners if possible, like I do in the eev source code - and if we
>do that factoring then the function that builds the "string composed
>of a few substrings concatenated" that I mentioned above will not call
>your rcd-template-eval and will not depend on the major mode...
I don't think that parsing strings make it generic.
Template Interpolation system makes it generic.
What has to be solved is how to insert the button so that it may be reversed into what it was before.
>I have the impression that the hard part _now_ is to write that
>function that produces that string with text properties.
I have used insert button function.
> Once we have
>that we will have a clearer notion of what are the "non-Org links"
>that we are dealing with, and it will be easier to think on the other
>functions.
Those generic links can as well become Org like links as there is no limitations.
Jean
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-29 4:07 ` Ihor Radchenko
@ 2022-09-29 9:59 ` Jean Louis
0 siblings, 0 replies; 33+ messages in thread
From: Jean Louis @ 2022-09-29 9:59 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Eduardo Ochs, Robert Weiner, emacs-org list
I will see how to implement this, thank you
On September 29, 2022 4:07:15 AM UTC, Ihor Radchenko <yantar92@gmail.com> wrote:
>Jean Louis <bugs@gnu.support> writes:
>
>> Let us say that link is:
>>
>> (link "Duck" (browse-url "http://www.duckduckgo.com"))
>>
>> such link should be displyed as:
>>
>> __Duck__ (underlined)
>>
>> but just as in Org mode to have toggle options descriptive or
>> non-descriptive links.
>>
>> and that I can inject the format of the link like parenthesis and
>> simple into such generic way of making links. It would go beyond Org
>> that way and be available in any modes.
>
>org-open-at-point-global can work outside Org to open Org links.
>
>For Org-like fontification, you can add an entry to font-lock-keywords
>that will fontify anything matching org-link-any-re and apply
>org-activate-links. However, you may need to rewrite org-activate-link
>to work outside Org mode. It should not be prohibitively hard.
>
>(I suspect that Hyperbole could be the right place to request the
>fontification feature - they already take care about fontification of
>implicit buttons; may as well extend it)
Jean
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-29 9:42 ` Jean Louis
@ 2022-09-29 11:55 ` Quiliro Ordóñez
0 siblings, 0 replies; 33+ messages in thread
From: Quiliro Ordóñez @ 2022-09-29 11:55 UTC (permalink / raw)
To: emacs-orgmode
El 2022-09-29 04:42, Jean Louis escribió:
> On September 28, 2022 10:15:06 AM UTC, Eduardo Ochs
> <eduardoochs@gmail.com> wrote:
>
>>> 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.
>>
>>You're hiding the technical details, and I don't know how to think in
>>these terms, sorry! =(
>
> Not hiding at all. If I would know technical details I would not need
> it. I have you examples with your links and wrapping then with name
> for link.
>
>>For me your "non-Org link" is a string composed of a few substrings
>>concatenated, and each of these substrings is either without text
>>properties or is built using "propertize" or "buttonize". In this
>>message
>
> I don't think that way, that would make links specific just as they
> are specific in Org mode.
>
> To make links not specific, but to liberate then from any mode, one
> would need to forget how link looks like inside some brackets and
> leave it to whatever function to interpolate itself into a button or
> anything else.
>
> Did you try my interpolation package? It can already do that. But how
> can I read from properties and get back what was the link before? That
> is what I don't know how. And my way of doing links it is totally out
> of any frame I have seen before.
> https://lists.gnu.org/archive/html/emacs-orgmode/2022-09/msg00725.html
>
> There shall be no parsing of the link as that would make the link
> specific again.
>
> If we make generic package than anybody else later will benefit.
> Generic links package is not tied to how link looks like, not tied to
> any function.
>
> On the link above I my example.
>
> Imagine (ln "name" (eev-funct do)) that would Interpolate to "name",
> but also {{{ name link }}} to to interpolate to something, and what
> does interpolation should be left to programmer.
>
> Imagine having X+ of documents, and your link name is "New Yrk"
> mistakenly, by using generic approach one can keep the name outside of
> the document, correct it and in all documents it get corrected upon
> invocation or opening of it.
>
> I use that system to inject my contact details, no matter if contact
> details change, I need not correct theđ one by one.
>
>>I am trying to factor your problem into several small functions in a
>>way that makes each of these small functions easy to test - with
>>one-liners if possible, like I do in the eev source code - and if we
>>do that factoring then the function that builds the "string composed
>>of a few substrings concatenated" that I mentioned above will not call
>>your rcd-template-eval and will not depend on the major mode...
>
> I don't think that parsing strings make it generic.
>
> Template Interpolation system makes it generic.
>
> What has to be solved is how to insert the button so that it may be
> reversed into what it was before.
>
>>I have the impression that the hard part _now_ is to write that
>>function that produces that string with text properties.
>
> I have used insert button function.
>
>> Once we have
>>that we will have a clearer notion of what are the "non-Org links"
>>that we are dealing with, and it will be easier to think on the other
>>functions.
>
> Those generic links can as well become Org like links as there is no
> limitations.
>
>
> Jean
It is not clear which parts of the message are Jean's and which are
Eduardo's. Not that the messenger is important to side with the
message. But that the message is understood better when it is related
to the perspective that the messenger has.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-09-29 9:22 ` Jean Louis
@ 2022-10-08 0:28 ` Eduardo Ochs
2022-10-08 1:25 ` Jean Louis
0 siblings, 1 reply; 33+ messages in thread
From: Eduardo Ochs @ 2022-10-08 0:28 UTC (permalink / raw)
To: Jean Louis; +Cc: Robert Weiner, emacs-org list
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... =(
[[]],
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-10-08 0:28 ` Eduardo Ochs
@ 2022-10-08 1:25 ` Jean Louis
2022-10-11 2:42 ` Robert Weiner
0 siblings, 1 reply; 33+ messages in thread
From: Jean Louis @ 2022-10-08 1:25 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: Robert Weiner, emacs-org list
* 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/
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-10-08 1:25 ` Jean Louis
@ 2022-10-11 2:42 ` Robert Weiner
2022-10-11 4:59 ` Jean Louis
0 siblings, 1 reply; 33+ messages in thread
From: Robert Weiner @ 2022-10-11 2:42 UTC (permalink / raw)
To: Jean Louis; +Cc: Eduardo Ochs, emacs-org list
Hi Jean:
I know this does not address everything you want but if you leverage Hyperbole’s capabilities, you’ll probably be able to get what you want with a lot less code.
First, creating an explicit button displays only the button name as you like, fontified as you like, and with the button action hidden. So then you need to write a function that adds or removed the button action from the buffer when you want to see it, utilizing existing Hyperbole code from the actype or action class for manipulating actions.
For your generalized syntax, I think you would be better off using the angle brackets of Hyperbole’s action buttons but you could instead use the defil macro to create your own link button type and delimiter format with just a few lines of code. Just follow the example in the docstring for that macro.
Org probably has similar capabilities with its link types though not as flexible with the syntax.
-- rsw
> On Oct 8, 2022, at 1:00 AM, Jean Louis <bugs@gnu.support> wrote:
>
> * 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/
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: Org, Hyperbole, and eev
2022-10-11 2:42 ` Robert Weiner
@ 2022-10-11 4:59 ` Jean Louis
0 siblings, 0 replies; 33+ messages in thread
From: Jean Louis @ 2022-10-11 4:59 UTC (permalink / raw)
To: Robert Weiner; +Cc: Eduardo Ochs, emacs-org list
* Robert Weiner <rswgnu@gmail.com> [2022-10-11 05:43]:
> I know this does not address everything you want but if you leverage
> Hyperbole’s capabilities, you’ll probably be able to get what you
> want with a lot less code.
What I want is to be able to interpolate links like: ⟦ (some-link) ⟧ on
the fly similarly Org links, in such way that whatever function
`some-link' returns it would be displayed on its place. Function may
return string or string as button or anything else. Then similarly to
org-toggle-link-display I wish to fontify such buttons in editable
buffer and be able to reverse it back. I guess for that to work text
properties shall be able to remember the button ⟦ (some-link) ⟧. But I
do not know much about it, I am learning.
I already use that system though not in editing mode. I have editing
more wher I can see ⟦ something ⟧ and I have presentation mode, where
source is interpolated on the fly and I can see interpolated values or
button links.
System of interpolation spare me time.
> First, creating an explicit button displays only the button name as
> you like, fontified as you like, and with the button action hidden.
> So then you need to write a function that adds or removed the button
> action from the buffer when you want to see it, utilizing existing
> Hyperbole code from the actype or action class for manipulating
> actions.
> For your generalized syntax, I think you would be better off using
> the angle brackets of Hyperbole’s action buttons but you could
> instead use the defil macro to create your own link button type and
> delimiter format with just a few lines of code. Just follow the
> example in the docstring for that macro.
I already use Hyperbole on links like ⟦ (rcd-db-tabulated-edit-entry "people" 1) ⟧
or ⟦ (hyperscope-action 587) ⟧ (the last one brings me to mail mode
with prepared email headers writing email).
It is not hard:
(defil rcd-template-eval "⟦ " " ⟧" ".*" "{M-: \\& RET}")
I can use command to interpolate the source and present it. It works
well. Editing in the same time with interpolated links is what I
miss. That I have in Org mode, but links miss dynamic capacity.
> Org probably has similar capabilities with its link types though not
> as flexible with the syntax.
I would use Org buttons, but they do not have disappearing or dynamic
capacity.
Text could have Hyperlinks, and be well referenced that way. In export
or interpolating mode, depending of the export type or major mode,
hyperlinks themselves may decide how to interpolate, if to disappear
from text, or if to convert themselves into Org links or into HTML
links, Markdown links, or Emacs links.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2022-10-11 6:14 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.