diff --git a/docs/yatexe.tex b/docs/yatexe.tex index dbc8fb8..494a7fb 100644 --- a/docs/yatexe.tex +++ b/docs/yatexe.tex @@ -8,7 +8,7 @@ @iftex @c @syncodeindex fn cp -@c Last modified Sun Jan 4 18:17:02 2015 on firestorm +@c Last modified Thu Jan 15 13:28:10 2015 on firestorm @syncodeindex vr cp @end iftex @@ -77,7 +77,7 @@ @code{\section} etc. (@kbd{C-c b}, @kbd{C-c s}, @kbd{C-c l}, @kbd{C-c m}) @item Enclosing text into La@TeX{} environments or commands - (@kbd{C-u} @var{AboveKeyStrokes}) + (@var{AboveKeyStrokes} after region setting) @item Displaying the structure of text at entering sectioning commands @item Lump shifting of sectioning commands (@ref{view-sectioning}) @item Learning unknown/new La@TeX{} commands for the next completion @@ -146,12 +146,12 @@ @table @kbd @item [prefix] t j - @dots{} invoke latex + @dots{} invoke typesetter @item [prefix] t r - @dots{} invoke latex on region + @dots{} invoke typesetter on region @item [prefix] t e - @dots{} invoke latex on current environment or whole - portion of current formulas in math-mode. + @dots{} `on-the-fly preview' on current environment or whole + portion of current formulas in math-mode @item [prefix] t d @dots{} invoke dvipdfmx after successful typesetting @item [prefix] t k @@ -215,9 +215,16 @@ edit splitting files. The @kbd{[prefix] te} key automatically marks current inner environment -or inner math mode and then call typeset-region with marked region. This +or inner math mode or paragraph, and then call typeset-region with marked +region. This is convenient to quick view of current tabular environment or current -editing formulas. Keeping previewer window for @file{texput.dvi} is handy +editing formulas. If running Emacs has the ability of displaying images, +typeset image will be shown in the next window. Further more, +if you modify the content within that environment, YaTeX performs +`on-the-fly' preview that automatically update preview image as you typed. + +If your Emacs does not supply on-the-fly preview, +keeping previewer window for @file{texput.dvi} is handy for debugging. Since @kbd{[prefix] te} selects the inner-most environment as region, it is not suitable for partial typesetting of doubly or more composed environment. If you want to do partial typesetting for a nested @@ -369,7 +376,7 @@ @code{%#BEGIN} alone at the middle of very long text. Do not forget to erase @code{%#BEGIN} @code{%#END} pair. -@node Lpr format, Controlling which command to invoke, Static region for typesetting, %#notation +@node Lpr format, , Static region for typesetting, %#notation @comment node-name, next, previous, up @section Lpr format @cindex lpr format @@ -464,15 +471,16 @@ kinds of completion type, begin-type, section-type, large-type, etc... @menu -* Begin-type completion:: -* Section-type completion:: -* Large-type completion:: -* Maketitle-type completion:: -* Arbitrary completion:: -* End completion:: -* Accent completion:: -* Image completion:: -* Greek letters completion:: +* Begin-type completion:: +* Section-type completion:: +* Large-type completion:: +* Maketitle-type completion:: +* Arbitrary completion:: +* End completion:: +* Accent completion:: +* Image completion:: +* Greek letters completion:: +* Inserting parentheses:: @end menu @node Begin-type completion, Section-type completion, Completion, Completion @@ -559,26 +567,15 @@ automatically inserted such as @code{\item} for @code{itemize} environment. If you don't want the entry, it can be removed by undoing. - If you want to enclose some paragraphs which have already been -written, invoke the begin-type completion with changing the case -of @kbd{b} of key sequence upper(or invoke it with universal argument -by @kbd{C-u} prefix). + If you want to enclose some paragraphs which have already been written +into environment, invoke the begin-type completion right after region marking. @cindex enclose region into environment - The following example encloses a region with `description' -environment. +If you set @code{transient-mark-mode} to @code{nil} in your +@file{~/.emacs}, typing @kbd{C-space} (@code{set-mark-command}) twice +turns @code{transient-mark-mode} on temporarily. Then, type call +begin-type completion to enclose text into a environment. -@table @kbd -@item [prefix] B D -@itemx (or ESC 1 [prefix] b D) -@itemx (or C-u [prefix] b D) - - @dots{} begin-type completion for region -@end table - - This enclosing holds good for the completing input by @kbd{[prefix] b -SPC}. @kbd{[prefix] B SPC} enclose a region with the environment selected -by completing-read. @node Section-type completion, Large-type completion, Begin-type completion, Completion @comment node-name, next, previous, up @@ -755,9 +752,8 @@ TeX commands to change fonts or sizes, @code{it}, @code{huge} and so on, in the completion table. - Region-based completion is also invoked by changing the letter after -prefix key stroke as @kbd{[prefix] L}. It encloses the region by braces -with large-type command. + Region-based completion is also invoked by calling completion +after region activated. @node Maketitle-type completion, Arbitrary completion, Large-type completion, Completion @comment node-name, next, previous, up @@ -912,7 +908,7 @@ Emacs-Lisp variable @code{YaTeX-math-sign-alist-private}. See also @file{yatexmth.el} for the information of the structure of this variable. -@node Greek letters completion, , Image completion, Completion +@node Greek letters completion, Inserting parentheses, Image completion, Completion @comment node-name, next, previous, up @section Greek letters completion @cindex Greek letters completion @@ -930,6 +926,15 @@ @kbd{;} or @kbd{:} after universal-argument(@kbd{C-u}) which forces @kbd{;} and @kbd{:} to work as math-prefix. +@node Inserting parentheses, , Greek letters completion, Completion +@section Inserting parentheses + + Typing opening parenthesis, one of @code{(}, @code{@{ and @code{[}}, +automatically inserts the closing one. If a opening bracket is typed +after @code{\}, @code{\]} is automatically inserted with computed +indentation. If you stop automatic insertion, type @kbd{C-q} before +opening parenthesis. + @node Local dictionaries, Commenting out, Completion, Top @comment node-name, next, previous, up @chapter Local dictionaries @@ -1700,6 +1705,16 @@ @code{Nil} disables on-the-fly preview. @end defvar +@defvar YaTeX-on-the-fly-math-preview-engine +Function symbol to use on-the-fly preview of MATH environment +started by @kbd{[prefix] t e} (@code{'YaTeX-typeset-environment-by-lmp} +which calls latex-math-preview-expression function if latex-math-preview +is available, otherwise @code{'YaTeX-typeset-environment-by-builtin} which +alls built-in function). + +@code{Nil} disables on-the-fly preview. +@end defvar + @defvar YaTeX-cmd-gimp Command name of GIMP (code{"gimp"}) @end defvar diff --git a/docs/yatexj.tex b/docs/yatexj.tex index 9911316..203929f 100644 --- a/docs/yatexj.tex +++ b/docs/yatexj.tex @@ -13,7 +13,7 @@ @c �m�[�h���������� C-l C-u C-n �S���̃m�[�h�X�V C-l C-u C-e @c ���j���[���₵���� C-l C-u C-m �S���̃��j���[�X�V C-l C-u C-a @c �t�H�[�}�b�g����Ƃ��� C-l C-e C-b -@c Last modified Sun Jan 4 18:15:05 2015 on firestorm +@c Last modified Thu Jan 15 12:42:54 2015 on firestorm @syncodeindex vr cp @end iftex @@ -124,7 +124,7 @@ �R�}���h�̕⊮���� (@kbd{C-c b}, @kbd{C-c s}, @kbd{C-c l}, @kbd{C-c m}) @item ���ɓ��͂����e�L�X�g���‹���R�}���h�����̒��Ɏ�荞�ފ���⊮ -(@kbd{C-u} +�ʏ�⊮�L�[) +(���W�����w���ɒʏ�⊮�L�[) @item �Z�N�V������؂���͎��̕����\���A�E�g���C���\�� @item �Z�N�V�����R�}���h�̈ꊇ�V�t�g (@ref{view-sectioning}) @item �⊮�����̊w�K @@ -228,8 +228,9 @@ @item [prefix] t r @dots{} �^�C�v�Z�b�^�N��(�̈�w��) @item [prefix] t e - @dots{} �^�C�v�Z�b�^�N�� - (�|�C���g�ʒu�̊‹��܂��͐������[�h�̂ݑΏ�) + @dots{} �����^�C�v�Z�b�g&�v�������[ + (�|�C���g�ʒu�̒i���A�‹��܂��͐������[�h�݂̂��^�C�v�Z�b�g���� + �ׂ̃o�b�t�@�ɑg�Ō��ʂ̉摜���o��) @item [prefix] t k @dots{} ���쒆�̃^�C�v�Z�b�^�̒�~ @item [prefix] t b @@ -296,11 +297,20 @@ @subsection �‹��^�C�v�Z�b�g @kbd{[prefix] te} �������ƁA�|�C���g�ʒu�̍ł������̊‹��A�܂��͐������[ -�h���̏ꍇ�͂��̐������[�h�S�̂������I�ɗ̈�I������āA�̈�^�C�v�Z�b�g�� -�Ăяo���܂��Btabular�‹��␔�����[�h�ŕ��G�Ȃ��̂�����Ă���ꍇ�͊m���߂� -�������������m�F�ł���̂ŕ֗��ł��B����� @file{texput.tex} �ɊY�������� -�����o���܂��B�v�������[�A�� @file{texput.dvi} ���J�����܂܂ɂ��Ă����� -�C���Ɗm�F���f�����ł���ł��傤�B +�h���̏ꍇ�͂��̐������[�h�S�́A���邢�͊‹����Ȃ���΂��̒i���������I�� +�̈�I������āA�̈�^�C�v�Z�b�g���Ăяo���܂��B +tabular�‹��␔�����[�h�ŕ��G�Ȃ��̂�����Ă���ꍇ�͊m���߂������������� +�m�F�ł���̂ŕ֗��ł��BEmacs���摜�\���”\�ȏꍇ�́A +�����^�C�v�Z�b�g�̌��ʂ��摜�����ėׂ̃E�B���h�E�ɕ\�����܂��B�܂��A +����̊‹��ŌĂяo�����ꍇ�́A�‹����̕���������������x�Ɏ����I�� +�v���r���[�摜���X�V���܂�(on-the-fly�v�������[)�B +�����\������Ȃ��ꍇ�̓v�������[�A�� @file{texput.dvi} +���J�����܂܂ɂ��Ă����ΏC���Ɗm�F���f�����ł���ł��傤�B + + �摜�v�������[�̏ꍇ�̑傫��(�𑜓x)�̓f�t�H���g��200dpi(������300dpi)�ł��B +dpi��ς������ꍇ��LaTeX�\�[�X�̂ǂ����� +@code{%#PREVIEWDPI 150} +�̂悤��dpi�l�������Ă��������B @node Calling previewer, Print out, Calling typesetter, Invocation @comment node-name, next, previous, up @@ -570,15 +580,16 @@ ���ł��܂��B @menu -* begin�^�⊮:: -* section�^�⊮:: -* large�^�⊮:: -* maketitle�^�⊮:: +* begin�^�⊮:: +* section�^�⊮:: +* large�^�⊮:: +* maketitle�^�⊮:: * Arbitrary completion:: �����⊮ -* end�⊮:: +* end�⊮:: * Accent mark completion:: �A�N�Z���g�L���⊮ * Image completion:: �����L���C���[�W�⊮ * Greek letter completion:: �M���V�������⊮ +* Inserting parens:: @end menu @node begin�^�⊮, section�^�⊮, Completion, Completion @@ -678,17 +689,19 @@ @cindex �‚����߂�[�Ƃ����߂�] �Ⴆ�΂���p���O���t�� description �‹��̒��ɓ��ꂽ���Ƃ��́A -���̃p���O���t���}�[�N���Ă���A +���̃p���O���t���}�[�N���Ă���A�⊮�@�\���Ăяo���Ă�������(description +�‹��̏ꍇ�� @kbd{[prefix] b D})�B -@table @kbd -@item [prefix] B D -@itemx (�܂��� ESC 1 [prefix] b D) -@itemx (�܂��� C-u [prefix] b D �Ȃ�) -@end table +�I�����ꂽ�̈������܂��B����������� @code{transient-mark-mode} �� t +(Emacs�̕W��)�ɂȂ��Ă���ꍇ�݂̂ŁA���i +@code{transient-mark-mode} �� @code{nil} �ɂ��Ă���ꍇ�́A +�⊮�L�[�O�� @code{universal-argument} �w��(@kbd{C-u}) +���^�C�v���Ă��� @kbd{[prefix] b D} �ȂǁA�⊮�L�[�� +�^�C�v����Ί���⊮�ɂȂ�܂��B +�Ȃ�Emacs22�ȍ~�ł���� @code{transient-mark-mode} �������� +@code{set-mark-command} (@kbd{C-space})�̘A�łňꎞ�I�� +@code{transient-mark-mode} ���L���ɂȂ�܂��B -�ƃ^�C�v���Ă��������B����́A@kbd{[prefix] b SPC}�̕⊮���͂ɂ����Ă͂܂�A -@kbd{b} ��啶���ɕς��āA@kbd{[prefix] B SPC} �ƃ^�C�v����΁A���炩���� -�}�[�N���Ă��������W�������Abegin �� end �̊‹��Ŋ���܂��B @node section�^�⊮, large�^�⊮, begin�^�⊮, Completion @comment node-name, next, previous, up @@ -801,8 +814,11 @@ @subsection ���ɏ������e�L�X�g������ @cindex ����[������] - �܂��A�N���R�}���h��@kbd{s}��啶���ɕς��ċN������ƁA���炩���ߏ� -�������͂� section �^�R�}���h�̑������Ƃ��Ċ���܂��B + �܂��Asection�^�⊮�@�\�̌Ăяo�����ɗ̈�I����Ԃɂ��Ă����� +�̈���̃e�L�X�g�� section �^�R�}���h�̑������Ƃ��Ċ���܂��B +��������i @code{transient-mark-mode} �� @code{nil} �ɂ��Ă���ꍇ�� +@kbd{C-u} �̂��Ƃɕ⊮�L�[���^�C�v����΋����I�Ɋ���⊮�ɂȂ�܂��B + @node Recursive completion, view-sectioning, Enclose section-type command, section�^�⊮ @comment node-name, next, previous, up @@ -911,8 +927,7 @@ �܂��Abegin�^�⊮�̎��Ɠ��l�A��ɏ����Ă��܂�����A�̕��͂̕����̃T�C�Y ��ς������Ǝv����������܂����A���̂悤�Ȏ��́A�T�C�Y��傫����ς������� -���͈̔͂��}�[�N���Ă���A�Ăяo���L�[�� @kbd{[prefix] L} �ƁA�啶���� L -�ɕς��ČĂяo���΁A���̃��W�����S�̂��A�u���[�X�ň͂܂�܂��B +���͈̔͂��}�[�N���Ă���large�^�⊮���Ă�ł��������B @node maketitle�^�⊮, Arbitrary completion, large�^�⊮, Completion @comment node-name, next, previous, up @@ -1082,7 +1097,7 @@ �Ƃ��Ă��������B @cindex YaTeX-math-sign-alist-private -@node Greek letter completion, , Image completion, Completion +@node Greek letter completion, Inserting parens, Image completion, Completion @comment node-name, next, previous, up @section �M���V�������⊮ @cindex �M���V�������⊮[���肵������ق���] @@ -1100,6 +1115,18 @@ �Ƃɂ��A�����I�ɃC���[�W�⊮�ɓ��邱�Ƃ��ł��܂��B�܂��A���̎��ɂǂ̂悤 �ȏ�ԂŐ����‹�������Ɏ��s�����������A���������B +@node Inserting parens, , Greek letter completion, Completion +@section ���ʓ��͕⏕ +@cindex ���ʓ��͕⏕[���‚��ɂ䂤��悭�ق���] + + 3��ނ��銇�� () {} [] �̊J�����ʂ���ꂽ�Ƃ��ɕ‚����ʂ������I�ɓ���܂��B +@code{\} �̒���ɂ� @code{[} ������ƍs�𕪂��ăC���f���g�𑵂��A +�������͂ɔ����܂��B���̑� La@TeX{} �̃}�N���ɉ����Ċ��ʂ̒ލ��̎�ꂽ +��Ԃɓ����܂��B�J�����ʂ��̂��̂�1�‚������ꂽ���Ƃ��� @kbd{C-q} �� +�N�H�[�g���͂��邩�A@kbd{[prefix] w m} �ŏC�����[�h��OFF�ɂ��Ă��������B + + �̈�I�����Ă���J�����ʂ�����Ƃ��̗̈�����̎�ނ̊��ʂŊ���܂��B + @node Local dictionary, Commenting out, Completion, Top @comment node-name, next, previous, up @chapter ���[�J������ @@ -1898,11 +1925,18 @@ @end defvar @defvar YaTeX-on-the-fly-preview-interval -@kbd{[prefix] t e}�Ŋ‹������v�������[������ꍇ�̕ϊ������܂ł� +@kbd{[prefix] t e}�Ŋ‹�����preview������ꍇ�̕ϊ������܂ł� �����쎞��(�b) (0.9) @code{nil} �̏ꍇ�͑����v�������[�����Ȃ��B @end defvar +@defvar YaTeX-on-the-fly-math-preview-engine +@kbd{[prefix] t e}�Ő����‹��𑦎�preview���鎞�ɗp����G���W�� +(latex-math-preview�����p�”\�ȂƂ��� latex-math-preview-expression ���Ă� +@code{'YaTeX-typeset-environment-by-lmp} +�����łȂ��Ƃ��͓����֐����Ă� @code{'YaTeX-typeset-environment-by-builtin}) +@end defvar + @defvar YaTeX-cmd-gimp GIMP���N������R�}���h (code{"gimp"}) @end defvar diff --git a/yahtml.el b/yahtml.el index d2facb5..86d9bf6 100644 --- a/yahtml.el +++ b/yahtml.el @@ -1,6 +1,6 @@ ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- ;;; (c) 1994-2013 by HIROSE Yuuji [yuuji(@)yatex.org] -;;; Last modified Mon Dec 22 22:17:24 2014 on firestorm +;;; Last modified Thu Jan 15 11:34:59 2015 on firestorm ;;; $Id$ (defconst yahtml-revision-number "1.77" @@ -830,7 +830,8 @@ (defun yahtml-insert-begend (&optional region env) "Insert ... ." (interactive "P") - (setq yahtml-current-completion-type 'multiline) + (setq yahtml-current-completion-type 'multiline + region (or region (YaTeX-region-active-p))) (let*((completion-ignore-case t) (cmd (or env @@ -1646,7 +1647,8 @@ (defun yahtml-insert-tag (region-mode &optional tag) "Insert and put cursor inside of them." (interactive "P") - (setq yahtml-current-completion-type 'inline) + (setq yahtml-current-completion-type 'inline + region-mode (or region-mode (YaTeX-region-active-p))) (or tag (let ((completion-ignore-case t)) (setq tag @@ -2493,13 +2495,6 @@ (match-beginning 0)))) (fset 'move-to-column yahtml-saved-move-to-column))))) -;(defun yahtml-indent-new-commnet-line () -; (unwind-protect -; (progn -; (fset 'move-to-column 'yahtml-move-to-column) -; (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft)))) -; (fset 'move-to-column yahtml-saved-move-to-column))) - ;;; ;;; ---------- move forward/backward field ---------- ;;; diff --git a/yatex.el b/yatex.el index 7d24292..20bf0c7 100644 --- a/yatex.el +++ b/yatex.el @@ -1,6 +1,6 @@ ;;; yatex.el --- Yet Another tex-mode for emacs //�쒹// -*- coding: sjis -*- ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Jan 15 10:42:01 2015 on firestorm +;;; Last modified Thu Jan 15 23:15:51 2015 on firestorm ;;; $Id$ ;;; The latest version of this software is always available at; ;;; http://www.yatex.org/ @@ -8,7 +8,7 @@ ;;; Code: (require 'comment) (require 'yatexlib) -(defconst YaTeX-revision-number "1.78.5" +(defconst YaTeX-revision-number "1.78.6" "Revision number of running yatex.el") ;---------- Local variables ---------- @@ -864,16 +864,18 @@ you can put REGION into that environment between \\begin and \\end." (interactive "P") (let* - ((mode (if arg " region" "")) + ((region-p (or arg (YaTeX-region-active-p))) + (mode (if region-p " region" "")) (env - (YaTeX-read-environment - (format "Begin environment%s(default %s): " mode YaTeX-env-name)))) + (save-excursion ;for Emacs24 work-around to avoid point warp + (YaTeX-read-environment + (format "Begin environment%s(default %s): " mode YaTeX-env-name))))) (if (string= env "") (setq env YaTeX-env-name)) (setq YaTeX-env-name env) (YaTeX-update-table (list YaTeX-env-name) 'env-table 'user-env-table 'tmp-env-table) - (YaTeX-insert-begin-end YaTeX-env-name arg))) + (YaTeX-insert-begin-end YaTeX-env-name region-p))) (defun YaTeX-make-begin-end-region () "Call YaTeX-make-begin-end with ARG to specify region mode." @@ -928,7 +930,8 @@ Optional 4th arg CMD is LaTeX command name, for non-interactive use." (interactive "P") (setq YaTeX-current-completion-type 'section) - (if (equal arg '(4)) (setq beg (region-beginning) end (region-end))) + (if (or (equal arg '(4)) (YaTeX-region-active-p)) + (setq beg (region-beginning) end (region-end))) (unwind-protect (let* ((source-window (selected-window)) @@ -1028,7 +1031,9 @@ \(key binding for universal-argument is \\[universal-argument]\)" (interactive "P") (YaTeX-sync-local-table 'tmp-fontsize-table) - (let* ((mode (if arg "region" "")) + (let* ((region-p (if (or arg (YaTeX-region-active-p)) + (cons (region-beginning) (region-end)))) + (mode (if region-p "region" "")) (fontsize (or fontsize (YaTeX-read-fontsize @@ -1050,12 +1055,14 @@ (setq fontsize (cdr (assoc YaTeX-fontsize-name LaTeX2e-fontstyle-alist))) (setq YaTeX-fontsize-name fontsize)) - (if arg - (save-excursion - (if (> (point) (mark)) (exchange-point-and-mark)) + (if region-p + (let ((b (car region-p)) + (e (set-marker (make-marker) (cdr region-p)))) + (goto-char b) (insert "{\\" YaTeX-fontsize-name " ") - (exchange-point-and-mark) - (insert "}")) + (goto-char e) + (insert "}") + (set-marker e nil)) (insert (concat "{\\" YaTeX-fontsize-name " }")) (forward-char -1) (if YaTeX-current-position-register @@ -1267,7 +1274,7 @@ (get 'YaTeX-insert-braces 'begend-guide))))))))) env macro not-literal b e) (cond - ((and (fboundp 'region-active-p) (region-active-p)) + ((YaTeX-region-active-p) (YaTeX-insert-braces-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) @@ -1388,6 +1395,8 @@ (interactive "p") (let ((col (1- (current-column)))) (cond + ((YaTeX-region-active-p) + (YaTeX-insert-brackets-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) @@ -1434,6 +1443,8 @@ "Insert parenthesis pair." (interactive "p") (cond + ((YaTeX-region-active-p) + (YaTeX-insert-parens-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) ((save-excursion @@ -2668,64 +2679,6 @@ YaTeX-verbatim-environments)))))) (store-match-data md)))) -(defun YaTeX-in-environment-p (env) - "Return if current LaTeX environment is ENV. -ENV is given in the form of environment's name or its list." - (let ((md (match-data)) (nest 0) p envrx) - (cond - ((atom env) - (setq envrx - (concat "\\(" - (regexp-quote - (YaTeX-replace-format-args - YaTeX-struct-begin env "" "")) - "\\>\\)\\|\\(" - (regexp-quote - (YaTeX-replace-format-args - YaTeX-struct-end env "" "")) - "\\)")) - (save-excursion - (setq p (catch 'open - (while (YaTeX-re-search-active-backward - envrx YaTeX-comment-prefix nil t) - (if (match-beginning 2) - (setq nest (1+ nest)) - (setq nest (1- nest))) - (if (< nest 0) - (throw 'open (cons env (match-beginning 0))))))))) - ((listp env) - (setq p - (or (YaTeX-in-environment-p (car env)) - (and (cdr env) (YaTeX-in-environment-p (cdr env))))))) - (store-match-data md) - p;(or p (YaTeX-in-verb-p (match-beginning 0))) - )) - -(defun YaTeX-quick-in-environment-p (env) - "Check quickly but unsure if current environment is ENV. -ENV is given in the form of environment's name or its list. -This function returns correct result only if ENV is NOT nested." - (save-excursion - (let ((md (match-data)) m0 (p (point)) rc clfound) - (cond - ((listp env) - (or (YaTeX-quick-in-environment-p (car env)) - (and (cdr env) (YaTeX-quick-in-environment-p (cdr env))))) - (t - (unwind-protect - (if (prog1 - (YaTeX-search-active-backward - (YaTeX-replace-format-args YaTeX-struct-begin env "" "") - YaTeX-comment-prefix nil t) - (setq m0 (match-beginning 0))) - (if (YaTeX-search-active-forward - (YaTeX-replace-format-args - YaTeX-struct-end env) - YaTeX-comment-prefix p t nil) - nil ;if \end{env} found, return nil - (cons env m0))) ;else, return meaningful values - (store-match-data md))))))) - ;; Filling \item (defun YaTeX-remove-trailing-comment (start end) "Remove trailing comment from START to end." diff --git a/yatex.new b/yatex.new index 6e9bf6b..416005a 100644 --- a/yatex.new +++ b/yatex.new @@ -4,6 +4,9 @@ 1.79 === yatex === �����‹��ȂǓ���‹����� [prefix] t e �� On-the-fly preview �����B YaTeX-help-file �̃f�t�H���g�ʒu�� site-lisp/yatex/help/ �ɕύX�B + �̈抈�����ɌĂяo���⊮�͗̈抇��ɂȂ�悤�ɂ����B + === yahtml === + �̈抈�����ɌĂяo���⊮�͗̈抇��ɂȂ�悤�ɂ����B ... diff --git a/yatexlib.el b/yatexlib.el index 39803d9..edb1563 100644 --- a/yatexlib.el +++ b/yatexlib.el @@ -1,7 +1,7 @@ ;;; yatexlib.el --- YaTeX and yahtml common libraries ;;; ;;; (c)1994-2013 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Jan 4 21:04:29 2015 on firestorm +;;; Last modified Thu Jan 15 11:22:54 2015 on firestorm ;;; $Id$ ;;; Code: @@ -974,6 +974,64 @@ (progn (skip-chars-forward open) (1+ (point))) (progn (skip-chars-forward close) (point))))))) +(defun YaTeX-in-environment-p (env) + "Return if current LaTeX environment is ENV. +ENV is given in the form of environment's name or its list." + (let ((md (match-data)) (nest 0) p envrx) + (cond + ((atom env) + (setq envrx + (concat "\\(" + (regexp-quote + (YaTeX-replace-format-args + YaTeX-struct-begin env "" "")) + "\\>\\)\\|\\(" + (regexp-quote + (YaTeX-replace-format-args + YaTeX-struct-end env "" "")) + "\\)")) + (save-excursion + (setq p (catch 'open + (while (YaTeX-re-search-active-backward + envrx YaTeX-comment-prefix nil t) + (if (match-beginning 2) + (setq nest (1+ nest)) + (setq nest (1- nest))) + (if (< nest 0) + (throw 'open (cons env (match-beginning 0))))))))) + ((listp env) + (setq p + (or (YaTeX-in-environment-p (car env)) + (and (cdr env) (YaTeX-in-environment-p (cdr env))))))) + (store-match-data md) + p;(or p (YaTeX-in-verb-p (match-beginning 0))) + )) + +(defun YaTeX-quick-in-environment-p (env) + "Check quickly but unsure if current environment is ENV. +ENV is given in the form of environment's name or its list. +This function returns correct result only if ENV is NOT nested." + (save-excursion + (let ((md (match-data)) m0 (p (point)) rc clfound) + (cond + ((listp env) + (or (YaTeX-quick-in-environment-p (car env)) + (and (cdr env) (YaTeX-quick-in-environment-p (cdr env))))) + (t + (unwind-protect + (if (prog1 + (YaTeX-search-active-backward + (YaTeX-replace-format-args YaTeX-struct-begin env "" "") + YaTeX-comment-prefix nil t) + (setq m0 (match-beginning 0))) + (if (YaTeX-search-active-forward + (YaTeX-replace-format-args + YaTeX-struct-end env) + YaTeX-comment-prefix p t nil) + nil ;if \end{env} found, return nil + (cons env m0))) ;else, return meaningful values + (store-match-data md))))))) + (defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr) "Go to corresponding begin/end enclosure. Optional argument ALLOW-MISMATCH allows mismatch open/clese. Use this @@ -1299,6 +1357,9 @@ 'buffer-substring-no-properties 'buffer-substring)) +(defun YaTeX-region-active-p () + (and (fboundp 'region-active-p) (region-active-p))) + ;;; ;; hilit19 vs. font-lock ;;;