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

Re: [jasspa] Re: two questions....

Expand Messages
  • Jon Green
    Here is an alternative macro for you. Called shove-over-region which is probably what you are looking for:- define-macro shove-over-region set-variable #l0
    Message 1 of 8 , Feb 23, 2002
    • 0 Attachment
      Here is an alternative macro for you. Called
      "shove-over-region" which is probably what
      you are looking for:-

      define-macro shove-over-region
      set-variable #l0 $window-line
      set-alpha-mark "<"
      exchange-point-and-mark
      !if &gre $window-line #l0
      set-variable #l0 $window-line
      set-alpha-mark "<"
      exchange-point-and-mark
      !endif
      beginning-of-line
      set-variable #l1 @wl
      !while &less $window-line #l0
      beginning-of-line
      $tabsize insert-string " "
      !force forward-line
      ; Check for end of buffer.
      !if ¬ $status
      goto-alpha-mark "<"
      !return
      !endif
      !done
      goto-alpha-mark "<"
      !emacro


      Note that $tabsize is used to control the
      indent rather than the fixed 4 spaced in the
      other macro example. You could mix the
      two macros and check for a numeric argument
      and do a fixed number of lines otherwise
      do a region etc.

      Regards
      Jon.


      Rick Owen wrote:
      >
      > Greetings,
      >
      > I wish I knew more about the script language and I wouldn't have to ask these
      > questions. In the case of both macros, they only work on the current line --
      > although they work great there! :). Am I doing something wrong? I set the mark
      > and then move up or down several lines and invoke one of these macros and only
      > the current line is affected.
      >
      > Thanks,
      > Rick
      >
      > --- thundt <thundt@...> wrote:
      > > Here are a couple of simple macros to shove lines back and forth, by
      > > one "soft tab stop" (in my case I always use 4 spaces; this should
      > > probably come from a $tabxxxx variable or something).
      > >
      > > Maybe you'll find them useful or get an idea for your own hack.
      > >
      > > Note that in a text file, you can move the first line of a paragraph
      > > over and do ifill-paragraph and it will line up the rest of the
      > > paragraph with it.
      > >
      > >
      > > ;------------------------------------------------------------
      > > ; shove-over
      > > ;------------------------------------------------------------
      > > define-macro shove-over
      > > !while &gre &pdec @# 1 0 ; C-u prefix support
      > > beginning-of-line
      > > insert-string " "
      > > forward-line
      > > beginning-of-line
      > > !done
      > > !emacro
      > > global-bind-key shove-over "C-x C-i"
      > >
      > >
      > > ;------------------------------------------------------------
      > > ; shove-back
      > > ;------------------------------------------------------------
      > > define-macro shove-back
      > > !while &gre &pdec @# 1 0 ; C-u prefix support
      > > beginning-of-line
      > > !if &ise @wc " "
      > > forward-delete-char
      > > !if &ise @wc " "
      > > forward-delete-char
      > > !if &ise @wc " "
      > > forward-delete-char
      > > !if &ise @wc " "
      > > forward-delete-char
      > > !endif
      > > !endif
      > > !endif
      > > !endif
      > > forward-line
      > > beginning-of-line
      > > !done
      > > !emacro
      > > global-bind-key shove-back "C-x C-u"
      > >
      > >
      > > ;------------------------------------------------------------
      > > ; shove-home-line: moves line to left edge
      > > ;------------------------------------------------------------
      > > define-macro shove-home-line
      > > !while &gre &pdec @# 1 0 ; C-u prefix support
      > > beginning-of-line
      > > delete-spaces-and-tabs
      > > forward-line
      > > beginning-of-line
      > > !done
      > > !emacro
      > > global-bind-key shove-home-line "C-x C-k"
      > >
      > >
      > >
      > >
      > >
      > > --- In jasspa@y..., "un_x" <un_x@y...> wrote:
      > > > you can make a rectangular selection
      > > > of a column and copy it.
      > > >
      > > > or you can pipe the buffer region
      > > > thru sed or whatever.
      > > >
      > > > --- In jasspa@y..., Rick Owen <rickowen@y...> wrote:
      > > > > Hi Steve,
      > > > >
      > > > > Thanks for the answer on setting tab width.
      > > > >
      > > > > >
      > > > > > > 2. Is there a macro to implement indent-region?
      > > > > >
      > > > > > Is restyle-region what you are after (Format -> Restyle Region)?
      > > > Or are you
      > > > > > after a 'indent all lines in region by X spaces'?
      > > > >
      > > > > That's what I want to do ...
      > > > >
      > > > > Indent (or unindent) all lines in region by x spaces.
      > > > >
      > > > >
      > > > > Rick.
      > > > >
      > > > >
      > > > > __________________________________________________
      > > > > Do You Yahoo!?
      > > > > Yahoo! Sports - Coverage of the 2002 Olympic Games
      > > > > http://sports.yahoo.com
      > >
      > >
      >
      > =====
      > "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/
    Your message has been successfully submitted and would be delivered to recipients shortly.