Mercurial > hgrepos > hgweb.cgi > yatex
diff yatexlib.el @ 482:9132c20372ec dev
Remove comment.el and incorporate it into yatexlib.el
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 10 Sep 2017 21:08:14 +0859 |
parents | 723f136edde5 |
children | 6dcd746db62e |
line wrap: on
line diff
--- a/yatexlib.el Sun Sep 10 17:03:34 2017 +0859 +++ b/yatexlib.el Sun Sep 10 21:08:14 2017 +0859 @@ -1,7 +1,7 @@ ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- ;;; ;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Sep 10 09:53:33 2017 on firestorm +;;; Last modified Sun Sep 10 18:12:33 2017 on firestorm ;;; $Id$ ;;; Code: @@ -1666,6 +1666,34 @@ (/ (nth 2 before) mil)))))) ;;; +;; Moved from comment.el +;;; +(defun YaTeX-comment-region-sub (string &optional beg end once) + "Inserts STRING at the beginning of every line between BEG and END." + (if (not (stringp string)) (setq string YaTeX-comment-prefix)) + (let ((b (or beg (region-beginning))) (e (or end (region-end)))) + (save-excursion + (goto-char (max b e)) + (if (bolp) + (forward-line -1)) + (save-restriction + (narrow-to-region (min b e) (point)) + (goto-char (point-min)) + (message "%s" string) + (while (re-search-forward "^" nil t) + (insert string)))))) + +(defun YaTeX-uncomment-region-sub (string &optional beg end once) + "Deletes STRING from the beginning of every line between BEG and END." + (save-excursion + (save-restriction + (narrow-to-region (or beg (region-beginning)) (or end (region-end))) + (goto-char (point-min)) + (while (re-search-forward (concat "^" string) nil t) + (replace-match "") + (if once (end-of-line)))))) + +;;; ;; Functions for the Installation time ;;;