kwon@sybil.cs.Buffalo.EDU (Thomas Kwon) (12/09/89)
I am trying to customize my .emacs file so that it can move some sections of a file being edited to the left or right by specified number of columns. For example, if I had the following text : . . . Three year old Larry said to three old Mary, "I want what I want when I want it!" Three year old Mary said to three old Larry, "You'll get what I got when I get it!" . . . and I want this section to move say 5 columns over to the right so it looks like the following : . . . Three year old Larry said to three old Mary, "I want what I want when I want it!" Three year old Mary said to three old Larry, "You'll get what I got when I get it!" . . . How would I accomplish this? Any suggestions will be greatly appreciated. Tom Kwon. *-)
jr@BBN.COM (John Robinson) (12/09/89)
The function indent-rigidly (bound to ^X^I, or ^X TAB) does this: indent-rigidly: Indent all lines starting in the region sideways by ARG columns. Called from a program, takes three arguments, START, END and ARG. (I just used it to indent that paragraph, by the way!) /jr, nee John Robinson Life did not take over the globe by combat, jr@bbn.com or bbn!jr but by networking -- Lynn Margulis
grunwald@foobar.colorado.edu (Dirk Grunwald) (12/09/89)
>>>>> On 8 Dec 89 18:11:11 GMT, kwon@sybil.cs.Buffalo.EDU (Thomas Kwon) said:
Tom> I am trying to customize my .emacs file so that it can move some sections
Tom> of a file being edited to the left or right by specified number of
Tom> columns. For example, if I had the following text :
(defun move-by (by)
(interactive "Nmove by? ")
(save-excursion
(narrow-to-region (point) (mark))
(goto-char (point-min))
(replace-regexp "^[\ ]*" (concat "\\&" (make-string by 32)))
(tabify (point-min) (point-max))
(widen)))
spolsky-joel@CS.YALE.EDU (Joel Spolsky) (12/09/89)
In article <14407@eerie.acsu.Buffalo.EDU> kwon@sybil.cs.Buffalo.EDU (Thomas Kwon) writes: >I am trying to customize my .emacs file so that it can move some sections >of a file being edited to the left or right by specified number of >columns. <Esc> n M-x indent-region where n is the number of columns; use negative n to move left. +----------------+----------------------------------------------------------+ | Joel Spolsky | bitnet: spolsky@yalecs.bitnet uucp: ...!yale!spolsky | | | internet: spolsky@cs.yale.edu voicenet: 203-436-1538 | +----------------+----------------------------------------------------------+ #include <disclaimer.h>
barmar@Think.COM (12/09/89)
In article <14407@eerie.acsu.Buffalo.EDU> kwon@sybil.cs.Buffalo.EDU (Thomas Kwon) writes: >I am trying to customize my .emacs file so that it can move some sections >of a file being edited to the left or right by specified number of >columns. That's what the command/function indent-rigidly, which is on c-x c-i by default, does. From the online doc: indent-rigidly: Indent all lines starting in the region sideways by ARG columns. Called from a program, takes three arguments, START, END and ARG. Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar