Re: Bidirectional links with eev

2022-10-01 Thread Eduardo Ochs
On Fri, 30 Sept 2022 at 09:49, Erich Ruff  wrote:
> (...)

Hi Erich!

> In the meentime I began writing my book and using this technique very
> intensely and habe more than 100 books to which I can jump with short
> expressions like
>
> (ga101p ( + 16 127))
>
> which will open Akademieausgabe of Fichtes Werken, Abt. I , Band 1,
> Seite 127 with an offset of 16, thus excluding the forword of the
> editors

That's fantastic! Thanks for telling! =)

> You have to create the eev-vars for the 2 docs first:
>
> so you have to execute first:
>
> doc1:  (code-c-d "sw2" "/mnt/fichte/" :anchor)
> doc2:  (code-c-d "fall" "/home/er/fo/denote/" :anchor)
>
> after having these two VARs set and the code executed the bidirectional
> link-creation works --
>
> but only if the cursors are positioned after the «anchor1»  in doc 1 and
> «anchor2»  in doc 2 which should be connected to oneanother.
>
> Perhaps this help some other user?

To docs are still very preliminary - I still need to rewrite them
almost completely a few more times... in particular, I implemented
this feature:

  (find-eev "eev-kla.el" "guess")
  http://angg.twu.net/eev-current/eev-kla.el.html#guess

only five days ago, and I need to reorder the docs to make them treat
that method of choosing a preferred "c" by "guessing" the main one,
and treat the method that uses dir-local variables as something for
experts...

About the feature requests:

> 1) Could you add an automatically inserted comment for LaTeX-files too? -> %%
> double %%  to easly disguish added links

This is partially explained in this section:

  (find-eevfile "eev-kla.el" "10. Bidirectional links")
  (find-eevfile "eev-kla.el"   "2. The comment prefix")
  (find-eevfile "eev-kla.el"   "3. The command `M-x kli'")

The comment prefix can only be added when the link is inserted,
because it depends on the buffer in which the sexp is being inserted,
and it is added by `M-x kli'/`M-x ee-kl-insert'.

