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

591Re: two questions....

Expand Messages
  • thundt
    Feb 22, 2002
    • 0 Attachment
      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
    • Show all 8 messages in this topic