Loading ...
Sorry, an error occurred while loading the content.

Re: Sending code the a running tcl-interpeter

Expand Messages
  • Dr. Detlef Groth
    Hello, After some discussion with Steven, I came to the follwowing solution using an inferior tclsh-session: define-macro tclsh-ipipe set-variable #l0 &xrep
    Message 1 of 2 , May 11, 2004
    • 0 Attachment
      Hello,
      After some discussion with Steven, I came to the follwowing solution
      using an inferior tclsh-session:

      define-macro tclsh-ipipe
      set-variable #l0 &xrep $buffer-bname "<\[0-9\]>" ""
      ipipe-shell-command tclsh8.4
      ; or tclsh84 on windows
      find-buffer "*icommand*"
      !if &band $system 0x100
      ipipe-write &spr "source %s\CM\CJ" #l0
      !else
      ipipe-write &spr "source %s\CM" #l0
      !endif

      find-buffer #l0
      goto-alpha-mark "p"
      !emacro

      define-macro tclsh-send-current-line
      set-variable #l0 &xrep $buffer-bname "<\[0-9\]>" ""
      set-variable $debug 1
      beginning-of-line
      set-mark
      end-of-line
      exchange-point-and-mark
      copy-region
      find-buffer "*icommand*"
      !if &band $system 0x100
      ipipe-write &spr "%s\CM\CJ" @y
      !else
      ipipe-write &spr "%s\CM" @y
      !endif
      find-buffer #l0
      -1 yank
      !emacro
      define-macro tclsh-send-proc
      set-variable #l0 &xrep $buffer-bname "<\[0-9\]>" ""
      set-alpha-mark "p"
      search-backward "^proc"
      set-mark
      search-forward "^}"
      exchange-point-and-mark
      copy-region
      find-buffer "*icommand*"
      !if &band $system 0x100
      ipipe-write &spr "%s\CM\CJ" @y
      !else
      ipipe-write &spr "%s\CM" @y
      !endif
      find-buffer #l0
      -1 yank
      goto-alpha-mark "p"
      !emacro

      Nice, at least for me.

      regards,
      Detlef

      --- In jasspa@yahoogroups.com, "Dr. Detlef Groth" <dgroth@g...> wrote:
      >
      > Hello,
      >
      > TclTk allows you to change procedures, object at runtime. So instead
      > of editing, compiling, running, testing, stopping and starting again
      > with editing, you start an empty application and devloped on the
      > living application just resourcing the redefined procedure, class.
      So
      > in principle you must never close the apps until you are ready with
      > your fullfledged application.
      >
      > How I implement this with microemacs. Each time I save my
      > tcltk-program the appropiate procedure, class, type is saved to a
      file
      > source.tcl, I switch to the application and source the file
      source.tcl
      > with a shortcut (F7 is my favourite) then experiment with the
      > application again.
      >
      > in mytcl.emf I rebind C-x C-s:
      > define-macro tcl-save-input
      > set-variable #l0 $buffer-bname
      > set-alpha-m
      ark "p"
      > search-backward "^[ps]"
      > set-mark
      > search-forward "^}"
      > exchange-point-and-mark
      > copy-region
      > find-buffer "source.tcl"
      > beginning-of-buffer
      > yank
      > set-mark
      > end-of-buffer
      > kill-region
      > save-buffer
      > find-buffer #l0
      > goto-alpha-mark "p"
      > !emacro
      > define-macro tcl-save
      > tcl-save-input
      > save-buffer
      > !emacro
      > buffer-bind-key tcl-save "C-x C-s"
      >
      > However if I want to change two, three procedures this becomes quite
      > annoying. I know that with emacs it is possible to directly send the
      > procedure to the interpreter. This could also be done via dde or
      send.
      >
      > Is this possible to achieve with ME also ? Or should I just run an
      > external program to send this code to the tcl-app ? May be I check
      > regulary for the changes in source.tcl from the tclapp itself?
      Anyone
      > who has suggestions for the best approach. Can ME do dde or send by
      > itself?
      >
      > regards,
      > Detlef
    Your message has been successfully submitted and would be delivered to recipients shortly.