Mercurial > hgrepos > hgweb.cgi > yatex
comparison yatexlib.el @ 515:b6853d450b0a dev
Add a function to examine the point is in %#BEGIN/%#END or not.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Thu, 04 Jan 2018 23:58:07 +0900 |
parents | d675f6d06481 |
children | b1896ef49747 |
comparison
equal
deleted
inserted
replaced
514:8e0822416fc6 | 515:b6853d450b0a |
---|---|
1 ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- | 1 ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- |
2 ;;; | 2 ;;; |
3 ;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org] | 3 ;;; (c)1994-2018 by HIROSE Yuuji.[yuuji@yatex.org] |
4 ;;; Last modified Tue Jan 2 17:50:03 2018 on firestorm | 4 ;;; Last modified Thu Jan 4 13:58:20 2018 on firestorm |
5 ;;; $Id$ | 5 ;;; $Id$ |
6 | 6 |
7 ;;; Code: | 7 ;;; Code: |
8 | 8 |
9 ;; High-precedence compatible function | 9 ;; High-precedence compatible function |
1221 (YaTeX-goto-corresponding-environment) | 1221 (YaTeX-goto-corresponding-environment) |
1222 (goto-char (match-end 0)) | 1222 (goto-char (match-end 0)) |
1223 ;;(end-of-line) ;OUT 2015/1/5 | 1223 ;;(end-of-line) ;OUT 2015/1/5 |
1224 ;;(if (eobp) nil (forward-char 1)) ;OUT 2015/1/5 | 1224 ;;(if (eobp) nil (forward-char 1)) ;OUT 2015/1/5 |
1225 )))) | 1225 )))) |
1226 | |
1227 (defun YaTeX-in-BEGEND-p () | |
1228 "Check if the point is in a %#BEGIN...%#END region. | |
1229 Return the list of beginning and ending point of the region and arg-string | |
1230 if the point is in BEGEND. Otherwise nil." | |
1231 (let ((b "%#BEGIN") bp args (e "%#END") (p (point))) | |
1232 (save-excursion | |
1233 (save-match-data ;emacs-19+ yatex1.80+ | |
1234 (and (re-search-backward b nil t) | |
1235 (progn | |
1236 (setq bp (match-beginning 0)) | |
1237 (goto-char (match-end 0)) ;Start to get args of %#BEGIN | |
1238 (skip-chars-forward " \t") | |
1239 (setq args (YaTeX-buffer-substring (point) (point-end-of-line)))) | |
1240 (re-search-forward e nil t) | |
1241 (> (point) p) | |
1242 (list bp (match-end 0) args)))))) | |
1226 | 1243 |
1227 (defun YaTeX-kill-buffer (buffer) | 1244 (defun YaTeX-kill-buffer (buffer) |
1228 "Make effort to show parent buffer after kill." | 1245 "Make effort to show parent buffer after kill." |
1229 (interactive "bKill buffer: ") | 1246 (interactive "bKill buffer: ") |
1230 (or (get-buffer buffer) | 1247 (or (get-buffer buffer) |