|
|
1.1 ! root 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: ! 21: (defun underline-region (start end) ! 22: "Underline all nonblank characters in the region. ! 23: Works by overstriking underscores. ! 24: Called from program, takes two arguments START and END ! 25: which specify the range to operate on." ! 26: (interactive "r") ! 27: (save-excursion ! 28: (let ((end1 (make-marker))) ! 29: (move-marker end1 (max start end)) ! 30: (goto-char (min start end)) ! 31: (while (< (point) end1) ! 32: (or (looking-at "[_\^@- ]") ! 33: (insert "_")) ! 34: (forward-char 1))))) ! 35: ! 36: (defun ununderline-region (start end) ! 37: "Remove all underlining (overstruck underscores) in the region. ! 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 (search-forward "_" end1 t) ! 46: (delete-char -2)))))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.