(latexenc-find-file-coding-system): Don't inherit the EOL part of the
[emacs.git] / lisp / textmodes / underline.el
blob18f86eb55ded4a3bea6c7d6726691293b5217ecc
1 ;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs
3 ;; Copyright (C) 1985 Free Software Foundation, Inc.
5 ;; Maintainer: FSF
6 ;; Keywords: wp
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; Commentary:
27 ;; This package deals with the primitive form of underlining
28 ;; consisting of prefixing each character with "_\^h". The entry
29 ;; point `underline-region' performs such underlining on a region.
30 ;; The entry point `ununderline-region' removes it.
32 ;;; Code:
34 ;;;###autoload
35 (defun underline-region (start end)
36 "Underline all nonblank characters in the region.
37 Works by overstriking underscores.
38 Called from program, takes two arguments START and END
39 which specify the range to operate on."
40 (interactive "*r")
41 (save-excursion
42 (let ((end1 (make-marker)))
43 (move-marker end1 (max start end))
44 (goto-char (min start end))
45 (while (< (point) end1)
46 (or (looking-at "[_\^@- ]")
47 (insert "_\b"))
48 (forward-char 1)))))
50 ;;;###autoload
51 (defun ununderline-region (start end)
52 "Remove all underlining (overstruck underscores) in the region.
53 Called from program, takes two arguments START and END
54 which specify the range to operate on."
55 (interactive "*r")
56 (save-excursion
57 (let ((end1 (make-marker)))
58 (move-marker end1 (max start end))
59 (goto-char (min start end))
60 (while (re-search-forward "_\b\\|\b_" end1 t)
61 (delete-char -2)))))
63 (provide 'underline)
65 ;;; arch-tag: e7b48582-c3ea-4386-987a-87415f3c372a
66 ;;; underline.el ends here