yatex
diff yatexlib.el @ 130:8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
It automatically mark current inner environment or portion of math mode,
then call typeset-region on that region saving it in texput.tex.
author | yuuji@gentei.org |
---|---|
date | Thu, 27 May 2010 16:37:44 +0900 |
parents | ce2deaceb818 |
children | b7b54906ac3b |
line diff
1.1 --- a/yatexlib.el Mon Sep 28 11:37:51 2009 +0900 1.2 +++ b/yatexlib.el Thu May 27 16:37:44 2010 +0900 1.3 @@ -2,7 +2,7 @@ 1.4 ;;; YaTeX and yahtml common libraries, general functions and definitions 1.5 ;;; yatexlib.el 1.6 ;;; (c)1994-2009 by HIROSE Yuuji.[yuuji@yatex.org] 1.7 -;;; Last modified Mon Sep 28 10:46:39 2009 on firestorm 1.8 +;;; Last modified Thu May 27 15:09:44 2010 on firestorm 1.9 ;;; $Id$ 1.10 1.11 ;; General variables 1.12 @@ -1015,28 +1015,31 @@ 1.13 (defun YaTeX-mark-environment () 1.14 "Mark current position and move point to end of environment." 1.15 (interactive) 1.16 + (require 'yatexmth) 1.17 (let ((curp (point))) 1.18 - (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin 1.19 - (progn (goto-char (match-end 0))) 1.20 - (if (= (char-after (point)) ?\\) nil ;if on \\end 1.21 - (skip-chars-backward "^\n\\\\") 1.22 - (or (bolp) (forward-char -1)))) 1.23 - (if (not (YaTeX-end-of-environment)) ;arg1 turns to match-beginning 1 1.24 - (progn 1.25 - (goto-char curp) 1.26 - (error "Cannot found the end of current environment.")) 1.27 - (YaTeX-goto-corresponding-environment) 1.28 - (beginning-of-line) ;for confirmation 1.29 - (if (< curp (point)) 1.30 + (if (YaTeX-in-math-mode-p) 1.31 + (YaTeX-mark-mathenv) 1.32 + (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin 1.33 + (progn (goto-char (match-end 0))) 1.34 + (if (= (char-after (point)) ?\\) nil ;if on \\end 1.35 + (skip-chars-backward "^\n\\\\") 1.36 + (or (bolp) (forward-char -1)))) 1.37 + (if (not (YaTeX-end-of-environment)) ;arg1 turns to match-beginning 1 1.38 (progn 1.39 - (message "Mark this environment?(y or n): ") 1.40 - (if (= (read-char) ?y) nil 1.41 - (goto-char curp) 1.42 - (error "Abort. Please call again at more proper position.")))) 1.43 - (set-mark-command nil) 1.44 - (YaTeX-goto-corresponding-environment) 1.45 - (end-of-line) 1.46 - (if (eobp) nil (forward-char 1))))) 1.47 + (goto-char curp) 1.48 + (error "Cannot found the end of current environment.")) 1.49 + (YaTeX-goto-corresponding-environment) 1.50 + (beginning-of-line) ;for confirmation 1.51 + (if (< curp (point)) 1.52 + (progn 1.53 + (message "Mark this environment?(y or n): ") 1.54 + (if (= (read-char) ?y) nil 1.55 + (goto-char curp) 1.56 + (error "Abort. Please call again at more proper position.")))) 1.57 + (set-mark-command nil) 1.58 + (YaTeX-goto-corresponding-environment) 1.59 + (end-of-line) 1.60 + (if (eobp) nil (forward-char 1)))))) 1.61 1.62 (defun YaTeX-kill-buffer (buffer) 1.63 "Make effort to show parent buffer after kill."