|
From: | Eduardo Ochs |
Subject: | Re: wset for frames |
Date: | Mon, 15 Nov 2021 18:45:13 -0300 |
Hi Eduardo,
its not pressing to answer my mails, if you are tired or have other
urgent things to do - the solution can be simple: let me wait.
Your defun is makeing better use of eevs functions. I didn't know, that
ee-template0 takes literary a template ;-)) though it is named 'template'.
This simplifies the construction a lot - and gives an optical
representation of the template to be inserted. Much better than the long
string I used.
Good to learn from you!
Thanks for your work!
But, I cannot finish my letter w/o a new proposition:
The jumping command M-xxx M-j is very helpfull. Do you see the
possibility to use it with 'wset' too - to get a new frame instead of
getting the actual frame covered with the contents of the jumping
target?
Please don't hurry.
Erich
On Sa 06 Nov 2021 at 03:24, Eduardo Ochs <eduardoochs@gmail.com> wrote:
> Hi Erich,
>
> in older versions of eev I experimented with many different ways
> of writing templates...
>
> Below is my translation of your compose-and-write to my current
> favorite style. One of the things that I like most in it is that
> I can put tests in comments, like in the ";; Test:" line.
>
> ;; Test: (find-estring-elisp (compose-allab "<tla>" "<TLA>" "<fname>"))
> ;;
> (defun compose-allab (tla TLA fname)
> (ee-template0 "
> (defun {tla}x (&rest pos-spec-list)
> (interactive)
> (apply 'find-pdf-txt {fname} pos-spec-list))
>
> (defun {TLA} (&rest pos-spec-list)
> (interactive)
> (find-wset \"F_\" \"{TLA}\" `({tla}x ,@pos-spec-list)))
>
> ;; --------------------------------------------------------------------------------
> "))
>
> (defun compose-and-write (tla TLA fname)
> (insert (compose-allab tla TLA fname)))
>
> Your trick with the split-string in your write-tlas is really
> nice! I would factor your write-tlas in this way to make it
> easier to test and to modify:
>
> (defun write-tlas0 (strx)
> (let* ((tlax (nth 1 (split-string strx)))
> (tla (replace-regexp-in-string "'" "" tlax))
> (TLA (concat (capitalize tla) "x"))
> (fnamex (nth 2 (split-string strx )))
> (fname (replace-regexp-in-string ")" "" fnamex))
> )
> (compose-allab tla TLA fname)))
>
> (defun write-tlas ()
> (interactive)
> (let* ((line (buffer-substring-no-properties (ee-bol) (ee-eol)))
> (allab (write-tlas0 strx)))
> (insert allab)))
>
> What do you think of this?
> Cheers, E. =)
>
> P.S.: I will give a workshop tomorrow and I'm quite tired, so I
> won't wrote more ideas now...
>
> On Fri, 5 Nov 2021 at 05:17, Erich Ruff <erich_ruff@t-online.de> wrote:
>
> Good Morning Eduardo,
>
> you proposed to split my function into 2 and use ee-template0 to
> construct the cmd-lines:
>
> Here is my working solution: (w/o error checking)
> Is this what you meant?
> Do you think the code needs impprovement?
>
> ------------------------------ code begin --------------------
> ;; the cmd-line to parse w/o the comment ';;' is:
> ;; (code-tla-pdf 'fig1 "/mnt/fichte/fuchs_erich-fichte_im_gespraech_1_1762-1798.pdf")
>
> (defun write-tlas ()
> "parse the given code-tla-pdf line"
> (interactive)
> (let* (
> (beg (line-beginning-position))
> (end (line-end-position))
> (strx (buffer-substring-no-properties beg end))
> ;; (strx "code-tla-pdf 'fuch1
> /mnt/fichte/fuchs_erich-fichte_im_gespraech_1_1762-1798.pdf")
> (tlax (nth 1 (split-string strx)))
> (tla (replace-regexp-in-string "'" "" tlax))
> (TLA (concat (capitalize tla) "x"))
> (fnamex (nth 2 (split-string strx )))
> (fname (replace-regexp-in-string ")" "" fnamex))
> )
> ;; (message "%s -- %s -- %s" tla TLA fname)
> (compose-and-write tla TLA fname)
> )
> )
>
> (defun compose-and-write ( tla TLA fname )
> "receive tla TLA and fname from
> parsing function"
> (interactive)
> ;; define all the substrings
> (let* (
> (ia "(interactive)\n")
> (posa "(&rest pos-spec-list")
> (posb "pos-spec-list")
> (posc ",@pos-spec-list)))")
> (apply "(apply 'find-pdf-txt")
> (fwset "(find-wset \"F_\"")
> (xgans "\"" )
> ;; compose the 'tlas' with ee-template0
> (alla (ee-template0 "\n(defun {tla}x {posa} )\n {ia} {apply} {fname} {posb} ))\n"))
> (allb (ee-template0 "\n(defun {TLA} {posa} )\n {ia} {fwset} {xgans}{TLA}{xgans}
> `({tla}x {posc}\n"))
> )
> ;; go down, insert 'tlas' and a final seperating line
> (goto-char (line-end-position))
> (insert "\n")
> (insert alla)
> (insert allb)
> (insert "\n;; ")
> (cl-loop for i from 1 to 80 do (insert "-"))
> (insert "\n\n")
> )
> )
> ------------------------------ code end --------------------
[Prev in Thread] | Current Thread | [Next in Thread] |