Macros - text for use several times

Help
2005-11-28
2013-05-02
  • Hi!
    I wonder if it is possible (joe 3.3) to get user typed text and macro which wraps it with some addons.

    It is quite easy (txt cmd) but when I want to repeat text i dont know how. To be exact I want to write macro which takes url from user and makes <A> tag with text being URL itself (<a href=URL>URLM</a>).

    I can not find any suitable command for it. Is this possible to do in joe 3.3 ?

    Best regards,

     
    • Jeremy Cowgar
      Jeremy Cowgar
      2005-12-18

      I think you want something like this:

      :def inserttag markb,txt,query,markk,blkdel,"<",yank,"></",yank,rfirst,"<",rtn,rtn

      inserttag ^[ t i

      for example. What this does is starts a block mark, queries the user for text, inserts the text into the current buffer, finishes the block, deletes the block, inserts <, yanks the text, inserts ></, yanks the text again, inserts the end ing >, then reverse finds the < to place the cursor right inbetween the two tags.

      Now, the danger in this is that let's say you want to move some text from a paragraph into a div tag. So, you hilight the text, copy it, then use the above inserttag macro. Guess what? When you go to paste your text in, you'll only get the tag name because the macro delete's the tag text into the cut buffer, therefore, overwriting anything that might have been in the clipboard.

      I do not know of anyway around that right now, but I'm realitively new to doing Joe macros.

      Jeremy