yatex

changeset 15:cd762e854337

Fix bugs.
author yuuji
date Mon, 25 Apr 1994 03:18:12 +0000
parents b7b023a74293
children cb9afa9c1213
files yahtml.el yatex.el yatex.new yatexprc.el
diffstat 4 files changed, 44 insertions(+), 39 deletions(-) [+]
line diff
     1.1 --- a/yahtml.el	Fri Apr 22 17:35:25 1994 +0000
     1.2 +++ b/yahtml.el	Mon Apr 25 03:18:12 1994 +0000
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; -*- Emacs-Lisp -*-
     1.5 -;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@ascii-net]
     1.6 -;;; Last modified Sat Jan 29 16:58:00 1994 on gloria
     1.7 +;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@asciinet.or.jp]
     1.8 +;;; Last modified Sat Apr 23 02:27:54 1994 on pajero
     1.9  ;;; This is sample hack definition for HTML.
    1.10  ;;;
    1.11  ;;; [Purely tentative version]
     2.1 Binary file yatex.el has changed
     3.1 --- a/yatex.new	Fri Apr 22 17:35:25 1994 +0000
     3.2 +++ b/yatex.new	Mon Apr 25 03:18:12 1994 +0000
     3.3 @@ -2,6 +2,9 @@
     3.4  	Yet Another tex-mode for Emacs
     3.5  	yatex.el 各バージョンの変更点について。
     3.6  
     3.7 +1.47	YaTeX-quick-in-environment-p と YaTeX-get-latex-command の
     3.8 +	バグフィクス。
     3.9 +
    3.10  1.46	リジョン指定つき section 型補完の追加。
    3.11  	[prefix] k で section 型コマンドの削除、対応する括弧の削除。
    3.12  	エラー行ジャンプの適正化。
     4.1 --- a/yatexprc.el	Fri Apr 22 17:35:25 1994 +0000
     4.2 +++ b/yatexprc.el	Mon Apr 25 03:18:12 1994 +0000
     4.3 @@ -2,7 +2,7 @@
     4.4  ;;; YaTeX process handler.
     4.5  ;;; yatexprc.el
     4.6  ;;; (c )1993-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     4.7 -;;; Last modified Sat Apr 23 02:34:07 1994 on pajero
     4.8 +;;; Last modified Mon Apr 25 12:13:17 1994 on alto
     4.9  ;;; $Id$
    4.10  
    4.11  (require 'yatex)
    4.12 @@ -464,34 +464,23 @@
    4.13  and you write \"%#!jlatex main.tex\" on some line and argument SWITCH
    4.14  is non-nil, then
    4.15  	\"jlatex main.tex\"
    4.16 +
    4.17  will be given to the shell."
    4.18 -  (let*((target (file-name-nondirectory
    4.19 -		 (or YaTeX-parent-file
    4.20 -		     (save-excursion
    4.21 -		       (YaTeX-visit-main t)
    4.22 -		       (buffer-file-name)))))
    4.23 -	(default-command
    4.24 -	  (concat tex-command " " (if switch target ""))));default value
    4.25 -    (save-excursion
    4.26 -      (goto-char (point-min))
    4.27 -      (if (null (re-search-forward "^%#!" (point-max) t))
    4.28 -	  default-command
    4.29 -	(skip-chars-forward "%#! 	")
    4.30 -	(if (eolp)
    4.31 -	    default-command
    4.32 -	  (let ((s (point)))
    4.33 -	    (skip-chars-forward "^ 	" (point-end-of-line)) ;Skip command
    4.34 -	    (skip-chars-forward " 	" (point-end-of-line))
    4.35 -	    (cond
    4.36 -	     ((null switch)
    4.37 -	      (buffer-substring s (point)))
    4.38 -	     ((eolp)			 ;Only return command name
    4.39 -	      (concat (buffer-substring s (point)) " "
    4.40 -		      (file-name-nondirectory
    4.41 -		       (or YaTeX-parent-file (buffer-file-name)))))
    4.42 -	     (t(end-of-line)		   ;Change entire command name
    4.43 -	       (buffer-substring s (point))) ;including arguments.
    4.44 -	    ))))))
    4.45 +  (let (magic command target)
    4.46 +    (setq parent
    4.47 +	  (cond
    4.48 +	   (YaTeX-parent-file YaTeX-parent-file)
    4.49 +	   (t (save-excursion
    4.50 +		(YaTeX-visit-main t)
    4.51 +		(file-name-nondirectory (buffer-file-name)))))
    4.52 +	  magic (YaTeX-get-builtin "!"))
    4.53 +    (cond
    4.54 +     (magic
    4.55 +      (cond
    4.56 +       (switch (if (string-match "\\s " magic) magic
    4.57 +		 (concat magic " " parent)))
    4.58 +       (t (concat (substring magic 0 (string-match "\\s " magic)) " "))))
    4.59 +     (t (concat tex-command " " parent))))
    4.60  )
    4.61  
    4.62  (defun YaTeX-lpr (arg)
    4.63 @@ -540,8 +529,7 @@
    4.64    "Return if current buffer is main LaTeX source."
    4.65    (cond
    4.66     ((YaTeX-get-builtin "!")
    4.67 -    (string-match
    4.68 -     (concat "^" (YaTeX-get-preview-file-name) ".tex")(buffer-name)))
    4.69 +    (string-match (YaTeX-guess-parent (YaTeX-get-builtin "!")) (buffer-name)))
    4.70     (t
    4.71      (save-excursion
    4.72        (let ((latex-main-id (concat "^\\s *" YaTeX-ec-regexp "documentstyle")))
    4.73 @@ -550,13 +538,13 @@
    4.74  )
    4.75  
    4.76  (defun YaTeX-visit-main (&optional setbuf)
    4.77 -  "Switch to buffer main LaTeX source.  Use set-buffer instead of
    4.78 -switch-to-buffer if the optional second argument SETBUF is t(Use it only
    4.79 -in Emacs-Lisp program)."
    4.80 +  "Switch buffer to main LaTeX source.
    4.81 +Use set-buffer instead of switch-to-buffer if the optional second argument
    4.82 +SETBUF is t(Use it only from Emacs-Lisp program)."
    4.83    (interactive)
    4.84 -  (let (main-file)
    4.85 -    (if (YaTeX-get-builtin "!")
    4.86 -	(setq main-file (concat (YaTeX-get-preview-file-name) ".tex")))
    4.87 +  (let (b-in main-file)
    4.88 +    (if (setq b-in (YaTeX-get-builtin "!"))
    4.89 +	(setq main-file (YaTeX-guess-parent b-in)))
    4.90      (if YaTeX-parent-file
    4.91  	(setq main-file YaTeX-parent-file))
    4.92      (if (YaTeX-main-file-p)
    4.93 @@ -577,6 +565,19 @@
    4.94    nil
    4.95  )
    4.96  
    4.97 +
    4.98 +(defun YaTeX-guess-parent (command-line)
    4.99 +  (setq command-line
   4.100 +	(if (string-match ".*\\s " command-line)
   4.101 +	    (substring command-line (match-end 0))
   4.102 +	  (file-name-nondirectory (buffer-file-name)))
   4.103 +	command-line
   4.104 +	(concat (if (string-match "\\(.*\\)\\." command-line)
   4.105 +		    (substring command-line (match-beginning 1) (match-end 1))
   4.106 +		  command-line)
   4.107 +		".tex"))
   4.108 +)
   4.109 +
   4.110  (defun YaTeX-visit-main-other-window ()
   4.111    "Switch to buffer main LaTeX source in other window."
   4.112    (interactive)
   4.113 @@ -589,7 +590,8 @@
   4.114    "Read source built-in command of %# usage."
   4.115    (save-excursion
   4.116      (goto-char (point-min))
   4.117 -    (if (and (search-forward (concat "%#" key) nil t)
   4.118 +    (if (and (re-search-forward
   4.119 +	      (concat "^" (regexp-quote (concat "%#" key))) nil t)
   4.120  	     (not (eolp)))
   4.121  	(buffer-substring
   4.122  	 (progn (skip-chars-forward " 	" (point-end-of-line))(point))