The short story: Use M-x longlines-mode
.
The long story: longlines-mode
is a minor mode that enables "soft wrap" for Emacs text. In longlines, lines will be displayed wrapped on word boundaries, as under most word processors (but not most text editors). This is useful for editing certain textual formats like HTML or wiki markup.
longlines comes bundled in FSF Emacs 22, but for earlier versions (or XEmacs) do the following:
- Get longlines.el, from the longlines Emacs Wiki page.
- Copy longlines.el somewhere on your load path. (To add a directory to your load path, add a line
(add-to-list 'load-path "/path/to/directory/")
to your .emacs) - Add
(require 'longlines)
to your .emacs.
longlines-mode is a minor mode, and does not automatically hook itself into any major modes. You can hook longlines automatically in the standard fashion:
(add-hook 'html-mode-hook '(lambda () (longlines-mode)))
Alternatively, you can simply do M-x longlines-mode
to toggle the minor mode manually, as I suggest above.
Once you get started with longlines, you'll probably want to customize its settings to taste. For example, by default the word wrap width won't automatically adjust to the window size. To see all relevant customizable settings, use M-x customize-group
[enter] longlines
[enter].
Incidentally, this feature is astonishingly obscure and late to arrive to Emacs, given that it's been a standard menu item in crippled brain-dead text editors like Windows Notepad for over a decade. Yet another example of how open source software development is not rationally optimized to serve the needs of the user.
No comments:
Post a Comment