The comment prefix is determined by these functions,

  ;; «ee-kl-format2»  (to ".ee-kl-format2")
  ;; «ee-kl-insert»  (to ".ee-kl-insert")
  ;; Test: (ee-kl-format2-for-mode)
  ;;
  (defun ee-kl-format2-for-mode ( mode)
(let ((plist '(emacs-lisp-mode ";; %s"
   haskell-mode"-- %s"
   lua-mode"-- %s"
   python-mode "# %s"
   agda2-mode  "-- %s"
   latex-mode  "%% %s")))
  (plist-get plist (or mode major-mode

  (defun ee-kl-format2 (str)
(format (or ee-kl-format2 (ee-kl-format2-for-mode) "%s") str))

  ;; Used by `M-x kli'
  (defun ee-kl-insert ( str)
(interactive)
(let* ((str1 (or str (car kill-ring)))
   (str2 (ee-kl-format2 str1)))
  (insert str2)))

and as this is a prototype 1) the function `ee-kl-format2-for-mode' is
intended to be overriden by the user, 2) I forgot to explain this in
the code! =( So one way to use "%%" instead of "%" in LaTeX files is
to redefine `ee-kl-format2-for-mode' to:

  (defun ee-kl-format2-for-mode ( mode)
(let ((plist '(emacs-lisp-mode ";; %s"
   haskell-mode"-- %s"
   lua-mode"-- %s"
   python-mode "# %s"
   agda2-mode  "-- %s"
   latex-mode  " %s")))
  (plist-get plist (or mode major-mode

> 2) In your example you have the 2 docs in a splitted frame with two
> windows side by side in emacs
>
> if I jump via link from doc 2 to doc 1 then doc 1  is opened in window-2
> so I have the same file opened in 2 windows and the doc 2 is gone.

I usually use `M-2 M-e' and `M-3 M-e' to open targets of links at the
window at the right. They are explained here:

  (find-efunctiondescr 'ee-eval-sexp-eol "2:")
  (find-efunctiondescr 'ee-eval-sexp-eol "3:")
  (find-efunction 'ee-eval-last-sexp-2)
  (find-efunction 'ee-eval-last-sexp-3)

They use this:

  (find-multiwindow-intro "2. `find-wset'")
  (find-multiwindow-intro "3. High-level words")
  http://angg.twu.net/eev-intros/find-multiwindow-intro.html#2
  http://angg.twu.net/eev-intros/find-multiwindow-intro.html#3

It is easy - I mean, for people who know all the tricks =/ - to define
variants of `M-2 M-e' and `M-2 M-e' that open the target in the window
at the left. Here's one way to do that:

  (defun ee-eval-last-sexp-25 ()
"Like `M-2 M-e', but shows the target at the left."
(find-wset "13_o" '(ee-eval-last-sexp)))

  (defun ee-eval-last-sexp-35 ()
"Like `M-3 M-e', but shows the target at the left and switches to it."
(find-wset "13_" '(ee-eval-last-sexp)))

> Could it be possible to keep both windws as they are and jump with the link to
> the other window to the requested anchor without opening the doc a
> second tim2??

Yes, but I will need a more precise specification of what is the
three-window setting that you want to have in the end, and I will need
to write a bit on non-trivial code to save the configuration of the
second window in a variable before 

Re: Bidirectional links with eev

2022-09-30 Thread Erich Ruff
Hi Eduardo,

its a long time since we were talking about 'tla'

In the meentime I began writing my book and using this technique very
intensely and habe more than 100 books to which I can jump with short
expressions like

(ga101p ( + 16 127))

which will open Akademieausgabe of Fichtes Werken, Abt. I , Band 1,
Seite 127 with an offset of 16, thus excluding the forword of the
editors

Thank you for your good work done.

---

I read your new feature on double links.

This new feature was understandable for me only after finding out:

You have to create the eev-vars for the 2 docs first:

so you have to execute first:

doc1:  (code-c-d "sw2" "/mnt/fichte/" :anchor)
doc2:  (code-c-d "fall" "/home/er/fo/denote/" :anchor)

after having these two VARs set and the code executed the bidirectional
link-creation works --

but only if the cursors are positioned after the «anchor1»  in doc 1 and
«anchor2»  in doc 2 which should be connected to oneanother.

Perhaps this help some other user?

And then, there are 2 feature-requests:

1) Could you add an automatically inserted comment for LaTeX-files too? -> %%
double %%  to easly disguish added links

This would be very helpful for me.

2) In your example you have the 2 docs in a splitted frame with two
windows side by side in emacs

if I jump via link from doc 2 to doc 1 then doc 1  is opened in window-2
so I have the same file opened in 2 windows and the doc 2 is gone.

Could it be possible to keep both windws as they are and jump with the link to
the other window to the requested anchor without opening the doc a
second tim2??

Or is is my emacs-config which is  the culprit?

---

Question:

In your tutorial you write:
3. Converting `c's to `d's
;; ==
;; Remember that the arguments for a `code-c-d' are called "c" (for
;; "code") and "d" (for "directory"),
;;  ^^
;;  ||
;; 
;;
;; and then we will see that there are two ways to convert the `c'
;; "foo" to its corresponding `d', "/tmp/FOO/":
;;
;;   ee-foodir
;;   ;; --> "/tmp/FOO/"
;;   (ee-foofile "BAR/PLIC/bletch")
;;   ;; --> "/tmp/FOO/BAR/PLIC/bletch"
;;

but the jump-address in case 1 is  a dir
and the jump-address in case 3 is  a file


Hope you get not angry about my long mail

Best

Erich



On Sa 24 Sep 2022 at 02:27, Eduardo Ochs  wrote:

> Hi all,
>
> one of my submissions to the EmacsConf2022 is this one:
>
>   "Bidirectional links with eev"
>   http://angg.twu.net/emacsconf2022-kla.html
>
> Most people who use eev know that _using_ elisp hyperlinks to anchors
> is easy, but the standard method for _creating_ elisp hyperlinks to
> anchor needs lots of keys...
>
> I've been experimenting with a more practical way to create those
> hyperlinks to anchors. We need to set up the variable `ee-preferred-c'
> correctly - and this is tricky - but after that we can type `M-x kla',
> or `M-x ee-kla' (mnemonic: ill ink to nchor), and ta-da, the
> link will be pushed into the kill ring.
>
> There is a tutorial here:
>
>   http://angg.twu.net/eev-current/eev-kla.el.html#intro
>   (find-eev "eev-kla.el" "intro")
>
> I've been using `M-x kla' and its variants `M-x klas', `M-x klf', and
> `M-x klfs' a LOT, and I'm quite happy with them. The tutorial ends
> with a long explanation of the thing that creates "bidirectional
> links" - `M-x kla2' - that is very impressive, but that I don't know
> yet if it's practical.
>
> The version of eev with these new things is already on github, and it
> should enter ELPA in a few hours. Hint: try `M-x eev-version' - it
> should show 20220924.
>
> All feedback would be extremely welcome - including questions and
> complaints!
>
>   Cheers,
> Eduardo Ochs
> http://angg.twu.net/#eev



Re: Bidirectional links with eev

2022-09-26 Thread Quiliro Ordóñez
El 2022-09-26 09:15, Eduardo Ochs escribió:
> On Sun, 25 Sept 2022 at 19:15, Quiliro Ordóñez  wrote:
>> (...)
> 
>> I cannot update to 20220924.  Are you sure it is in ELPA yet?
> 
> The new version is in ELPA now!
> 
>> The other talk is something I would like to attend.  I stil do not
>> understand `M-x kla' yet.
> 
> Hmm... then please upgrade eev and then try the instructions in the
> section "1. Very short introduction" of:
> 
>   (find-eev "eev-kla.el" "intro")
>   http://angg.twu.net/eev-current/eev-kla.el.html#intro
> 
> They just say to type `M-x eekla' in the right place. And then take a
> look at the section 8, that describes variants of `M-x eekla'.


I get it.  It is a two-step method to kill and yank a link to the anchor
(title) and file where we are at.  The rest of the document seems more
complicated to me.  I understand some things.  But others use unknow
commands to me (or I forget them).  I guess I will get used to them
little by little when I read your emails.

I still have pending to use these sexp hyperlinks you use in my real
life.  What most interests me is the autamtion of installation tasks to
have ready scripts to install a certain configuration.  I will search
for these commands for my personal needs and then try to implement them
on eev.

Thank you for your help and patience!



Re: Bidirectional links with eev

2022-09-26 Thread Eduardo Ochs
On Sun, 25 Sept 2022 at 19:15, Quiliro Ordóñez  wrote:
> (...)

> I cannot update to 20220924.  Are you sure it is in ELPA yet?

The new version is in ELPA now!

> The other talk is something I would like to attend.  I stil do not
> understand `M-x kla' yet.

Hmm... then please upgrade eev and then try the instructions in the
section "1. Very short introduction" of:

  (find-eev "eev-kla.el" "intro")
  http://angg.twu.net/eev-current/eev-kla.el.html#intro

They just say to type `M-x eekla' in the right place. And then take a
look at the section 8, that describes variants of `M-x eekla'.

  [[]],
E.



Re: Bidirectional links with eev

2022-09-25 Thread Quiliro Ordóñez
El 2022-09-25 18:05, Eduardo Ochs escribió:
> On Sun, 25 Sept 2022 at 19:15, Quiliro Ordóñez  wrote:
>> (...)
> 
> Hi Quiliro!
> 
> First:
> 
>> I cannot update to 20220924.  Are you sure it is in ELPA yet?
> 
> Ouch! It is not! I'll try to debug that...

I have tried to update since your announcement.  Iam still unable to do
it.


>> For both talks, I suggest to open with a 2 sentence description of what
>> eev is. And then an explanation of the results which are expected from
>> using the tool you are about to present.  These introductions should be
>> understood by anyone, regardless of the experience they have with Emacs
>> or eev.
> 
> The problem is that even after all these years I still don't have a
> good short description of what eev is _that makes sense to most
> people_, and I am still trying to understand why some ideas that are
> totally obvious to me are so hard for other people...

Explaining to someone who does not want to understand is useless.  First
there must be the motivation to understand to put the effort to do it.

> Most people don't understand why I prefer to keep "executable notes of
> everything that I do" in a format that I find easy to read, to edit,
> and to reuse, even when that takes much longer than just installing a
> package and learning a few new keybindings... maybe their notion of
> "fun" is opposite to mine. =S

A good motivation would be to show people how to solve the problems they
have.  Of course that your examples do that.  But until a person knows
how it works, they will not be able to understand how it applies to
their personal problem.  So the solution is to find their problems,
choose one and show them how to solve it.  If it is easy to implement
for that person, it will connect with their motivation.  That will help
them put the effort into learning eev (or any other thing).  eev is just
a tool.  You learn to use a tool when you see the end result in your
mind.

Learning is hard.  Only some people like to learn for the sake of it.  
Most people try to avoid doing hard things.  They would rather be
connected to virtual reality and have it solve everything for them.

>> I do think that key bindings for eev should all share the same prefix
>> keybinding.  It would make it easier to identify it.  Maybe another idea
>> would be to use C-c as is used in org-mode.  I am not sure about the way
>> to solve it, but I have difficulty remembering how to do things in eev.
>> Maybe you have better ideas.
> 
> Here's how I've handled that since the 90s - in a slightly modernized
> version. Suppose that your cheat sheet about things that your are
> currently learning is in a file called ~/LEARNING. Then run this,
> 
>   (defun le () (interactive) (find-fline "~/LEARNING"))
>   (defun ll () (interactive) (find-2a nil '(le)))
>   (defun eejump-26 () (le))
>   (defun eejump-27 () (ll))
> 
> and ta-da: now `M-x le' and `M-2 M-6 M-j' open ~/LEARNING in the
> current window, and `M-x ll' and `M-2 M-7 M-j' open ~/LEARNING in the
> window at the right.
> 
> Does that make sense? Does it look convenient? Or clumsy?

Very much.  Of course that I had to read it from the end to the
beginning to understand it better.  It would be more clear to me this
way:

***
Suppose that you have a cheat sheet about things that your are currently
learning in a file called ~/LEARNING. You could have:
`M-x le' and `M-2 M-6 M-j' open ~/LEARNING in the current window, and
`M-x ll' and `M-2 M-7 M-j' open ~/LEARNING in the window at the right.
You could do it by just runnig this: 
   (defun le () (interactive) (find-fline "~/LEARNING"))
   (defun ll () (interactive) (find-2a nil '(le)))
   (defun eejump-26 () (le))
   (defun eejump-27 () (ll))
***

Described in that order, I found motivation to learn it before the
explaination of how to do it.

On the other hand.  Short descriptions make better tools than deep ones.
 In case someone wants to dive in deeper, they could investigate.  The
important thing is the motivation.



Re: Bidirectional links with eev

2022-09-25 Thread Eduardo Ochs
On Sun, 25 Sept 2022 at 19:15, Quiliro Ordóñez  wrote:
> (...)

Hi Quiliro!

First:

> I cannot update to 20220924.  Are you sure it is in ELPA yet?

Ouch! It is not! I'll try to debug that...

> I do not use Python because I think it is a language which is just a fad
> which will die.  But I think that there are many people that could be
> attracted to eev because it has useful Python hacks.

I use Python very little, and I don't like it. But I think that adding
more Python support to eev will attract good karma...

> For both talks, I suggest to open with a 2 sentence description of what
> eev is. And then an explanation of the results which are expected from
> using the tool you are about to present.  These introductions should be
> understood by anyone, regardless of the experience they have with Emacs
> or eev.

The problem is that even after all these years I still don't have a
good short description of what eev is _that makes sense to most
people_, and I am still trying to understand why some ideas that are
totally obvious to me are so hard for other people...

Here's one example. A few weeks ago I posted this here:

  https://lists.gnu.org/archive/html/eev/2022-09/msg0.html

The discussion on Reddit had a few more comments from both the OP and
me. Here is my last comment there (so far):

  You have some good points. I think that I need to stress in the docs
  that the workflow that I described is only worth the pain when we
  really, really, REALLY want to keep "executable notes" of how to
  obtain a certain window configuration... I prefer this

(defun q2 () (interactive)
  (find-3a '(find-fline "~/2022.2-quadros/")
   '(find-fline "~/2022.2-C2/Makefile")
   '(find-fline "~/2022.2-C3/Makefile")))

  to a macro because it is easier to read, easier to edit, and easier
  to adapt to other tasks than a macro. I have a bunch of things like
  this

(setq last-kbd-macro (kbd "M-h M-2 (find-fline SPC \" 2
M-z : C-y  \"  SPC\n M-z : C-y DEL SPC \" 
M-z = C-y 3 C-k \") C-a  RET"))

  saved in my notes, but usually they become hard to read very
  quickly... while the function q2 above is something that I know that
  I will have to execute hundreds of times in 2022.2 (an academic
  semester) with M-x q2, and that when 2022.2 ends and 2023.1 start I
  will just have to modify it a bit... but most people would prefer to
  do that by using something like ace-window than by writing small
  programs in Lisp.

Most people don't understand why I prefer to keep "executable notes of
everything that I do" in a format that I find easy to read, to edit,
and to reuse, even when that takes much longer than just installing a
package and learning a few new keybindings... maybe their notion of
"fun" is opposite to mine. =S

> I do think that key bindings for eev should all share the same prefix
> keybinding.  It would make it easier to identify it.  Maybe another idea
> would be to use C-c as is used in org-mode.  I am not sure about the way
> to solve it, but I have difficulty remembering how to do things in eev.
> Maybe you have better ideas.

Here's how I've handled that since the 90s - in a slightly modernized
version. Suppose that your cheat sheet about things that your are
currently learning is in a file called ~/LEARNING. Then run this,

  (defun le () (interactive) (find-fline "~/LEARNING"))
  (defun ll () (interactive) (find-2a nil '(le)))
  (defun eejump-26 () (le))
  (defun eejump-27 () (ll))

and ta-da: now `M-x le' and `M-2 M-6 M-j' open ~/LEARNING in the
current window, and `M-x ll' and `M-2 M-7 M-j' open ~/LEARNING in the
window at the right.

Does that make sense? Does it look convenient? Or clumsy?

  Cheers - and more news about kla soon...
[[]], E.



Re: Bidirectional links with eev

2022-09-25 Thread Quiliro Ordóñez
El 2022-09-24 00:27, Eduardo Ochs escribió:
> Hi all,
> 
> one of my submissions to the EmacsConf2022 is this one:
> 
>   "Bidirectional links with eev"
>   http://angg.twu.net/emacsconf2022-kla.html
> 
> Most people who use eev know that _using_ elisp hyperlinks to anchors
> is easy, but the standard method for _creating_ elisp hyperlinks to
> anchor needs lots of keys...
> 
> I've been experimenting with a more practical way to create those
> hyperlinks to anchors. We need to set up the variable `ee-preferred-c'
> correctly - and this is tricky - but after that we can type `M-x kla',
> or `M-x ee-kla' (mnemonic: ill ink to nchor), and ta-da, the
> link will be pushed into the kill ring.
> 
> There is a tutorial here:
> 
>   http://angg.twu.net/eev-current/eev-kla.el.html#intro
>   (find-eev "eev-kla.el" "intro")
> 
> I've been using `M-x kla' and its variants `M-x klas', `M-x klf', and
> `M-x klfs' a LOT, and I'm quite happy with them. The tutorial ends
> with a long explanation of the thing that creates "bidirectional
> links" - `M-x kla2' - that is very impressive, but that I don't know
> yet if it's practical.

I am still a little confused with eev.  But every time I see something
you publish, I understand additional details and are even more impressed
by what eev is, its phylosophy of simplicity and its enourmous potential
for automation of manual tasks.

I like these 5 minute talks.

I do not use Python because I think it is a language which is just a fad
which will die.  But I think that there are many people that could be
attracted to eev because it has useful Python hacks.

The other talk is something I would like to attend.  I stil do not
understand `M-x kla' yet.

For both talks, I suggest to open with a 2 sentence description of what
eev is. And then an explanation of the results which are expected from
using the tool you are about to present.  These introductions should be
understood by anyone, regardless of the experience they have with Emacs
or eev.

I do think that key bindings for eev should all share the same prefix
keybinding.  It would make it easier to identify it.  Maybe another idea
would be to use C-c as is used in org-mode.  I am not sure about the way
to solve it, but I have difficulty remembering how to do things in eev. 
Maybe you have better ideas.

I cannot update to 20220924.  Are you sure it is in ELPA yet?