yatex

diff yatexprc.el @ 69:807c1e7e68b7

yahtml-escape-chars-region Translate <>"& to entity reference. And inverse translation to above. yahtml-translate-hyphens-when-comment-region yahtml-prefer-upcase-attributes Inquire .htaccess file to determine the file-coding-system. Completions for StyleSheet. ---yahtml--- Auto insert of \), \|, \] after corresponding \(, \| \]. [prefix] c for \right\left parens.
author yuuji
date Thu, 15 Jul 1999 04:58:26 +0000
parents 0eb6997bee16
children 44e3a5e1e883
line diff
     1.1 --- a/yatexprc.el	Mon Oct 26 12:05:32 1998 +0000
     1.2 +++ b/yatexprc.el	Thu Jul 15 04:58:26 1999 +0000
     1.3 @@ -1,16 +1,16 @@
     1.4  ;;; -*- Emacs-Lisp -*-
     1.5  ;;; YaTeX process handler.
     1.6  ;;; yatexprc.el
     1.7 -;;; (c )1993-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     1.8 -;;; Last modified Mon Mar  9 11:44:29 1998 on crx
     1.9 +;;; (c )1993-1999 by HIROSE Yuuji.[yuuji@gentei.org]
    1.10 +;;; Last modified Tue Jul 13 13:47:46 1999 on firestorm
    1.11  ;;; $Id$
    1.12  
    1.13  ;(require 'yatex)
    1.14  (require 'yatexlib)
    1.15  
    1.16  (defvar YaTeX-typeset-process nil
    1.17 -  "Process identifier for jlatex"
    1.18 -)
    1.19 +  "Process identifier for jlatex")
    1.20 +
    1.21  (defvar YaTeX-typeset-buffer "*YaTeX-typesetting*"
    1.22    "Process buffer for jlatex")
    1.23  
    1.24 @@ -44,8 +44,7 @@
    1.25    (modify-syntax-entry ?\{ "w" YaTeX-typeset-buffer-syntax)
    1.26    (modify-syntax-entry ?\} "w" YaTeX-typeset-buffer-syntax)
    1.27    (modify-syntax-entry ?\[ "w" YaTeX-typeset-buffer-syntax)
    1.28 -  (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax)
    1.29 -)
    1.30 +  (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax))
    1.31  
    1.32  (defun YaTeX-typeset (command buffer &optional prcname modename)
    1.33    "Execute jlatex (or other) to LaTeX typeset."
    1.34 @@ -55,7 +54,7 @@
    1.35  	  (map YaTeX-typesetting-mode-map)
    1.36  	  (outcode
    1.37  	   (cond ((eq major-mode 'yatex-mode) YaTeX-coding-system)
    1.38 -		 ((eq major-mode 'yahtml-mode) yahtml-coding-system))))
    1.39 +		 ((eq major-mode 'yahtml-mode) yahtml-kanji-code))))
    1.40        (if (and YaTeX-typeset-process
    1.41  	       (eq (process-status YaTeX-typeset-process) 'run))
    1.42  	  ;; if tex command is halting.
    1.43 @@ -118,8 +117,7 @@
    1.44  	(recenter -1))
    1.45        (select-window window)
    1.46        (switch-to-buffer cb)
    1.47 -      (YaTeX-remove-nonstopmode)))
    1.48 -)
    1.49 +      (YaTeX-remove-nonstopmode))))
    1.50  
    1.51  (defun YaTeX-typeset-sentinel (proc mes)
    1.52    (cond ((null (buffer-name (process-buffer proc)))
    1.53 @@ -160,12 +158,10 @@
    1.54               (set-buffer-modified-p (buffer-modified-p))
    1.55  	     )
    1.56  	   (select-window owin)
    1.57 -	   (set-buffer obuf))))
    1.58 -)
    1.59 +	   (set-buffer obuf)))))
    1.60  
    1.61  (defvar YaTeX-texput-file "texput.tex"
    1.62 -  "*File name for temporary file of typeset-region."
    1.63 -)
    1.64 +  "*File name for temporary file of typeset-region.")
    1.65  
    1.66  (defun YaTeX-typeset-region ()
    1.67    "Paste the region to the file `texput.tex' and execute typesetter.
    1.68 @@ -247,9 +243,7 @@
    1.69        (switch-to-buffer buffer)		;for Emacs-19
    1.70        (put 'dvi2-command 'region t)
    1.71        (put 'dvi2-command 'file buffer)
    1.72 -      (put 'dvi2-command 'offset lineinfo)
    1.73 -      ))
    1.74 -)
    1.75 +      (put 'dvi2-command 'offset lineinfo))))
    1.76  
    1.77  (defun YaTeX-typeset-buffer ()
    1.78    "Typeset whole buffer.
    1.79 @@ -303,8 +297,7 @@
    1.80  	  (exchange-point-and-mark)))
    1.81        (switch-to-buffer cb))		;for 19
    1.82      (YaTeX-typeset cmd YaTeX-typeset-buffer)
    1.83 -    (put 'dvi2-command 'region nil))
    1.84 -)
    1.85 +    (put 'dvi2-command 'region nil)))
    1.86  
    1.87  (defvar YaTeX-call-command-history nil
    1.88    "Holds history list of YaTeX-call-command-on-file.")
    1.89 @@ -316,15 +309,13 @@
    1.90      "Call command: "
    1.91      (concat base-cmd " " (YaTeX-get-preview-file-name))
    1.92      'YaTeX-call-command-history)
    1.93 -   buffer)
    1.94 -)
    1.95 +   buffer))
    1.96  
    1.97  (defun YaTeX-bibtex-buffer (cmd)
    1.98    "Pass the bibliography data of editing file to bibtex."
    1.99    (interactive)
   1.100    (YaTeX-save-buffers)
   1.101 -  (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" )
   1.102 -)
   1.103 +  (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" ))
   1.104  
   1.105  (defun YaTeX-kill-typeset-process (proc)
   1.106    "Kill process PROC after sending signal to PROC.
   1.107 @@ -347,8 +338,7 @@
   1.108      (if (eq (process-status proc) 'run)
   1.109  	(progn
   1.110  	  (interrupt-process proc)
   1.111 -	  (delete-process proc)))))
   1.112 -)
   1.113 +	  (delete-process proc))))))
   1.114  
   1.115  (defun YaTeX-system (command buffer)
   1.116    "Execute some command on buffer.  Not a official function."
   1.117 @@ -371,8 +361,7 @@
   1.118  	(set-process-buffer
   1.119  	 (start-process
   1.120  	  "system" buffer shell-file-name YaTeX-shell-command-option command)
   1.121 -	 (get-buffer buffer)))))
   1.122 -)
   1.123 +	 (get-buffer buffer))))))
   1.124  
   1.125  (defvar YaTeX-preview-command-history nil
   1.126    "Holds minibuffer history of preview command.")
   1.127 @@ -413,6 +402,12 @@
   1.128  		      (concat preview-command " " preview-file))
   1.129  	(send-string-to-terminal "\e[>5l") ;show cursor
   1.130  	(redraw-display))
   1.131 +       ((and (string-match "dviout" preview-command)	;maybe on `kon' 
   1.132 +	     (stringp (getenv "TERM"))
   1.133 +	     (string-match "^kon" (getenv "TERM")))
   1.134 +	(call-process shell-file-name "con" "*dvi-preview*" nil
   1.135 +		      YaTeX-shell-command-option
   1.136 +		      (concat preview-command " " preview-file)))
   1.137         (t				;if UNIX
   1.138  	(set-process-buffer
   1.139  	 (start-process "preview" "*dvi-preview*" shell-file-name
   1.140 @@ -421,8 +416,7 @@
   1.141  	 (get-buffer pbuffer))
   1.142  	(message
   1.143  	 (concat "Starting " preview-command
   1.144 -		 " to preview " preview-file))))))
   1.145 -)
   1.146 +		 " to preview " preview-file)))))))
   1.147  
   1.148  (defvar YaTeX-xdvi-remote-program "xdvi")
   1.149  (defun YaTeX-xdvi-remote-search (&optional region-mode)
   1.150 @@ -447,8 +441,7 @@
   1.151  	     "xdvi" pb YaTeX-xdvi-remote-program
   1.152  	     "-remote"  (format "SloppySearch(%s) " str)
   1.153  	     (concat (YaTeX-get-preview-file-name) ".dvi")))
   1.154 -      (message "Searching `%s'...Done" str)))
   1.155 -)
   1.156 +      (message "Searching `%s'...Done" str))))
   1.157  
   1.158  (defun YaTeX-set-virtual-error-position (file-sym line-sym)
   1.159    "Replace the value of FILE-SYM, LINE-SYM by virtual error position."
   1.160 @@ -508,8 +501,7 @@
   1.161      (recenter (/ (window-height) 2))
   1.162      (sit-for 1)
   1.163      (goto-char (match-beginning 0))
   1.164 -    (select-window error-win))
   1.165 -)
   1.166 +    (select-window error-win)))
   1.167  
   1.168  (defun YaTeX-jump-error-line ()
   1.169    "Jump to corresponding line on latex command's error message."
   1.170 @@ -531,8 +523,7 @@
   1.171        (if (null error-buf)
   1.172  	  (error "`%s' is not found in this directory." error-file))
   1.173        (YaTeX-showup-buffer error-buf nil t)
   1.174 -      (goto-line error-line))
   1.175 -)
   1.176 +      (goto-line error-line)))
   1.177  
   1.178  (defun YaTeX-send-string ()
   1.179    "Send string to current typeset process."
   1.180 @@ -550,8 +541,7 @@
   1.181  	(insert "\n")
   1.182  	(set-marker (process-mark YaTeX-typeset-process) (point))
   1.183  	(insert " "))
   1.184 -    (ding))
   1.185 -)
   1.186 +    (ding)))
   1.187  
   1.188  (defun YaTeX-view-error ()
   1.189    (interactive)
   1.190 @@ -564,8 +554,7 @@
   1.191        ;;(goto-char (point-max))
   1.192        ;;(forward-line -1)
   1.193        ;;(recenter -1)
   1.194 -      (select-window win)))
   1.195 -)
   1.196 +      (select-window win))))
   1.197  
   1.198  (defun YaTeX-get-error-file (default)
   1.199    "Get current processing file from typesetting log."
   1.200 @@ -589,8 +578,7 @@
   1.201  	     (progn (forward-char 1) (point))
   1.202  	     (progn (skip-chars-forward "^ \n" (point-end-of-line))
   1.203  		    (point))))
   1.204 -      (if (string= "" s) default s)))
   1.205 -)
   1.206 +      (if (string= "" s) default s))))
   1.207        
   1.208  (defun YaTeX-put-nonstopmode ()
   1.209    (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop)
   1.210 @@ -600,9 +588,7 @@
   1.211  	  (YaTeX-visit-main t)
   1.212  	  (goto-char (point-min))
   1.213  	  (insert "\\nonstopmode{}%_YaTeX_%\n")
   1.214 -	  (if (buffer-file-name) (basic-save-buffer))))
   1.215 -    )
   1.216 -)
   1.217 +	  (if (buffer-file-name) (basic-save-buffer))))))
   1.218  
   1.219  (defun YaTeX-remove-nonstopmode ()
   1.220    (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) ;for speed
   1.221 @@ -613,8 +599,7 @@
   1.222  	(narrow-to-region (point-min) (point))
   1.223  	(goto-char (point-min))
   1.224  	(delete-matching-lines "^\\\\nonstopmode\\{\\}%_YaTeX_%$")
   1.225 -	(widen)))
   1.226 -)
   1.227 +	(widen))))
   1.228  
   1.229  (defun YaTeX-get-preview-file-name ()
   1.230    "Get file name to preview by inquiring YaTeX-get-latex-command"
   1.231 @@ -627,9 +612,7 @@
   1.232  				(buffer-file-name))
   1.233  			       0 -4))
   1.234        (setq period (rindex fname ?.))
   1.235 -      (setq fname (substring fname 0 (if (eq -1 period) nil period)))
   1.236 -      ))
   1.237 -)
   1.238 +      (setq fname (substring fname 0 (if (eq -1 period) nil period))))))
   1.239  
   1.240  (defun YaTeX-get-latex-command (&optional switch)
   1.241    "Specify the latex-command name and its argument.
   1.242 @@ -659,8 +642,7 @@
   1.243         (switch (if (string-match "\\s " magic) magic
   1.244  		 (concat magic " " parent)))
   1.245         (t (concat (substring magic 0 (string-match "\\s " magic)) " "))))
   1.246 -     (t (concat tex-command " " (if switch parent)))))
   1.247 -)
   1.248 +     (t (concat tex-command " " (if switch parent))))))
   1.249  
   1.250  (defvar YaTeX-lpr-command-history nil
   1.251    "Holds command line history of YaTeX-lpr.")
   1.252 @@ -720,9 +702,7 @@
   1.253  	 (start-process "print" "*dvi-printing*" shell-file-name
   1.254  			YaTeX-shell-command-option cmd)
   1.255  	 (get-buffer lbuffer))
   1.256 -	(message "Starting printing command: %s..." cmd)))
   1.257 -      ))
   1.258 -)
   1.259 +	(message "Starting printing command: %s..." cmd))))))
   1.260  
   1.261  (defun YaTeX-main-file-p ()
   1.262    "Return if current buffer is main LaTeX source."
   1.263 @@ -736,8 +716,7 @@
   1.264        (let ((latex-main-id
   1.265  	     (concat "^\\s *" YaTeX-ec-regexp "document\\(style\\|class\\)")))
   1.266  	(or (re-search-backward latex-main-id nil t)
   1.267 -	    (re-search-forward latex-main-id nil t))))))
   1.268 -)
   1.269 +	    (re-search-forward latex-main-id nil t)))))))
   1.270  
   1.271  (defun YaTeX-visit-main (&optional setbuf)
   1.272    "Switch buffer to main LaTeX source.
   1.273 @@ -767,9 +746,7 @@
   1.274  	  (setq YaTeX-parent-file main-file)
   1.275  	  (YaTeX-switch-to-buffer main-file setbuf))
   1.276         )))
   1.277 -  nil
   1.278 -)
   1.279 -
   1.280 +  nil)
   1.281  
   1.282  (defun YaTeX-guess-parent (command-line)
   1.283    (setq command-line
   1.284 @@ -780,16 +757,14 @@
   1.285  	(concat (if (string-match "\\(.*\\)\\." command-line)
   1.286  		    (substring command-line (match-beginning 1) (match-end 1))
   1.287  		  command-line)
   1.288 -		".tex"))
   1.289 -)
   1.290 +		".tex")))
   1.291  
   1.292  (defun YaTeX-visit-main-other-window ()
   1.293    "Switch to buffer main LaTeX source in other window."
   1.294    (interactive)
   1.295    (if (YaTeX-main-file-p) (message "I think this is main LaTeX source.")
   1.296        (YaTeX-switch-to-buffer-other-window
   1.297 -       (concat (YaTeX-get-preview-file-name) ".tex")))
   1.298 -)
   1.299 +       (concat (YaTeX-get-preview-file-name) ".tex"))))
   1.300  
   1.301  (defun YaTeX-get-builtin (key)
   1.302    "Read source built-in command of %# usage."
   1.303 @@ -801,8 +776,7 @@
   1.304  	(buffer-substring
   1.305  	 (progn (skip-chars-forward " 	" (point-end-of-line))(point))
   1.306  	 (point-end-of-line))
   1.307 -      nil))
   1.308 -)
   1.309 +      nil)))
   1.310  
   1.311  (defun YaTeX-save-buffers ()
   1.312    "Save buffers whose major-mode is equal to current major-mode."
   1.313 @@ -816,7 +790,6 @@
   1.314  			  (buffer-modified-p buf)
   1.315  			  (y-or-n-p (format "Save %s" (buffer-name buf))))
   1.316  		     (save-buffer buf)))
   1.317 -	      (buffer-list))))
   1.318 -)
   1.319 +	      (buffer-list)))))
   1.320  
   1.321  (provide 'yatexprc)