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

write-region or save-region

Expand Messages
  • Meino Christian Cramer
    HI, is there a save-region or write-region macro out there anywhere? I tried to write one myself but I failed to get asking for a file to write to and error
    Message 1 of 2 , Jul 20, 2004
    • 0 Attachment
      HI,

      is there a save-region or write-region macro out there anywhere?

      I tried to write one myself but I failed to get asking for a file to
      write to and error handling in case of target file do exist
      working...

      Thank you very much in advance for any help/macro ;) :O)

      Keep Microemacsing! X-)
      Meino
    • Phillips, Steven
      This has taken me a bit longer to reply to than I d like, but rather than just send the resultant working macro I thought I would spend a little longer
      Message 2 of 2 , Sep 28, 2004
      • 0 Attachment
        This has taken me a bit longer to reply to than I'd like, but rather than just
        send the resultant working macro I thought I would spend a little longer
        writing down the process in the hope that it may encourage people to write
        macros themselves.

        Attached is a very rough first draft of a 'Creating Macros' narrative, please
        do not judge this on its artistic flair or literacy accuracy, rather on its
        technical content and ease of reading.

        I hope this will also inspire a 'indent-region' macro...

        Steve

        P.S. For those just wanting the macro, here it is:

        define-macro write-region
        copy-region
        set-variable #l0 $buffer-fname
        set-position "P"
        !force delete-buffer "*write-region-tmp*"
        find-buffer "*write-region-tmp*"
        yank
        set-variable $buffer-fname #l0
        !force set-variable #l1 @1
        !if $status
        !force !force @# write-buffer #l1 @mna
        !else
        !force !force @# write-buffer @mna
        !endif
        !if ¬ $status
        !force delete-buffer $buffer-bname
        goto-position "P"
        !abort
        !endif
        delete-buffer $buffer-bname
        goto-position "P"
        !emacro

        > -----Original Message-----
        > From: Meino Christian Cramer [mailto:Meino.Cramer@...]
        > Sent: Tuesday, July 20, 2004 11:56 PM
        > To: jasspa@yahoogroups.com; Phillips, Steven
        > Subject: write-region or save-region
        >
        >
        > HI,
        >
        > is there a save-region or write-region macro out there anywhere?
        >
        > I tried to write one myself but I failed to get asking for a file to
        > write to and error handling in case of target file do exist
        > working...
        >
        > Thank you very much in advance for any help/macro ;) :O)
        >
        > Keep Microemacsing! X-)
        > Meino
        >
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.