Mercurial > emacs
annotate lisp/textmodes/underline.el @ 805:10f8af91ab47
Initial revision
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Thu, 16 Jul 1992 21:46:36 +0000 |
parents | fec3f9a1e3e5 |
children | 4f28bd14272c |
rev | line source |
---|---|
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
1 ;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs. |
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
2 |
36 | 3 ;; Copyright (C) 1985 Free Software Foundation, Inc. |
4 | |
5 ;; This file is part of GNU Emacs. | |
6 | |
7 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
8 ;; it under the terms of the GNU General Public License as published by | |
9 ;; the Free Software Foundation; either version 1, or (at your option) | |
10 ;; any later version. | |
11 | |
12 ;; GNU Emacs is distributed in the hope that it will be useful, | |
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ;; GNU General Public License for more details. | |
16 | |
17 ;; You should have received a copy of the GNU General Public License | |
18 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | |
21 | |
258 | 22 ;;;###autoload |
36 | 23 (defun underline-region (start end) |
24 "Underline all nonblank characters in the region. | |
25 Works by overstriking underscores. | |
26 Called from program, takes two arguments START and END | |
27 which specify the range to operate on." | |
28 (interactive "r") | |
29 (save-excursion | |
30 (let ((end1 (make-marker))) | |
31 (move-marker end1 (max start end)) | |
32 (goto-char (min start end)) | |
33 (while (< (point) end1) | |
34 (or (looking-at "[_\^@- ]") | |
35 (insert "_")) | |
36 (forward-char 1))))) | |
37 | |
258 | 38 ;;;###autoload |
36 | 39 (defun ununderline-region (start end) |
40 "Remove all underlining (overstruck underscores) in the region. | |
41 Called from program, takes two arguments START and END | |
42 which specify the range to operate on." | |
43 (interactive "r") | |
44 (save-excursion | |
45 (let ((end1 (make-marker))) | |
46 (move-marker end1 (max start end)) | |
47 (goto-char (min start end)) | |
48 (while (re-search-forward "_\\|_" end1 t) | |
49 (delete-char -2))))) | |
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
50 |
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
51 ;;; underline.el ends here |