yatex

diff yatexlib.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/yatexlib.el	Mon Oct 26 12:05:32 1998 +0000
     1.2 +++ b/yatexlib.el	Thu Jul 15 04:58:26 1999 +0000
     1.3 @@ -1,8 +1,8 @@
     1.4  ;;; -*- Emacs-Lisp -*-
     1.5  ;;; YaTeX and yahtml common libraries, general functions and definitions
     1.6  ;;; yatexlib.el
     1.7 -;;; (c )1994-1997 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     1.8 -;;; Last modified Mon Oct 19 13:41:29 1998 on firestorm
     1.9 +;;; (c )1994-1999 by HIROSE Yuuji.[yuuji@gentei.org]
    1.10 +;;; Last modified Tue May  4 10:25:55 1999 on firestorm
    1.11  ;;; $Id$
    1.12  
    1.13  ;; General variables
    1.14 @@ -54,8 +54,8 @@
    1.15  
    1.16  ;----------- work variables ----------------------------------------
    1.17  (defvar YaTeX-typesetting-mode-map nil
    1.18 -  "Keymap used in YaTeX typesetting buffer"
    1.19 -)
    1.20 +  "Keymap used in YaTeX typesetting buffer")
    1.21 +
    1.22  (if YaTeX-typesetting-mode-map nil
    1.23    (setq YaTeX-typesetting-mode-map (make-keymap))
    1.24    ;(suppress-keymap YaTeX-typesetting-mode-map t)
    1.25 @@ -295,25 +295,23 @@
    1.26  		   (beginning-of-line)
    1.27  		   (re-search-forward cmntrx (match-beginning 0) t)))))
    1.28      (store-match-data md)
    1.29 -    found)
    1.30 -)
    1.31 +    found))
    1.32  
    1.33  (defun YaTeX-re-search-active-forward (regexp cmntrx &optional bound err cnt)
    1.34    "Search REGEXP backward which is not commented out by regexp CMNTRX.
    1.35  See also YaTeX-search-active-forward."
    1.36 -  (YaTeX-search-active-forward regexp cmntrx bound err cnt 're-search-forward)
    1.37 -)
    1.38 +  (YaTeX-search-active-forward regexp cmntrx bound err cnt 're-search-forward))
    1.39 +
    1.40  (defun YaTeX-search-active-backward (string cmntrx &optional bound err cnt)
    1.41    "Search STRING backward which is not commented out by regexp CMNTRX.
    1.42  See also YaTeX-search-active-forward."
    1.43 -  (YaTeX-search-active-forward string cmntrx bound err cnt 'search-backward)
    1.44 -)
    1.45 +  (YaTeX-search-active-forward string cmntrx bound err cnt 'search-backward))
    1.46 +
    1.47  (defun YaTeX-re-search-active-backward (regexp cmntrx &optional bound err cnt)
    1.48    "Search REGEXP backward which is not commented out by regexp CMNTRX.
    1.49  See also YaTeX-search-active-forward."
    1.50 -  (YaTeX-search-active-forward regexp cmntrx bound err cnt 're-search-backward)
    1.51 -)
    1.52 -
    1.53 +  (YaTeX-search-active-forward
    1.54 +   regexp cmntrx bound err cnt 're-search-backward))
    1.55  
    1.56  ;;;###autoload
    1.57  (defun YaTeX-switch-to-buffer (file &optional setbuf)
    1.58 @@ -333,8 +331,7 @@
    1.59  	 (find-file file))
    1.60         (current-buffer)))
    1.61       (t (message "%s was not found in this directory." file)
    1.62 -	nil)))
    1.63 -)
    1.64 +	nil))))
    1.65  
    1.66  ;;;###autoload
    1.67  (defun YaTeX-switch-to-buffer-other-window (file)
    1.68 @@ -348,8 +345,7 @@
    1.69     ((or YaTeX-create-file-prefix-g (file-exists-p file))
    1.70      (find-file-other-window file) t)
    1.71     (t (message "%s was not found in this directory." file)
    1.72 -      nil))
    1.73 -)
    1.74 +      nil)))
    1.75  
    1.76  (defun YaTeX-replace-format-sub (string format repl)
    1.77    (let ((beg (or (string-match (concat "^\\(%" format "\\)") string)
    1.78 @@ -358,8 +354,7 @@
    1.79      (if (null beg) string ;no conversion
    1.80        (concat
    1.81         (substring string 0 (match-beginning 1)) repl
    1.82 -       (substring string (match-end 1)))))
    1.83 -)
    1.84 +       (substring string (match-end 1))))))
    1.85  
    1.86  ;;;###autoload
    1.87  (defun YaTeX-replace-format (string format repl)
    1.88 @@ -369,8 +364,7 @@
    1.89      (while (not (string=
    1.90  		 ans (setq string (YaTeX-replace-format-sub ans format repl))))
    1.91        (setq ans string))
    1.92 -    string)
    1.93 -)
    1.94 +    string))
    1.95  
    1.96  ;;;###autoload
    1.97  (defun YaTeX-replace-format-args (string &rest args)
    1.98 @@ -381,8 +375,7 @@
    1.99        (setq string
   1.100  	    (YaTeX-replace-format string (int-to-string argp) (car args)))
   1.101        (setq args (cdr args) argp (1+ argp))))
   1.102 -  string
   1.103 -)
   1.104 +  string)
   1.105  
   1.106  ;;;###autoload
   1.107  (defun rindex (string char)
   1.108 @@ -448,8 +441,16 @@
   1.109  	    (switch-to-buffer (get-buffer-create buffer))
   1.110  	    (or select (select-window window)))
   1.111  	   (t nil)))
   1.112 -	 )))
   1.113 -)
   1.114 +	 ))))
   1.115 +
   1.116 +(cond
   1.117 + ((fboundp 'screen-height)
   1.118 +  (fset 'YaTeX-screen-height 'screen-height)
   1.119 +  (fset 'YaTeX-screen-width 'screen-width))
   1.120 + ((fboundp 'frame-height)
   1.121 +  (fset 'YaTeX-screen-height 'frame-height)
   1.122 +  (fset 'YaTeX-screen-width 'frame-width))
   1.123 + (t (error "I don't know how to run windows.el on this Emacs...")))
   1.124  
   1.125  ;;;###autoload
   1.126  (defun split-window-calculate-height (height)
   1.127 @@ -462,15 +463,14 @@
   1.128         (selected-window)
   1.129         (max
   1.130  	(min
   1.131 -	 (- (screen-height)
   1.132 +	 (- (YaTeX-screen-height)
   1.133  	    (if (numberp height)
   1.134  		(+ height 2)
   1.135 -	      (/ (* (screen-height)
   1.136 +	      (/ (* (YaTeX-screen-height)
   1.137  		    (string-to-int height))
   1.138  		 100)))
   1.139 -	 (- (screen-height) window-min-height 1))
   1.140 -	window-min-height)))
   1.141 -)
   1.142 +	 (- (YaTeX-screen-height) window-min-height 1))
   1.143 +	window-min-height))))
   1.144  
   1.145  ;;;###autoload
   1.146  (defun YaTeX-window-list ()
   1.147 @@ -478,8 +478,7 @@
   1.148      (while (not (eq curw (setq win (next-window win))))
   1.149        (or (eq win (minibuffer-window))
   1.150  	  (setq wlist (cons win wlist))))
   1.151 -    wlist)
   1.152 -)
   1.153 +    wlist))
   1.154  
   1.155  ;;;###autoload
   1.156  (defun substitute-all-key-definition (olddef newdef keymap)
   1.157 @@ -497,8 +496,7 @@
   1.158    "Return (buffer-substring (match-beginning n) (match-beginning m))."
   1.159    (if (match-beginning n)
   1.160        (buffer-substring (match-beginning n)
   1.161 -			(match-end (or m n))))
   1.162 -)
   1.163 +			(match-end (or m n)))))
   1.164  
   1.165  ;;;###autoload
   1.166  (defun YaTeX-minibuffer-complete ()
   1.167 @@ -555,8 +553,7 @@
   1.168  	    (if (eq (try-completion compl minibuffer-completion-table) t)
   1.169  		(exit-minibuffer)
   1.170  	      (funcall displist)))))
   1.171 -    (store-match-data md))
   1.172 -)
   1.173 +    (store-match-data md)))
   1.174  
   1.175  (defun YaTeX-minibuffer-quick-complete ()
   1.176    "Set 'quick to 't and call YaTeX-minibuffer-complete.
   1.177 @@ -577,8 +574,7 @@
   1.178  		     (string-match pattern (buffer-file-name)))
   1.179  		(and (symbolp pattern) major-mode (eq major-mode pattern)))
   1.180  	    (eval job))
   1.181 -	(setq list (cdr list)))))
   1.182 -)
   1.183 +	(setq list (cdr list))))))
   1.184  
   1.185  (defun goto-buffer-window (buffer)
   1.186    "Select window which is bound to BUFFER.
   1.187 @@ -604,8 +600,7 @@
   1.188  	     (let ((w (win:get-buffer-window buffer)))
   1.189  	       (and w (win:switch-window w))))
   1.190  	(select-window (get-buffer-window buffer)))
   1.191 -       (t (switch-to-buffer buffer))))
   1.192 -)
   1.193 +       (t (switch-to-buffer buffer)))))
   1.194  
   1.195  ;; Here starts the functions which support gmhist-vs-Emacs19 compatible
   1.196  ;; reading with history.
   1.197 @@ -644,6 +639,18 @@
   1.198      (read-with-history-in hsym prompt init))
   1.199     (t (read-string prompt init))))
   1.200  
   1.201 +;;;###autoload
   1.202 +(fset 'YaTeX-rassoc
   1.203 +      (if (and nil (fboundp 'rassoc) (subrp (symbol-function 'rassoc)))
   1.204 +	  (symbol-function 'rassoc)
   1.205 +	(lambda (key list)
   1.206 +	  (let ((l list))
   1.207 +	    (catch 'found
   1.208 +	      (while l
   1.209 +		(if (equal key (cdr (car l)))
   1.210 +		    (throw 'found (car l)))
   1.211 +		(setq l (cdr l))))))))
   1.212 +
   1.213  ;;;
   1.214  ;; Interface function for windows.el
   1.215  ;;;
   1.216 @@ -719,8 +726,7 @@
   1.217  		    (throw 'begin t)))))
   1.218  	  (buffer-substring
   1.219  	   (progn (skip-chars-forward open) (1+ (point)))
   1.220 -	   (progn (skip-chars-forward close) (point))))))
   1.221 -)
   1.222 +	   (progn (skip-chars-forward close) (point)))))))
   1.223  
   1.224  (defun YaTeX-end-environment ()
   1.225    "Close opening environment"
   1.226 @@ -744,8 +750,7 @@
   1.227  	    (sit-for (if YaTeX-dos 2 1))
   1.228  	  (message "Matches with %s at line %d"
   1.229  		   (YaTeX-replace-format-args YaTeX-struct-begin env "" "")
   1.230 -		   (count-lines (point-min) (point)))))))
   1.231 -)
   1.232 +		   (count-lines (point-min) (point))))))))
   1.233  
   1.234  ;;;VER2
   1.235  (defun YaTeX-insert-struc (what env)
   1.236 @@ -755,8 +760,7 @@
   1.237  	     YaTeX-struct-begin env (YaTeX-addin env))))
   1.238     ((eq what 'end)
   1.239      (insert (YaTeX-replace-format-args YaTeX-struct-end env)))
   1.240 -   (t nil))
   1.241 -)
   1.242 +   (t nil)))
   1.243  
   1.244  ;;; Function for menu support
   1.245  (defun YaTeX-define-menu (keymap bindlist)