yatex

changeset 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 8e0822416fc6
children 603acc1caec7
files yatexlib.el
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/yatexlib.el	Thu Jan 04 23:53:17 2018 +0900
     1.2 +++ b/yatexlib.el	Thu Jan 04 23:58:07 2018 +0900
     1.3 @@ -1,7 +1,7 @@
     1.4  ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*-
     1.5  ;;; 
     1.6 -;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Tue Jan  2 17:50:03 2018 on firestorm
     1.8 +;;; (c)1994-2018 by HIROSE Yuuji.[yuuji@yatex.org]
     1.9 +;;; Last modified Thu Jan  4 13:58:20 2018 on firestorm
    1.10  ;;; $Id$
    1.11  
    1.12  ;;; Code:
    1.13 @@ -1224,6 +1224,23 @@
    1.14  	;;(if (eobp) nil (forward-char 1))	;OUT 2015/1/5
    1.15  	))))
    1.16  
    1.17 +(defun YaTeX-in-BEGEND-p ()
    1.18 +  "Check if the point is in a %#BEGIN...%#END region.
    1.19 +Return the list of beginning and ending point of the region and arg-string
    1.20 +if the point is in BEGEND.  Otherwise nil."
    1.21 +  (let ((b "%#BEGIN") bp args (e "%#END") (p (point)))
    1.22 +    (save-excursion
    1.23 +      (save-match-data			;emacs-19+ yatex1.80+
    1.24 +	(and (re-search-backward b nil t)
    1.25 +	     (progn
    1.26 +	       (setq bp (match-beginning 0))
    1.27 +	       (goto-char (match-end 0))	;Start to get args of %#BEGIN
    1.28 +	       (skip-chars-forward " \t")
    1.29 +	       (setq args (YaTeX-buffer-substring (point) (point-end-of-line))))
    1.30 +	     (re-search-forward e nil t)
    1.31 +	     (> (point) p)
    1.32 +	     (list bp (match-end 0) args))))))
    1.33 +
    1.34  (defun YaTeX-kill-buffer (buffer)
    1.35    "Make effort to show parent buffer after kill."
    1.36    (interactive "bKill buffer: ")