[Top][All Lists]

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

Re: Bidirectional links with eev

From: Eduardo Ochs
Subject: Re: Bidirectional links with eev
Date: Sat, 1 Oct 2022 11:30:01 -0300

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")

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

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 (&optional 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 (&optional str)
    (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 (&optional 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")

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 running the equivalent to `C-x

> Question:
> In your tutorial you write:
> 3. Converting `c's to `d's
> (...)
> but the jump-address in case 1 is  a dir
> and the jump-address in case 3 is  a file

The variable `ee-foodir' and the function `ee-foofile' are low-level
things that are used in functions like `find-foofile'. I was expecting
that people would figure that out when they read the code shown by:

  (find-code-c-d "foo" "/tmp/FOO/")

By the way, note that

  (find-eev "eev-kla.el" "eekla2")

may not be very useful by itself, but it can be used as an inspiration
for writing variants - for example, a variant that simply inserts a
link to "here" in the current position of the point the other window,
and then goes back...

> Hope you get not angry about my long mail

Not at all! =)

reply via email to

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