On Sat, 24 Feb 2024 at 02:09, Suhail <suh...@bayesians.ca> wrote:

> "Eduardo Ochs" <notificati...@github.com> writes:
>
> > I think that what you are proposing is this:
> >
> >   (defun eepitch-shell-init  () (interactive) (eepitch-shell)
> (eepitch-kill) (eepitch-shell))
>
> Yes, modulo renaming.  The code below allows one to generate the
> definitions en masse (should one so desire).
>
> #+begin_src elisp
>   (defun my/eepitch-init/mk (name)
>     "Make various eepitch-init-NAME functions."
>     (let* ((namestr (symbol-name name))
>            (cmdstr (concat "eepitch-" namestr))
>            (cmd (intern cmdstr))
>            (funstr (concat "eepitch-init-" namestr))
>            (fun (intern funstr))
>            (docstr (format "Initialize `%s' buffer.
> This function was generated by `my/eepitch-init/mk'."
>                            cmdstr)))
>       `(defun ,fun ()
>          ,docstr
>          (interactive)
>          (,cmd)
>          (eepitch-kill)
>          (,cmd))))
>   (defmacro my/eepitch-init/gen ()
>     `(progn ,@ (mapcar 'my/eepitch-init/mk
>                        '(R bash bsh clojure coqtop dash erl eshell eshell2
>                            eshell3 expect fennel gcl gforth ghci gnuplot
> gs gst
>                            guile hugs hugs98 ielm irb isympy julia ksh
> labltk
>                            latex lua51 lua52 lua53 lua54 luajit lualatex
> luatex
>                            maxima mf mitscheme mozrepl mpost mysql nodejs
> ocaml
>                            octave pacmd perl pforth php polyml pwsh pwsh2
> python
>                            python2 python3 racket raku ruby sbcl scala
> scheme
>                            scsh sh shell shell2 shell3 smjs sml tcl tclsh
> tcsh
>                            tex tinyscheme wish yforth zsh))))
>   (my/eepitch-init/gen)
> #+end_src
>
> --
> Suhail
>
>
 Hi Suhail!

Excellent!!!

Here's how I would write the variant of `M-T'... and if you're using
eev from the git repository then take a look at the pair
(find-code-1stclassvideos) / (code-1stclassvideos) at the end - it
defines lots of functions like your progn/mapcar does, but it uses the
style that I prefer to use in eev, in which I generate code as text
and then I read and eval that text...

--snip--snip--

;; <eewrap-eepitch-init>
;; Skel: (find-eewrap-links "U" "eepitch-init" "stem")
;; Test: (find-eewraptest-links "eepitch-init" "shell2")

(defun  eewrap-eepitch-init () (interactive)
  (ee-this-line-wrapn 1 'ee-wrap-eepitch-init))
(defun ee-wrap-eepitch-init (stem)
  "An internal function used by `eewrap-eepitch-init'."
  (ee-adjust-red-stars (ee-template0 "\
(eepitch-init-{stem})
(eepitch-{stem})")))

(define-key eev-mode-map "\M-U" 'eewrap-eepitch-init)

--snip--snip--

;; (find-code-1stclassvideos)
        (code-1stclassvideos)

--snip--snip--

  Cheers =),
    Eduardo

Reply via email to