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

Re: [jasspa] Question regarding trailing white spaces

Expand Messages
  • Rick Owen
    Hi Jon, That works great. One last question if you don t mind. How would you go about writing a macro that does the equivalent of save-buffers-exit-emacs but
    Message 1 of 7 , Feb 21, 2002
    • 0 Attachment
      Hi Jon,

      That works great. One last question if you don't mind. How would you go about
      writing a macro that does the equivalent of

      save-buffers-exit-emacs

      but cleans and saves each modified file before exiting instead of just saves.

      Thanks,
      Rick.


      --- Jon Green <jnaught@...> wrote:
      > The macro "clean" will remove all trailing
      > white space from all lines. (format.emf)
      >
      > I usually define a macro called "spotless"
      > which cleans all lines and removes any
      > double white space lines:-
      >
      > > ; spotless; Perform a clean and remove any multi-blank lines.
      > > define-macro spotless
      > > -1 clean
      > > !emacro
      >
      > This just calls 'clean' with a -1 argument
      > that does the line killing as well.
      >
      > The best way to do what you want is to redefine
      > the C-x C-s binding with a macro that performs
      > the save for you and does some other work that
      > you want. The following would be defined in
      > your <user>.emf file i.e.
      >
      > > define-macro my-save-buffer
      > > clean
      > > !nma save-buffer
      > > !emacro
      > >
      > > global-bind-key my-save-buffer "C-x C-s"
      >
      > Regards
      > Jon.
      >
      >
      > Rick Owen wrote:
      > >
      > > Greetings,
      > >
      > > Is there a standard macro that will trim trailing white spaces? If so, is
      > > there a way to hook the file save process so that the trim trailing white
      > > spaces macro can process the file being saved?
      > >
      > > This would be on an HPUX system running me via telnet.
      > >
      > > Thanks,
      > > Rick.
      > >
      > > __________________________________________________
      > > Do You Yahoo!?
      > > Yahoo! Sports - Coverage of the 2002 Olympic Games
      > > http://sports.yahoo.com
      > >
      > >
      > > __________________________________________________________________________
      > >
      > > This is an unmoderated list. JASSPA is not responsible for the content of
      > > any material posted to this list.
      > >
      > > To unsubscribe, send a mail message to
      > >
      > > mailto:jasspa-unsubscribe@yahoogroups.com
      > >
      > > or visit http://groups.yahoo.com/group/jasspa and
      > > modify your account settings manually.
      > >
      > >
      > >
      > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      > --
      > ______________________________________________________________________
      >
      > Jon Green J.D.Naughton-Green
      > Project Manager
      >
      > SAMSUNG Electronics (UK) Ltd
      > Samsung Electronics Research Institute (Audio / Visual Labs)
      > The Communication Centre
      > South Street
      > Staines Tel(direct): +44 (0)1784 428614
      > MIDDLESEX Tel(s/w board): +44 (0)1784 428600 ext 614
      > TW18 4QE Fax: +44 (0)1784 428620
      > England Email (work): jon@...
      > Email (home): jon@...
      > _______________________________________________________________________
      >


      =====
      "And the only reason a road is good, as every wanderer knows,
      Is just because of the homes, the homes, the homes to which it goes."
      (Joyce Kilmer - "Main Street" and other poems)

      __________________________________________________
      Do You Yahoo!?
      Yahoo! Sports - Coverage of the 2002 Olympic Games
      http://sports.yahoo.com
    • Steven Phillips
      Look at the macro osd-save-all defined in osd.emf, Steve ... http://docs.yahoo.com/info/terms/ ... ===== And the only reason a road is good, as every wanderer
      Message 2 of 7 , Feb 22, 2002
      • 0 Attachment
        Look at the macro osd-save-all defined in osd.emf,

        Steve

        > -----Original Message-----
        > From: Rick Owen [mailto:rickowen@...]
        > Sent: 21 February 2002 19:27
        > To: jasspa@yahoogroups.com
        > Subject: Re: [jasspa] Question regarding trailing white spaces
        >
        >
        > Hi Jon,
        >
        > That works great. One last question if you don't mind. How
        > would you go about
        > writing a macro that does the equivalent of
        >
        > save-buffers-exit-emacs
        >
        > but cleans and saves each modified file before exiting instead of
        > just saves.
        >
        > Thanks,
        > Rick.
        >
        >
        > --- Jon Green <jnaught@...> wrote:
        > > The macro "clean" will remove all trailing
        > > white space from all lines. (format.emf)
        > >
        > > I usually define a macro called "spotless"
        > > which cleans all lines and removes any
        > > double white space lines:-
        > >
        > > > ; spotless; Perform a clean and remove any multi-blank lines.
        > > > define-macro spotless
        > > > -1 clean
        > > > !emacro
        > >
        > > This just calls 'clean' with a -1 argument
        > > that does the line killing as well.
        > >
        > > The best way to do what you want is to redefine
        > > the C-x C-s binding with a macro that performs
        > > the save for you and does some other work that
        > > you want. The following would be defined in
        > > your <user>.emf file i.e.
        > >
        > > > define-macro my-save-buffer
        > > > clean
        > > > !nma save-buffer
        > > > !emacro
        > > >
        > > > global-bind-key my-save-buffer "C-x C-s"
        > >
        > > Regards
        > > Jon.
        > >
        > >
        > > Rick Owen wrote:
        > > >
        > > > Greetings,
        > > >
        > > > Is there a standard macro that will trim trailing white
        > spaces? If so, is
        > > > there a way to hook the file save process so that the trim
        > trailing white
        > > > spaces macro can process the file being saved?
        > > >
        > > > This would be on an HPUX system running me via telnet.
        > > >
        > > > Thanks,
        > > > Rick.
        > > >
        > > > __________________________________________________
        > > > Do You Yahoo!?
        > > > Yahoo! Sports - Coverage of the 2002 Olympic Games
        > > > http://sports.yahoo.com
        > > >
        > > >
        > > >
        > __________________________________________________________________________
        > > >
        > > > This is an unmoderated list. JASSPA is not responsible for
        > the content of
        > > > any material posted to this list.
        > > >
        > > > To unsubscribe, send a mail message to
        > > >
        > > > mailto:jasspa-unsubscribe@yahoogroups.com
        > > >
        > > > or visit http://groups.yahoo.com/group/jasspa and
        > > > modify your account settings manually.
        > > >
        > > >
        > > >
        > > > Your use of Yahoo! Groups is subject to
        http://docs.yahoo.com/info/terms/
        >
        > --
        > ______________________________________________________________________
        >
        > Jon Green J.D.Naughton-Green
        > Project Manager
        >
        > SAMSUNG Electronics (UK) Ltd
        > Samsung Electronics Research Institute (Audio / Visual Labs)
        > The Communication Centre
        > South Street
        > Staines Tel(direct): +44 (0)1784 428614
        > MIDDLESEX Tel(s/w board): +44 (0)1784 428600 ext 614
        > TW18 4QE Fax: +44 (0)1784 428620
        > England Email (work): jon@...
        > Email (home): jon@...
        > _______________________________________________________________________
        >


        =====
        "And the only reason a road is good, as every wanderer knows,
        Is just because of the homes, the homes, the homes to which it goes."
        (Joyce Kilmer - "Main Street" and other poems)

        __________________________________________________
        Do You Yahoo!?
        Yahoo! Sports - Coverage of the 2002 Olympic Games
        http://sports.yahoo.com


        __________________________________________________________________________

        This is an unmoderated list. JASSPA is not responsible for the content of
        any material posted to this list.

        To unsubscribe, send a mail message to

        mailto:jasspa-unsubscribe@yahoogroups.com

        or visit http://groups.yahoo.com/group/jasspa and
        modify your account settings manually.




        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      • thundt
        Here is a macro to clean just ONE line: ;------------------------------------------------------------ ; trim-line: get rid of whitespace at end of line
        Message 3 of 7 , Feb 22, 2002
        • 0 Attachment
          Here is a macro to 'clean' just ONE line:

          ;------------------------------------------------------------
          ; trim-line: get rid of whitespace at end of line
          ;------------------------------------------------------------
          define-macro trim-line
          beginning-of-line
          set-variable #l1 &trright @wl
          !if &gre &len #l1 0
          kill-line
          insert-string #l1
          !if ¬ &bmode "line"
          newline
          !endif
          !endif
          !emacro


          And here is one to 'clean' the spaces from the BEGINNING of lines
          (useful when copy/pasting from Netscape into a ME buffer)

          ;------------------------------------------------------------
          ; kill-leading-whitespace
          ;------------------------------------------------------------
          define-macro kill-leading-whitespace
          beginning-of-buffer
          replace-string "^[ \t]+" ""
          beginning-of-buffer
          !emacro






          --- In jasspa@y..., Jon Green <jnaught@s...> wrote:
          > The macro "clean" will remove all trailing
          > white space from all lines. (format.emf)
          >
          > I usually define a macro called "spotless"
          > which cleans all lines and removes any
          > double white space lines:-
          >
          > > ; spotless; Perform a clean and remove any multi-blank lines.
          > > define-macro spotless
          > > -1 clean
          > > !emacro
          >
          > This just calls 'clean' with a -1 argument
          > that does the line killing as well.
          >
          > The best way to do what you want is to redefine
          > the C-x C-s binding with a macro that performs
          > the save for you and does some other work that
          > you want. The following would be defined in
          > your <user>.emf file i.e.
          >
          > > define-macro my-save-buffer
          > > clean
          > > !nma save-buffer
          > > !emacro
          > >
          > > global-bind-key my-save-buffer "C-x C-s"
          >
          > Regards
          > Jon.
          >
          >
          > Rick Owen wrote:
          > >
          > > Greetings,
          > >
          > > Is there a standard macro that will trim trailing white spaces?
          If so, is
          > > there a way to hook the file save process so that the trim
          trailing white
          > > spaces macro can process the file being saved?
          > >
          > > This would be on an HPUX system running me via telnet.
          > >
          > > Thanks,
          > > Rick.
          > >
          > > __________________________________________________
          > > Do You Yahoo!?
          > > Yahoo! Sports - Coverage of the 2002 Olympic Games
          > > http://sports.yahoo.com
          > >
          > >
          > >
          ______________________________________________________________________
          ____
          > >
          > > This is an unmoderated list. JASSPA is not responsible for the
          content of
          > > any material posted to this list.
          > >
          > > To unsubscribe, send a mail message to
          > >
          > > mailto:jasspa-unsubscribe@y...
          > >
          > > or visit http://groups.yahoo.com/group/jasspa and
          > > modify your account settings manually.
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to
          http://docs.yahoo.com/info/terms/
          >
          > --
          >
          ______________________________________________________________________
          >
          > Jon Green
          J.D.Naughton-Green
          > Project Manager
          >
          > SAMSUNG Electronics (UK) Ltd
          > Samsung Electronics Research Institute (Audio / Visual Labs)
          > The Communication Centre
          > South Street
          > Staines Tel(direct): +44 (0)1784 428614
          > MIDDLESEX Tel(s/w board): +44 (0)1784 428600 ext 614
          > TW18 4QE Fax: +44 (0)1784 428620
          > England Email (work): jon@s...
          > Email (home): jon@j...
          >
          ______________________________________________________________________
          _
        Your message has been successfully submitted and would be delivered to recipients shortly.