[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Examples of use of svg.el?
From: |
Eduardo Ochs |
Subject: |
Re: Examples of use of svg.el? |
Date: |
Sat, 2 Apr 2022 07:46:01 -0300 |
On Fri, 1 Apr 2022 at 22:21, Michael Heerdegen <michael_heerdegen@web.de> wrote:
>
> Calc is a cool interactive Calculator, but IMHO it's not so super useful
> as programming language or for writing scripts, and it seems that's what
> you want to do.
>
> With my current Calc skills I would solve the above task like
>
> ' [x0-1 .. x0+1] RET ; interval
> ' [y0-1 .. y0+1] RET ; ditto
> ' (x-x0)^2 - (y-y0)^2 + 2 ; you could alternatively define a named function
> 3 s t x0 ; set x0 to 3
> 2 s t y0 ; ditto y0 to 2
> M-3 = ; updates topmost 3 stack values with vars
> substituted
> g F ; draw it
Hi Michael,
thanks a lot!!! I found a way to record an interaction with Calc, but
the way to set up the windows is still very fragile. Here is a video,
http://angg.twu.net/eev-videos/2022eev-calc-0.mp4
and here is the code:
(defun eek-at-window (window keyseq)
(save-selected-window
(select-window (get-buffer-window window))
(eek keyseq)))
(defun eec (keyseq) (eek-at-window "*Calculator*" keyseq))
(defun ee-show-calc-windows ()
(interactive)
(find-wset "13o_3o_o"
'(find-ebuffer "*Calculator*")
'(find-ebuffer "*Calc Trail*")))
• (calc) (eek "C-x 3 M-1 M-j")
• (ee-show-calc-windows)
• (eec "' [x0-1 .. x0+1] RET ;; interval")
• (eec "' [y0-1 .. y0+1] RET ;; ditto")
• (eec "' (x-x0)^2 - (y-y0)^2 + 2 RET ;; alt: define a named function")
• (eec "3 s t x0 RET ;; set x0 to 3")
• (eec "2 s t y0 RET ;; set y0 to 2")
• (eec "M-3 = ;; updates topmost 3 stack values with vars substituted")
• (eec "g F ;; draw it")
...it needs to be run from ~/TODO, and it is very fragile. The line
(calc) (eek "C-x 3 M-1 M-j")
will start Calc, and Calc will (usually?) make the frame display the
"*Calculator*" window at the left and the "*Calc Trail*" window at the
right. Then in the `eek' sexp the `C-x 3' splits the "*Calculator*"
window into a left half and a right half, and the `M-1 M-j' makes the
left half visit the file "~/TODO". The
(ee-show-calc-windows)
resizes the windows to make the "~/TODO" window take 50% of the width
of the frame and the window "*Calculator*" and "*Calc Trail*" take 25%
each.
Cheers,
Eduardo Ochs
http://angg.twu.net/#eev