all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Roodwriter@core.com" <Roodwriter@core.com>
Subject: Re: soft wrapping and line numbers
Date: Wed, 30 Apr 2003 14:20:29 -0400	[thread overview]
Message-ID: <vb04vskjus76eb@corp.supernews.com> (raw)
In-Reply-To: b8mjep$8b2$1@acs2.byu.edu

Eric Carlsen wrote:

> I recently started using emacs and I was wondering if there is a way to
> do some things. For one, is soft word wrapping implemented yet? By this
> I mean that there are no newlines inserted in text but it wraps lines on
> the screen without breaking up characters. Vim does it with lbr (I'm not
> trying to flame, just give background) and I think it is commonly done
> in the windows world.
> 
> The other feature I would like is to have the line number written beside
> each line. Is that possible? Thanks for any help. I've tried to read the
> manuals and look online but I haven't found any solutions yet.


The lack of a true word wrap with Emacs is my mine gripe with it. (This may 
only apply to writers.) But I've worked out a workaround. One no one else 
in the world will probably use. But here it is.

First, there's the Refill command. This works like the Fill command but it 
will REfill when you type something back in the middle of a filled 
paragraph. In other words, you don't have to M-q. It works pretty well, 
except . . .

It won't let you line up short lines. It'll greedily join them together. If 
you try to do this:

One or
two words
on a line.

You'll end up with:

One or two words on a line.

This is why I bound it to a function key so I could toggle it on and off 
when I make lists.

Refill also has problems with tabs--indenting everything.

But it works pretty well by typing out things with the TeX and friends 
method. That is, no tabs and double-spacing between each paragraph. 
(Ironically, refill conflicts with AucTex itself. You can't use it.)

That's not a bad way to work if you're like me and tend to hit the caps lock 
when you're reaching for the tab key. But if you want your text to have 
proper tabs you can do my Handy-Dandy, Patented, Kludgey, Little Genius 
Workaround.

I made a macro which converts two newlines in a row using replace-regexp to 
a tab and carriage return plus converts ALL single newlines to spaces so 
the individual lines within the paragraph join together. I also did another 
sweep to convert two spaces to one space, in case I ended up with too many 
between words.

I don't know how fast it would work on something the length of a book, but 
for the short news stories I write, it's done in a second.

After this activates you'll have tabs and long lines again. That's how I 
save everything since it facilitates a grep search. But if you call up that 
file on another day you'll have a problem because of the tabs. I made a 
companion macro that takes out the tabs and puts in newlines for this 
reason.

It never fails to irritate me that the most advanced editor on the planet 
can't do a job that Windows Notepad can handle. I'd really like that on my 
wishlist, but I doubt I'd be the first. There may be some reason it won't 
work. The other thing I wish would be incorporated would be the automatic 
capitalization at the beginning of sentences. There's an add-on out there 
that'll do it. I haven't tried it.

This is getting a bit long but I need to say something else about refill. 
The macro I just described won't work if you need paragraphs like you see 
here or a single-line list, like the "one or two words" thing I did above. 
I have to run a different series of finds and replaces to keep the 
double-spacing but make the long lines. It's nice that Emacs makes macros 
so easily.

Dunno if this helps.

--Rod

-- 
Author of "Linux for Non-Geeks--Clear-eyed Answers for Practical Consumers" 
and "Boring Stories from Uncle Rod." Both are available at 
http://www.rodwriterpublishing.com/index.html

To reply by e-mail, take the extra "o" out of my e-mail address. It's to 
confuse spambots, of course.

  parent reply	other threads:[~2003-04-30 18:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b8mjep$8b2$1@acs2.byu.edu>
2003-04-29 23:54 ` soft wrapping and line numbers Johan Bockgård
2003-04-30 13:53 ` Javier Oviedo
2003-05-01 14:45   ` John Kliff Jochens
     [not found]   ` <mailman.5444.1051801721.21513.help-gnu-emacs@gnu.org>
2003-05-02 14:25     ` Javier Oviedo
2003-04-30 14:41 ` Kai Großjohann
2003-04-30 18:20 ` Roodwriter [this message]
2003-05-01 22:44   ` Stefan Monnier
2003-05-02 19:06     ` Roodwriter
2003-05-02 21:23       ` Stefan Monnier
2003-05-04 14:38         ` Oliver Scholz
2003-05-03 17:32       ` Kai Großjohann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vb04vskjus76eb@corp.supernews.com \
    --to=roodwriter@core.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.