") - (save-excursion - (insert "
")))) + (save-excursion ;insert "/p" first to memorize "p" + (yahtml-insert-single "/p")) ;in the last-completion variable + (yahtml-insert-single "p"))) ;;; ---------- Jump ---------- (defun yahtml-on-href-p () @@ -1028,7 +1032,7 @@ (defun yahtml-jump-to-name (name) "Jump to html's named tag." - (setq name (format "name\\s *=\\s *\"?%s\"?" name)) + (setq name (format "\\(name\\|id\\)\\s *=\\s *\"?%s\"?" name)) (or (and (re-search-forward name nil t) (goto-char (match-beginning 0))) (and (re-search-backward name nil t) (goto-char (match-beginning 0))) (message "Named tag `%s' not found" (substring href 1)))) @@ -1110,6 +1114,61 @@ (concat yahtml-image-viewer " " image)) (message "Invoking %s %s...Done" yahtml-image-viewer image))))) +(defun yahtml-get-attrvalue (attr) + "Extract current tag's attribute value from buffer." + (let (e (case-fold-search t)) + (save-excursion + (or (looking-at "<") + (progn (skip-chars-backward "^<") (backward-char 1))) + (setq e (save-excursion (forward-list 1) (point))) + (if (and + (re-search-forward (concat "\\b" attr "\\b") e t) + (progn (skip-chars-forward " \t\n=") + (looking-at "\"?\\([^\"> \t\n]+\\)\"?"))) + (YaTeX-match-string 1))))) + +(defun yahtml-goto-corresponding-source (&optional other) + "Goto applet's source." + (let ((env (yahtml-current-tag)) s (p (point))) + (cond + ((string-match "applet" env) + (if (setq s (yahtml-get-attrvalue "code")) + (progn + (setq s (YaTeX-match-string 1) + s (concat + (substring s 0 (string-match "\\.[A-Za-z]+$" s)) + ".java")) + (if other (YaTeX-switch-to-buffer-other-window s) + (YaTeX-switch-to-buffer s)) + s) ;return source file name + (message "No applet source specified") + (sit-for 1) + nil)) + ((string-match "!--#include" env) + (cond + ((setq s (yahtml-get-attrvalue "file")) ; + (if other (YaTeX-switch-to-buffer-other-window s) + (YaTeX-switch-to-buffer s)) + s) + ((setq s (yahtml-get-attrvalue "virtual")); + (setq s (yahtml-url-to-path s)) + (if other (YaTeX-switch-to-buffer-other-window s) + (YaTeX-switch-to-buffer s)) + s))) + ((and (string-match "!--#exec" env) + (setq s (yahtml-get-attrvalue "cmd"))) + (setq s (substring s 0 (string-match " \t\\?" s))) ;get argv0 + (let ((b " *yahtmltmp*")) ;peek a little + (unwind-protect + (progn + (set-buffer (get-buffer-create b)) + (insert-file-contents s nil 0 100) + (if (looking-at "#!") + (if other (YaTeX-switch-to-buffer-other-window s) + (YaTeX-switch-to-buffer s)))) + (kill-buffer (get-buffer b))) + (get-file-buffer s)))))) + (defun yahtml-goto-corresponding-* (&optional other) "Go to corresponding object." (interactive) @@ -1117,6 +1176,7 @@ ((yahtml-goto-corresponding-href other)) ((yahtml-goto-corresponding-img)) ((yahtml-goto-corresponding-begend)) + ((yahtml-goto-corresponding-source other)) (t (message "I don't know where to go.")) )) @@ -1132,7 +1192,7 @@ ;;; ---------- killing ---------- (defun yahtml-kill-begend (&optional whole) - (let ((tag (yahtml-on-begend-p)) p q r) + (let ((tag (yahtml-on-begend-p)) p q r bbolp) (if tag (save-excursion (or (looking-at "<") @@ -1147,23 +1207,26 @@ (setq q (point))) ;now q has end-line's (point) (if (not whole) (kill-region - (progn (skip-chars-backward " \t") (if (bolp) (point) q)) + (progn (skip-chars-backward " \t") + (if (setq bbolp (bolp)) (point) q)) (progn (forward-list 1) (setq r (point)) (skip-chars-forward " \t") - (if (and (eolp) (not (eobp))) (1+ (point)) r)))) + (if (and bbolp (eolp) (not (eobp))) (1+ (point)) r)))) (goto-char p) (skip-chars-backward " \t") (if (not whole) (progn (kill-append (buffer-substring - (setq p (if (bolp) (point) p)) + (setq p (if (setq bbolp (bolp)) (point) p)) (setq q (progn (forward-list 1) (setq r (point)) (skip-chars-forward " \t") - (if (and (eolp) (not (eobp))) (1+ (point)) r)))) + (if (and bbolp (eolp) (not (eobp))) + (1+ (point)) + r)))) t) (delete-region p q)) (kill-region @@ -1271,6 +1334,7 @@ (setq tag (if yahtml-prefer-upcases (upcase tag) (downcase tag))) (insert (format "%s%s" tag (yahtml-addin tag))) (goto-char q) + (set-marker q nil) (delete-region (point) (progn (skip-chars-forward "^>") (point))) (insert tag)))) t)))) @@ -1305,6 +1369,8 @@ 'yahtml-tmp-form-table))) (delete-region beg end) (goto-char beg) + (set-marker beg nil) + (set-marker end nil) (insert new) t) (goto-char p) @@ -1388,8 +1454,10 @@ (defun yahtml-fill-paragraph (arg) (interactive "P") - (let*((case-fold-search t) (p (point)) + (let*((case-fold-search t) (p (point)) fill-prefix (e (or (yahtml-inner-environment-but "^\\(a\\|p\\)\\b" t) "html")) + indent + (startp (get 'YaTeX-inner-environment 'point)) (prep (string-match "^pre$" e)) (ps1 (if prep (default-value 'paragraph-start) paragraph-start)) @@ -1401,6 +1469,12 @@ (progn (if prep (fset 'move-to-column 'yahtml-move-to-column)) + (save-excursion + (beginning-of-line) + (indent-to-column (yahtml-this-indent)) + (setq fill-prefix + (buffer-substring (point) (point-beginning-of-line))) + (delete-region (point) (point-beginning-of-line))) (fill-region-as-paragraph (progn (re-search-backward paragraph-start nil t) (or (save-excursion @@ -1414,7 +1488,9 @@ (point))) (progn (goto-char p) (re-search-forward ps2 nil t) - (match-beginning 0)))) + (match-beginning 0) + + ))) (fset 'move-to-column yahtml-saved-move-to-column))))) ;(defun yahtml-indent-new-commnet-line () @@ -1450,9 +1526,8 @@ (and (bolp) (skip-chars-forward " \t"))) (yahtml-indent-line-real)))) -(defun yahtml-indent-line-real () - (interactive) - (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir") +(defun yahtml-this-indent () + (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|font") (itemizing-envs "^\\([uod]l\\|menu\\|dir\\)$") (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b") inenv p col peol (case-fold-search t)) @@ -1471,17 +1546,16 @@ (skip-chars-forward " \t") (cond ;lookup current line's tag ((looking-at (concat "\\(" envs "\\)>")) - (YaTeX-reindent col)) + col) ((looking-at itms) - (YaTeX-reindent (+ col yahtml-environment-indent))) + (+ col yahtml-environment-indent)) ((and yahtml-hate-too-deep-indentation (looking-at (concat "<\\(" envs "\\)"))) - (YaTeX-reindent (+ col (* 2 yahtml-environment-indent)))) + (+ col (* 2 yahtml-environment-indent))) ((and (< p (point)) (string-match itemizing-envs inenv) (save-excursion (and - ;;(re-search-backward itms p t) (setq op (point)) (goto-char p) (re-search-forward itms op t) @@ -1492,22 +1566,28 @@ (setq col (if (looking-at "$") (+ col yahtml-environment-indent) (current-column))))))) - (YaTeX-reindent col)) + col) (t - (YaTeX-reindent (+ col yahtml-environment-indent))))))) - (and (bolp) (skip-chars-forward " \t")) - (if (and (setq inenv (yahtml-on-begend-p)) - (string-match - (concat "^\\<\\(" yahtml-struct-name-regexp "\\)") inenv)) - (save-excursion - (setq peol (point-end-of-line)) - (or (= (char-after (point)) ?<) - (progn (skip-chars-backward "^<") (forward-char -1))) - (setq col (current-column)) - (if (and (yahtml-goto-corresponding-begend t) - (> (point) peol)) ;if on the different line - (YaTeX-reindent col))))) - (and (bolp) (skip-chars-forward " \t")))) + (+ col yahtml-environment-indent))))) + (t col))))) + +(defun yahtml-indent-line-real () + "Indent current line." + (interactive) + (YaTeX-reindent (yahtml-this-indent)) + (if (bolp) (skip-chars-forward " \t")) + (let (peol col) + (if (and (setq inenv (yahtml-on-begend-p)) + (string-match + (concat "^\\<\\(" yahtml-struct-name-regexp "\\)") inenv)) + (save-excursion + (setq peol (point-end-of-line)) + (or (= (char-after (point)) ?<) + (progn (skip-chars-backward "^<") (forward-char -1))) + (setq col (current-column)) + (if (and (yahtml-goto-corresponding-begend t) + (> (point) peol)) ;if on the different line + (YaTeX-reindent col)))))) ;(defun yahtml-fill-item () ; "Fill item HTML version" @@ -1768,7 +1848,7 @@ ;; include&exec ("" include) ;; string - (hilit-string-find 39 string) + (hilit-string-find ?\\ string) (yahtml-hilit-region-tag "\\(em\\|strong\\)" bold) ("?[uod]l>" 0 decl) ("<\\(di\\|dt\\|li\\|dd\\)>" 0 label) @@ -1799,6 +1879,7 @@ (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist) hilit-patterns-alist)))) +(run-hooks 'yahtml-load-hook) (provide 'yahtml) ; Local variables: diff --git a/yatex.el b/yatex.el index 533d741..523becf 100644 --- a/yatex.el +++ b/yatex.el @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; Yet Another tex-mode for emacs. -;;; yatex.el rev. 1.65 -;;; (c )1991-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Tue Dec 16 22:15:26 1997 on crx +;;; yatex.el rev. 1.66 +;;; (c )1991-1998 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] +;;; Last modified Mon Oct 26 21:05:14 1998 on firestorm ;;; $Id$ ;; This program is free software; you can redistribute it and/or modify @@ -16,22 +16,16 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;; along with this program; see the file COPYING. If not, write to the +;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA +;; 02111-1307, USA. (require 'comment) (require 'yatexlib) -(defconst YaTeX-revision-number "1.65" +(defconst YaTeX-revision-number "1.66" "Revision number of running yatex.el" ) ;---------- Local variables ---------- -;;; -;; Initialize local variable for yatex-mode. -;; Preserving user preferred definitions. -;; ** Check all of these defvar-ed values ** -;; ** and setq other values more suitable ** -;; ** for your site, if needed. ** -;;; (defvar YaTeX-prefix "\C-c" "*Prefix key to call YaTeX functions. You can select favorite prefix key by setq in your ~/.emacs." @@ -139,7 +133,7 @@ "*Regular expression of item command." ) (defvar YaTeX-sectioning-regexp - "\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b" + "part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\(\\*?\\|\\b\\)" "*LaTeX sectioning commands regexp." ) (defvar YaTeX-paragraph-start @@ -155,6 +149,7 @@ (concat "^[ \t]*%\\|^[ \t]*$\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\(" YaTeX-sectioning-regexp ;sectioning commands "\\|begin{\\|end{" ;special declaration + "\\|\\[\\|\\]" "\\|newpage\\b\\|vspace\\b" "\\)") "*Paragraph delimiter regexp of common LaTeX source. Use this value @@ -182,6 +177,7 @@ (concat "array\\*?\\|eqnarray\\*?\\|tabbing\\|tabular\\*?\\|" ;LaTeX "align\\*?\\|split\\*?\\|aligned\\*?\\|alignat\\*?\\|" ;AMS-LaTeX + "[bpvV]?matrix\\|smallmatrix\\|cases\\|" ;AMS-LaTeX "xalignat\\*?\\|xxalignat\\*?") ;AMS-LaTeX "*Regexp of environments where `&' becomes field delimiter.") (defvar YaTeX-uncomment-once t @@ -241,8 +237,13 @@ ("newcommand" 2) ("renewcommand" 2) ("setcounter" 2) ("newenvironment" 3) ("newtheorem" 2) ("cline") ("framebox") ("savebox" 2) ("sbox" 2) ("newsavebox") ("usebox") - ("date") ("put") ("ref") - ("frac" 2) ("multicolumn" 3) ("shortstack") + ("date") ("put") ("ref") ("pageref") + ("multicolumn" 3) ("shortstack") + ;; for mathmode accent + ("tilde") ("hat") ("check") ("bar") ("dot") ("ddot") ("vec") + ("widetilde") ("widehat") ("overline") ("overrightarrow") + ;; section types in mathmode + ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") ) "Default completion table for section-type completion." ) @@ -278,13 +279,14 @@ (defvar singlecmd-table (append - '(("maketitle") ("sloppy") ("protect") + '(("maketitle") ("makeindex") ("sloppy") ("protect") ("LaTeX") ("TeX") ("item") ("item[]") ("appendix") ("hline") ;;("rightarrow") ("Rightarrow") ("leftarrow") ("Leftarrow") - ("pagebreak") ("newpage") ("clearpage") ("cleardoublepage") + ("pagebreak") ("nopagebreak") + ("newpage") ("clearpage") ("cleardoublepage") ("footnotemark") ("verb") ("verb*") ("linebreak") ("pagebreak") ("noindent") ("indent") - ("left") ("right") + ("left") ("right") ("dots") ) (if YaTeX-greek-by-maketitle-completion '(("alpha") ("beta") ("gamma") ("delta") ("epsilon") @@ -460,13 +462,14 @@ (setq YaTeX-latex-message-code latex-message-kanji-code))) (defvar YaTeX-mode-syntax-table nil + "*Syntax table for yatex-mode") (if YaTeX-mode-syntax-table nil (setq YaTeX-mode-syntax-table (make-syntax-table (standard-syntax-table))) - (modify-syntax-entry ?\< "(>" YaTeX-mode-syntax-table) - (modify-syntax-entry ?\> ")<" YaTeX-mode-syntax-table) (modify-syntax-entry ?\n " " YaTeX-mode-syntax-table) + (modify-syntax-entry ?\{ "(}" YaTeX-mode-syntax-table) + (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table) ) ;---------- Provide YaTeX-mode ---------- @@ -547,9 +550,15 @@ (cond ((boundp 'MULE) (set-file-coding-system YaTeX-coding-system)) ((and YaTeX-emacs-20 (fboundp 'coding-system-equal)) - (or (coding-system-equal - YaTeX-coding-system buffer-file-coding-system) - (set-buffer-file-coding-system YaTeX-coding-system))) + (let ((mp (buffer-modified-p)) + (ud (memq + buffer-file-coding-system + '(undecided undecided-unix undecided-dos undecided-mac)))) + (if (coding-system-equal + YaTeX-coding-system buffer-file-coding-system) + nil ; if coding-system is the same, do nothing + (set-buffer-file-coding-system YaTeX-coding-system) + (if ud (set-buffer-modified-p mp))))) ((featurep 'mule) (set-file-coding-system YaTeX-coding-system)) ((boundp 'NEMACS) @@ -744,6 +753,7 @@ 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))) (unwind-protect (let* ((source-window (selected-window)) @@ -755,12 +765,12 @@ (if (> (minibuffer-depth) 0) (format "%s???{} (default %s)%s: " YaTeX-ec section-name (format "[level:%d]" (minibuffer-depth))) - (format "(C-v for view-section) %s???{} (default %s): " - YaTeX-ec section-name))) + (format "(C-v for view-section) %s???{%s} (default %s): " + YaTeX-ec (if beg "region" "") section-name))) nil))) (section (if (string= section "") section-name section)) (numarg ;; The number of section-type command's argument - (or arg + (or (and (numberp arg) arg) (nth 1 (YaTeX-lookup-table section 'section)) 1)) (arg-reader (intern-soft (concat "YaTeX::" section))) @@ -776,7 +786,8 @@ (set-marker e (point)) (goto-char beg) (insert YaTeX-ec section-name "{") - (goto-char (marker-position e))) + (goto-char e) + (set-marker e nil)) (use-global-map YaTeX-recursive-map) (if (= numarg 0) (YaTeX-make-singlecmd section-name) (progn (insert YaTeX-ec section-name) @@ -830,6 +841,7 @@ nil nil)))) (if (string= fontsize "") (setq fontsize fontsize-name)) + (setq YaTeX-current-completion-type 'large) (setq fontsize-name fontsize) (YaTeX-update-table (list fontsize-name) @@ -840,10 +852,11 @@ (insert "{\\" fontsize-name " ") (exchange-point-and-mark) (insert "}")) - (insert "{\\" fontsize-name " }") + (insert "{\\" fontsize-name " ") (if YaTeX-current-position-register (point-to-register YaTeX-current-position-register)) - (forward-char -1))) + (save-excursion + (insert (YaTeX-addin fontsize-name) "}")))) ) (defun YaTeX-make-fontsize-region () @@ -1171,7 +1184,7 @@ (interactive "P") (message (concat "J)latex R)egion B)ibtex mk(I)ndex " - (if (not YaTeX-dos) "K)ill-latex ") + (if (fboundp 'start-process) "K)ill-latex ") "P)review " (and (boundp 'window-system) window-system "S)earch ") "V)iewerr L)pr")) @@ -1227,12 +1240,14 @@ (while (re-search-forward "^%#\\(BEGIN\\)\\|\\(END\\)$" nil t) (beginning-of-line) (delete-region (point) (progn (forward-line 1) (point)))) - (goto-char (marker-position b)) + (goto-char b) (open-line 1) (delete-region (point) (progn (beginning-of-line)(point)));for 19 :-< (insert "%#BEGIN") - (goto-char (marker-position e)) - (insert "%#END\n")) + (goto-char e) + (insert "%#END\n") + (set-marker b nil) + (set-marker e nil)) ))) ) @@ -1251,28 +1266,30 @@ If optional second argument OTHERWIN is non-nil, move to other window." (let ((scmd "") label direc string blist (p (point)) (cb (current-buffer)) - (refcommands "label\\|ref\\|cite\\|bibitem") + (refcommands "label\\|\\(page\\)?ref\\|cite\\|bibitem") (func (function (lambda (string sfunc) (or (funcall sfunc string nil t) - (funcall (if (eq sfunc 'search-forward) - 'search-backward 'search-forward) + (funcall (if (eq sfunc 're-search-forward) + 're-search-backward 're-search-forward) string nil t)))))) (cond ((YaTeX-on-section-command-p refcommands) (setq scmd (cdr (assoc (YaTeX-match-string 1) - '(("label" . "ref") ("ref" . "label") + '(("label" . "\\(page\\)?ref") ("ref" . "label") + ("pageref" . "label") ("cite" . "bibitem") ("bibitem" . "cite"))))) (goto-char (match-end 0)) (let ((label (buffer-substring (1- (point)) (progn (backward-list 1) (1+ (point)))))) - (setq string (concat "\\" scmd "{" label "}")) + ;(setq string (concat "\\" scmd "{" label "}")) + (setq string (concat "\\\\" scmd "{" (regexp-quote label) "}")) (setq direc (if (string-match "ref\\|cite" scmd) - 'search-forward 'search-backward)) + 're-search-forward 're-search-backward)) (if YaTeX-current-position-register (point-to-register YaTeX-current-position-register)) - (if reverse (setq direc (if (eq direc 'search-forward) - 'search-backward 'search-forward))) + (if reverse (setq direc (if (eq direc 're-search-forward) + 're-search-backward 're-search-forward))) (if (funcall func string direc) ;label/ref found! (progn (if otherwin @@ -1322,8 +1339,9 @@ (setq blist (cdr blist))))) ) (if YaTeX-emacs-19 - (setq search-ring (cons string search-ring)) - (setq search-last-string string))) + (setq regexp-search-ring + (cons string (delete string regexp-search-ring))) + (setq search-last-regexp string))) (t nil))) ) @@ -1459,6 +1477,7 @@ ("\\\\postscriptbox{[^}]*}{[^}]*}{\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 1) ("\\\\\\(epsfbox\\|includegraphics\\|epsfig\\)\\*?{\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 2) ;\epsfbox{hoge.ps} or \includegraphics{hoge.eps} ("\\\\\\(psbox\\)\\(\\[[^]]+\\]\\)?{\\(\\([^,} ]*/\\)?[^} ]+\\)\\(\\.e?ps\\)}" 3) ;\psbox[options...]{hoge.eps} (97/1/11) + ("\\\\input{\\([^} ]+\\)\\(\\.tps\\)}" 1) ;tgif2tex (1998/9/16) ) "See the documentation of YaTeX-processed-file-regexp-alist." ) @@ -1706,7 +1725,7 @@ (if (> p (point)) (setq beg (1+ beg)) (forward-char 1)) (funcall func YaTeX-comment-prefix beg (point) YaTeX-uncomment-once))) (message "%sommented out current environment." - (if (eq func 'comment-region) "C" "Un-c")) + (if (eq func 'comment-out-region) "C" "Un-c")) ) (defun YaTeX-beginning-of-environment (&optional limit-search-bound end) @@ -1781,12 +1800,12 @@ (interactive) (save-excursion (if (YaTeX-on-begin-end-p) - (let ((p (make-marker))) - (set-marker p (point)) + (let ((p (point-marker))) (YaTeX-goto-corresponding-environment) (YaTeX-remove-prefix YaTeX-comment-prefix YaTeX-uncomment-once) - (goto-char (marker-position p)) - (YaTeX-remove-prefix YaTeX-comment-prefix YaTeX-uncomment-once)) + (goto-char p) + (YaTeX-remove-prefix YaTeX-comment-prefix YaTeX-uncomment-once) + (set-marker p nil)) (if (YaTeX-on-comment-p) (let*((fill-prefix "") ;;append `^%' to head of paragraph delimiter. @@ -1835,11 +1854,11 @@ (kill-region (progn (goto-char b2) - (skip-chars-backward " \t") + (skip-chars-backward " \t%") (if (bolp) (point) b2)) e2)) (goto-char b1) - (skip-chars-backward " \t") + (skip-chars-backward " \t%") (if (not kill-contents) (progn (kill-append @@ -1876,12 +1895,14 @@ (skip-chars-forward "^{") (forward-list 1) (set-marker end (point)) - (if kill-all (delete-region beg end) + (if kill-all (kill-region beg end) (goto-char beg) - (delete-region + (kill-region (point) (progn (skip-chars-forward "^{" end) (1+ (point)))) (goto-char end) - (backward-delete-char 1)))) + (set-marker end nil) + (kill-append (buffer-substring (point) (1- (point))) nil) + (delete-backward-char 1)))) ) (defun YaTeX-kill-paren (kill-contents) @@ -1985,10 +2006,10 @@ ((string= newenv env) (message "No need to change.")) (t (search-forward (concat "{" env) (point-end-of-line) t) - (replace-match (concat "{" newenv)) + (replace-match (concat "{" newenv) t) (exchange-point-and-mark) (search-forward (concat "{" env) (point-end-of-line) t) - (replace-match (concat "{" newenv)))) + (replace-match (concat "{" newenv) t))) t))) ) @@ -2323,6 +2344,7 @@ (cond ((not (eq major-mode 'yatex-mode)) (fill-paragraph arg)) ((YaTeX-quick-in-environment-p YaTeX-fill-inhibit-environments) nil) + ((YaTeX-in-math-mode-p) nil) (t (save-excursion (let ((verbrex (concat YaTeX-ec-regexp @@ -2362,7 +2384,8 @@ ;;(fill-paragraph arg) (fill-region-as-paragraph (point-min) (point-max) arg) (while spacelist - (goto-char (marker-position (car poslist))) + (goto-char (car poslist)) + (set-marker (car poslist) nil) (delete-char 1) (insert (car spacelist)) (setq spacelist (cdr spacelist) poslist (cdr poslist))) @@ -2480,7 +2503,7 @@ (+ (YaTeX-current-indentation) (or additional 0) YaTeX-environment-indent))))) - depth iteminfo (p (point)) pp (peol (point-end-of-line)) + sect depth iteminfo (p (point)) pp (peol (point-end-of-line)) ;;inenv below is sometimes defined in YaTeX-indent-new-comment-line (inenv (or (and (boundp 'inenv) inenv) (YaTeX-inner-environment t)))) ;;(if NTT-jTeX ;;Do you need this section? @@ -2498,11 +2521,9 @@ (or inenv (setq inenv "document")) ;is the default environment (cond ((and (YaTeX-on-begin-end-p) (match-beginning 2)) ;if \end - (save-excursion - (beginning-of-line) - (YaTeX-reindent (YaTeX-current-indentation)))) + (YaTeX-reindent (YaTeX-current-indentation))) ((string-match YaTeX-equation-env-regexp inenv) - (YaTeX-indent-line-equation)) ;autoload-ed from yatex.env + (YaTeX-indent-line-equation)) ;autoload-ed from yatexenv (;(YaTeX-in-environment-p '("itemize" "enumerate" "description" "list")) (string-match YaTeX-itemizing-env-regexp inenv) ;;(YaTeX-on-item-p) ?? @@ -2510,15 +2531,16 @@ (if (save-excursion (beginning-of-line) (re-search-forward YaTeX-item-regexp peol t)) - (save-excursion - (goto-char (1+ (match-beginning 0))) - (setq depth - (* YaTeX-environment-indent - (cond - ((looking-at "subsubsub") 3) - ((looking-at "subsub") 2) - ((looking-at "sub") 1) - (t 0)))) + (progn + (save-excursion + (goto-char (1+ (match-beginning 0))) + (setq depth + (* YaTeX-environment-indent + (cond + ((looking-at "subsubsub") 3) + ((looking-at "subsub") 2) + ((looking-at "sub") 1) + (t 0))))) (funcall indent-relative depth)) (YaTeX-reindent (or (car (cdr (YaTeX-get-item-info nil inenv))) (+ (save-excursion @@ -2532,10 +2554,13 @@ (funcall indent-relative)) ((YaTeX-on-section-command-p YaTeX-sectioning-regexp) (require 'yatexsec) ;to know YaTeX-sectioning-level + (setq sect (YaTeX-match-string 1)) + (if (string-match "\\*$" sect) + (setq sect (substring sect 0 -1))) (YaTeX-reindent (* (max (1- ;I want chapter to have indentation 0 - (or (cdr (assoc (YaTeX-match-string 1) YaTeX-sectioning-level)) + (or (cdr (assoc sect YaTeX-sectioning-level)) 0)) 0) YaTeX-environment-indent))) diff --git a/yatex.new b/yatex.new index 5e7042d..a9caf69 100644 --- a/yatex.new +++ b/yatex.new @@ -1,6 +1,19 @@ What's new in YaTeX �쒹/yahtml - �e�o�[�W�����̕ύX�_�ɂ��� +1.66 \section*{} �Ȃǂ�*���Z�N�V�����R�}���h�ŃC���f���g�������� + ���C���B + [prefix] g �ł�label/ref������re-search�ɂ�pageref�ɂ���ׂ�悤 + �ɂ����B�܂�search-ring�ł͂Ȃ�regexp-search-ring���X�V����̂� + �p�������� M-C-s or M-C-r �ōs���悤�ɂȂ����B + XEmacs�ł̃��x���⊮�̃o�O�t�B�N�X�B + tgif2tex(*.tps) �ւ� [prefix] g ��lj��B + Emacs20��suppress-keymap�̎d�l���ς�����̂őΏ��B + Emacs20+yahtml �ŃA�C�e�����^�O�ł�fill�����܂��s���Ȃ������̂��C���B + yahtml��