[gnu.emacs] Reverse-video-region, and end-of-line markers

paulr@sequent.UUCP (Paul Reger) (05/26/89)

Hello all.  I have two questions:

1. I come from a VAX/VMS background where I used to use EVE a lot.  In
EVE when you selected the region, it highlighted it as reverse-video on
your screen so you could see exactly what you have selected.

Anybody know how you can do this in emacs ??


2. Second, I've seen a feature in vi (UNIX editor) which allows you
can see exactly where the end-of-line is.  It places '$' where the end
is.  This is useful when you suspect that you have trailing white
space in your file (which is a pet peeve of mine to remove, and
sometimes it's meaningful to some bizarre languages such as macro
inputs to cpp for example).

Anybody know how you can do this in emacs ??

             paulr       (Paul Reger)
     Sequent Computer Systems  Beaverton, OR.
 ... {sun,ucbvax!rutgers!ogccse,uunet}!sequent!paulr
#include <standard_disclaimer>

news@merlin.usc.edu (USENET News) (06/05/89)

- 2. Second, I've seen a feature in vi (UNIX editor) which allows you
- can see exactly where the end-of-line is.  It places '$' where the end
- is.  This is useful when you suspect that you have trailing white
- space in your file (which is a pet peeve of mine to remove, and
- sometimes it's meaningful to some bizarre languages such as macro
- inputs to cpp for example).
-
- Anybody know how you can do this in emacs ??
Why not just go to the top of your file, and use replace-regexp to
delete all white space at the end of a line.  With standard keyboard
bindings, you could do: ESC < ESC % \ s SPC + $ RET RET !
If you do this a lot, you could write a little routine to do this:
From: raulmill@aludra.usc.edu (Raul)
Path: aludra.usc.edu!raulmill

(defun remove-trailing-whitespace-buffer ()
  "remove irrelevant whitespace"
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (replace-regexp "\\s +$" "" nil)))

And, if you are really fanatical about this, you could put it into
your write-file-hooks.  A more conservative option would be to bind it
to some key sequence (probably one that begins with C-c).
Raul Miller                                        |
INTERNET:   raulmill@usc.edu                       |
UUCP:       ...uunet!usc!raulmill                  |  55 mph = 82 nc
U.S.SNAIL:  721 E Windsor #4,  GLENDALE CA  91205  |

raulmill@aludra.usc.edu (Raul) (06/05/89)

- 2. Second, I've seen a feature in vi (UNIX editor) which allows you
- can see exactly where the end-of-line is.  It places '$' where the end
- is.  This is useful when you suspect that you have trailing white
- space in your file (which is a pet peeve of mine to remove, and
- sometimes it's meaningful to some bizarre languages such as macro
- inputs to cpp for example).
-
- Anybody know how you can do this in emacs ??
Why not just go to the top of your file, and use replace-regexp to
delete all white space at the end of a line.  With standard keyboard
bindings, you could do: ESC < ESC % \ s SPC + $ RET RET !
If you do this a lot, you could write a little routine to do this:

(defun remove-trailing-whitespace-buffer ()
  "remove irrelevant whitespace"
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (replace-regexp "\\s +$" "" nil)))

And, if you are really fanatical about this, you could put it into
your write-file-hooks.  A more conservative option would be to bind it
to some key sequence (probably one that begins with C-c).

Raul Miller                                        |
INTERNET:   raulmill@usc.edu                       |
UUCP:       ...uunet!usc!raulmill                  |  55 mph = 82 nc
U.S.SNAIL:  721 E Windsor #4,  GLENDALE CA  91205  |