(calendar-other-dates): New function.
[emacs.git] / lisp / textmodes / underline.el
blob06560e04f9db07f9eb111180890718d5ee0382b4
1 ;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs
3 ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005,
4 ;; 2006, 2007, 2008 Free Software Foundation, Inc.
6 ;; Maintainer: FSF
7 ;; Keywords: wp
9 ;; This file is part of GNU Emacs.
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
13 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; any later version.
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.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
26 ;;; Commentary:
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.
33 ;;; Code:
35 ;;;###autoload
36 (defun underline-region (start end)
37 "Underline all nonblank characters in the region.
38 Works by overstriking underscores.
39 Called from program, takes two arguments START and END
40 which specify the range to operate on."
41 (interactive "*r")
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 "[_\^@- ]")
48 (insert "_\b"))
49 (forward-char 1)))))
51 ;;;###autoload
52 (defun ununderline-region (start end)
53 "Remove all underlining (overstruck underscores) in the region.
54 Called from program, takes two arguments START and END
55 which specify the range to operate on."
56 (interactive "*r")
57 (save-excursion
58 (let ((end1 (make-marker)))
59 (move-marker end1 (max start end))
60 (goto-char (min start end))
61 (while (re-search-forward "_\b\\|\b_" end1 t)
62 (delete-char -2)))))
64 (provide 'underline)
66 ;;; arch-tag: e7b48582-c3ea-4386-987a-87415f3c372a
67 ;;; underline.el ends here