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