Fix up comment convention on the arch-tag lines.
[bpt/emacs.git] / lisp / textmodes / underline.el
CommitLineData
55535639 1;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs
d501f516 2
f2e3589a 3;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005,
12dc447f 4;; 2006, 2007, 2008 Free Software Foundation, Inc.
58142744 5
e5167999 6;; Maintainer: FSF
d7b4d18f 7;; Keywords: wp
e5167999 8
a2535589
JA
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
5a9dffec 13;; the Free Software Foundation; either version 3, or (at your option)
a2535589
JA
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
b578f267 22;; along with GNU Emacs; see the file COPYING. If not, write to the
4fc5845f
LK
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
a2535589 25
c91c4e6d
ER
26;;; Commentary:
27
28;; This package deals with the primitive form of underlining
29;; consisting of prefixing each character with "_\^h". The entry
30;; point `underline-region' performs such underlining on a region.
31;; The entry point `ununderline-region' removes it.
32
e5167999 33;;; Code:
a2535589 34
f9f9507e 35;;;###autoload
a2535589
JA
36(defun underline-region (start end)
37 "Underline all nonblank characters in the region.
38Works by overstriking underscores.
39Called from program, takes two arguments START and END
40which specify the range to operate on."
8371c2f2 41 (interactive "*r")
a2535589
JA
42 (save-excursion
43 (let ((end1 (make-marker)))
44 (move-marker end1 (max start end))
45 (goto-char (min start end))
46 (while (< (point) end1)
47 (or (looking-at "[_\^@- ]")
af282089 48 (insert "_\b"))
a2535589
JA
49 (forward-char 1)))))
50
f9f9507e 51;;;###autoload
a2535589
JA
52(defun ununderline-region (start end)
53 "Remove all underlining (overstruck underscores) in the region.
54Called from program, takes two arguments START and END
55which specify the range to operate on."
8371c2f2 56 (interactive "*r")
a2535589
JA
57 (save-excursion
58 (let ((end1 (make-marker)))
59 (move-marker end1 (max start end))
60 (goto-char (min start end))
af282089 61 (while (re-search-forward "_\b\\|\b_" end1 t)
a2535589 62 (delete-char -2)))))
d501f516 63
896546cd
RS
64(provide 'underline)
65
cbee283d 66;; arch-tag: e7b48582-c3ea-4386-987a-87415f3c372a
d501f516 67;;; underline.el ends here