eberard@ajpo.sei.cmu.edu (Edward Berard) (09/06/89)
I am a person who uses emacs only occasionally, and when I do use it, I use it strictly as a word processor. I have two novice questions: 1. Is there a way in emacs to create "hanging indents" like this one? What I would like is to be able to create a paragraph formatted like this one, and not have to shift each line, re-format, etc. myself. 2. I have a large (approximately 600 lines) file. Each line in the file looks like two strings separated by a tab. Since the length of the first string varies, the tab is not in the same place in each line. Is there any way to tell emacs to take every line in the file and cause the second string in each line to begin at the same column? I actually have more, word-processing related questions. Are there some documents on the use of emacs as a wp? Normally, I use word processors like MS Word 4.0 on the Mac. However, when I wish to send mail on the net, I am forced to use emacs. (I have nothing against emacs, it is just the only thing like a wp that is available on the machine I use.) -- Ed Berard (301) 353-9652
jbw@bucsf.bu.edu (Joe Wells) (09/07/89)
In article <574@ajpo.sei.cmu.edu> eberard@ajpo.sei.cmu.edu (Edward Berard) writes:
1. Is there a way in emacs to create "hanging indents" like
this one? What I would like is to be able to create a
paragraph formatted like this one, and not have to shift
each line, re-format, etc. myself.
indented-text-mode handles this nicely in combination with auto-fill-mode.
2. I have a large (approximately 600 lines) file. Each line in
the file looks like two strings separated by a tab. Since
the length of the first string varies, the tab is not in
the same place in each line. Is there any way to tell emacs
to take every line in the file and cause the second string
in each line to begin at the same column?
If I didn't need to do this often, I would just define a keyboard macro
and apply the macro to each line of the file with ESC 1000 C-x e.
Use M-x indent-to inside of the macro. (The keyboard macro should always
move down one line when it is done.)
I actually have more, word-processing related questions. Are there
some documents on the use of emacs as a wp? Normally, I use word
processors like MS Word 4.0 on the Mac. However, when I wish to send
mail on the net, I am forced to use emacs. (I have nothing against
emacs, it is just the only thing like a wp that is available on the
machine I use.)
Emacs does not fall neatly in the category of programs called "word
processors". Word processing is half editing and half typesetting. Emacs
handles the editing part nicely, but to do word processing you need
another program to handle the typesetting part. I use both troff and TeX
for that purpose.
--
Joe Wells <jbw@bucsf.bu.edu>
jbw%bucsf.bu.edu@bu-it.bu.edu
...!harvard!bu-cs!bucsf!jbw
jka@hpfcso.HP.COM (Jay Adams) (09/07/89)
1. Is there a way in emacs to create "hanging indents" like this one? What I would like is to be able to create a paragraph formatted like this one, and not have to shift each line, re-format, etc. myself. Well, I guess what I would do is move the cursor to the beginning of the indented line and do C-x . (set-fill-prefix). You may also want to do M-x auto-fill-mode. Now the left margin should line up as you type. If you do M-q (fill-paragraph) on the paragraph the line that starts with "1. " will not be moved. Try it, you'll see what I mean. 2. I have a large (approximately 600 lines) file. Each line in the file looks like two strings separated by a tab. Since the length of the first string varies, the tab is not in the same place in each line. Is there any way to tell emacs to take every line in the file and cause the second string in each line to begin at the same column? Without getting real fancy the only thing I can think of is to visit the file, do M-x set-variable and set the variable tab-width to something large like 20 (20 is the max my emacs will let me do). See if that makes the columns line up. If so, do M-x mark-whole-buffer followed by M-x untabify. That will convert all the tabs to spaces. To convert them back to 8-wide tabs set the tab-width variable back to 8, and do M-x mark-whole-buffer and M-x tabify. - Jay
kjones@talos.uucp (Kyle Jones) (09/08/89)
Edward Berard writes: > 1. Is there a way in emacs to create "hanging indents" like > this one? What I would like is to be able to create a > paragraph formatted like this one, and not have to shift > each line, re-format, etc. myself. Joe Wells writes: > indented-text-mode handles this nicely in combination with > auto-fill-mode. Well, it handles hanging indentes but not very well. If Edward had typed the above paragraph using indented-text-mode and auto-fill-mode the first characters of the second line would be indented to fall under the `1', not the `I' in "Is" as it should be. Quite a while ago I wrote a package called "filladapt" that handles this correctly, and takes care of several other special cases where normal filling/word wrap fails. I'll post it to the emacs groups today.
jbw@bucsf.bu.edu (Joe Wells) (09/08/89)
In article <1989Sep7.175620.16036@talos.uucp> kjones@talos.uucp (Kyle Jones) writes: Edward Berard writes: > 1. Is there a way in emacs to create "hanging indents" like > this one? What I would like is to be able to create a > paragraph formatted like this one, and not have to shift > each line, re-format, etc. myself. Joe Wells writes: > indented-text-mode handles this nicely in combination with > auto-fill-mode. Well, it handles hanging indentes but not very well. If Edward had typed the above paragraph using indented-text-mode and auto-fill-mode the first characters of the second line would be indented to fall under the `1', not the `I' in "Is" as it should be. At this point, you type TAB once, and then you are in the correct place, with the cursor below the 'I' in "Is". If you were to type TAB again, the cursor would be below the 't' in "there". Subsequent lines will be indented to the same level. -- Joe Wells <jbw@bucsf.bu.edu> jbw%bucsf.bu.edu@bu-it.bu.edu ...!harvard!bu-cs!bucsf!jbw
shirono@ssd.harris.com (Roberto Shironoshita) (09/09/89)
In article <574@ajpo.sei.cmu.edu> eberard@ajpo.sei.cmu.edu (Edward Berard) writes: [ You don't mention which Emacs. I'm going to answer with respect to GNU ] [ Emacs. I would answer for other versions as well, but my experience ] [ with them is pretty much nil. ] > 1. Is there a way in emacs to create "hanging indents" like > this one? What I would like is to be able to create a > paragraph formatted like this one, and not have to shift > each line, re-format, etc. myself. It is indeed possible to create hanging indents. I think there are a couple of major modes that do it (according to their own rules). indented-text-mode comes pretty close to what you want, except that it indents to the level of the line prior to the current one. Combining the auto-fill minor mode, you can get pretty close to WordStar (and friends). > 2. I have a large (approximately 600 lines) file. Each line in > the file looks like two strings separated by a tab. Since > the length of the first string varies, the tab is not in > the same place in each line. Is there any way to tell emacs > to take every line in the file and cause the second string > in each line to begin at the same column? Assuming the file has already been created, it is possible to tell GNU Emacs to do anything you want with it. The only problem for most non-hackers is in getting GNU Emacs to understand you (swearing and cursing don't work ;-). You could, for example, define a keyboard macro and then invoke it for each and every line in the file (or invoke it with a repeat-count). The GNU Emacs Manual for version 18 has a whole section devoted to keyboard macros. You could also write some GNU Emacs Lisp code to do exactly what you want. Unfortunately, I know of no simple way. > I actually have more, word-processing related questions. Are there > some documents on the use of emacs as a wp? What exactly do you mean by word-processing? GNU Emacs is a very powerful editor, that can be configured to do just about anything you want (including answering the phone, with the proper interfaces;-). In text-mode, you can tell it to fill (insert a newline when the current word surpasses the right-hand margin). Whatever you do, it will probably fall short of other word processors in the market (WordStar, WordPerfect, MSWord, MacWrite, etc), because it was not designed to be a word processor, but a very powerful, configurable editor. A good place to start learning about GNU Emacs is the tutorial. Enter GNU Emacs in a normal way and type C-h t (that's control-h t). The text will carry you through a good introduction to GNU Emacs. The next place is the GNU Emacs Manual, which is a fairly well-written document, good for both novice and experienced users. After that, you may want to acquire a copy of the GNU Emacs Lisp Manual (currently under development) and "earn" the honor of been called a hacker. Hope this helps some. Roberto -- ______________________________________________________________________________ || Internet: shirono@ssd.harris.com Roberto Shironoshita || Harris Corporation || ...!novavax---\ Computer Systems Division || UUCP: ...!uunet-------!hcx1!shirono || ...!mit-eddie-/ ------------------------------------------------------------------------------ DISCLAIMER: The opinions expressed here are my own; they in no way reflect the opinion or policies of Harris Corporation.
matoh@sssab.se (Mats Ohrman) (09/12/89)
[ Reposting this because of that &#%#&&/#&%**{} "Re^2"-killer. - Mats ] shirono@ssd.harris.com (Roberto Shironoshita) writes: >In article <574@ajpo.sei.cmu.edu> eberard@ajpo.sei.cmu.edu (Edward Berard) >> 2. I have a large (approximately 600 lines) file. Each line in >> the file looks like two strings separated by a tab. Since >> the length of the first string varies, the tab is not in >> the same place in each line. Is there any way to tell emacs >> to take every line in the file and cause the second string >> in each line to begin at the same column? >Assuming the file has already been created, it is possible to tell GNU >Emacs to do anything you want with it. The only problem for most >non-hackers is in getting GNU Emacs to understand you (swearing and cursing >don't work ;-). You could, for example, define a keyboard macro and then >invoke it for each and every line in the file (or invoke it with a >repeat-count). The GNU Emacs Manual for version 18 has a whole section >devoted to keyboard macros. You could also write some GNU Emacs Lisp code >to do exactly what you want. Unfortunately, I know of no simple way. To do it with a macro: C-X ( C-S C-Q TAB /* search for TAB */ ESC /* found it! */ DEL /* then remove it */ M-X indent-to-column <insert number here> C-X ) then: M-< C-U <very large number> C-X E Elementary, my dear Watson :-) :-) :-) -- _ : matoh@sssab.se / Mats Ohrman, : {mcvax,munnari,uunet}!sunic!sssab!matoh Scandinavian System Support AB, : Phone: Nat. 013-11 16 60 Box 535, S-581 06 Linkoping, Sweden : Int. +46 13 11 16 60