yatex

diff yatexmth.el @ 52:5d94deabb9f9

Set YaTeX-indent-line to 'indent-line-function. Revise fill features.
author yuuji
date Sun, 22 Jan 1995 14:20:46 +0000
parents b0371b6ed799
children 5f4b18da14b3
line diff
     1.1 --- a/yatexmth.el	Tue Dec 20 21:00:21 1994 +0000
     1.2 +++ b/yatexmth.el	Sun Jan 22 14:20:46 1995 +0000
     1.3 @@ -1,14 +1,14 @@
     1.4  ;;; -*- Emacs-Lisp -*-
     1.5  ;;; YaTeX math-mode-specific functions.
     1.6 -;;; yatexmth.el rev.2
     1.7 -;;; (c )1993-1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
     1.8 -;;; Last modified Fri Dec  2 17:03:30 1994 on VFR
     1.9 +;;; yatexmth.el rev.3
    1.10 +;;; (c )1993-1995 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
    1.11 +;;; Last modified Sun Jan 22 23:14:51 1995 on landcruiser
    1.12  ;;; $Id$
    1.13  
    1.14  ;;; [Customization guide]
    1.15  ;;;
    1.16  ;;;	  By default,  you can use two  completion  groups in YaTeX math
    1.17 -;;;	mode, `;' for mathematical signs and `/' for greek letters.  But
    1.18 +;;;	mode, `;' for mathematical signs and `:' for greek letters.  But
    1.19  ;;;	you  can add other completion groups   by defining the  alist of
    1.20  ;;;	`prefix  key'    vs   `completion   list'    into  the  variable
    1.21  ;;;	YaTeX-math-key-list-private.  If  you wish  to    accomplish the
    1.22 @@ -50,7 +50,7 @@
    1.23  
    1.24  ;;; 【イメージ補完の追加方法】
    1.25  ;;;
    1.26 -;;;	  標準のイメージ補完では、「;」で始まる数式記号補完と、「/」で始
    1.27 +;;;	  標準のイメージ補完では、「;」で始まる数式記号補完と、「:」で始
    1.28  ;;;	まるギリシャ文字補完が使用可能ですが、これ以外の文字で始まる補完
    1.29  ;;;	シリーズも定義することができます。例えば、「,」で始まる次のよう
    1.30  ;;;	な補完シリーズを定義する場合を考えてみます。
    1.31 @@ -108,7 +108,7 @@
    1.32  (YaTeX-setq-math-sym YaTeX-image-flat		"b"		"♭")
    1.33  (YaTeX-setq-math-sym YaTeX-image-sqrt		""		"√")
    1.34  
    1.35 -(setq
    1.36 +(defvar
    1.37   YaTeX-math-sign-alist-default
    1.38   '(
    1.39     ;frequently used
    1.40 @@ -258,15 +258,15 @@
    1.41     ("D"		"diamondsuit"	"/\\\n\\/")
    1.42     ("H"		"heartsuit"	"<^^>\n \\/")
    1.43     ("S"		"spadesuit"	" /\\\n<++>\n /\\")
    1.44 -
    1.45 -   ))
    1.46 +   )
    1.47 + "Default LaTeX-math-command alist.")
    1.48  
    1.49  (defvar YaTeX-math-sign-alist-private nil
    1.50    "*User definable key vs LaTeX-math-command alist.")
    1.51  
    1.52  (defvar YaTeX-math-quit-with-strict-match nil
    1.53    "*T for quitting completion as soon as strict-match is found.")
    1.54 -(setq YaTeX-math-sign-alist
    1.55 +(defvar YaTeX-math-sign-alist
    1.56        (append YaTeX-math-sign-alist-private YaTeX-math-sign-alist-default))
    1.57  
    1.58  ;;(defun YaTeX-math-alist2array (alist array)
    1.59 @@ -278,7 +278,7 @@
    1.60  ;;	 array))
    1.61  ;;)
    1.62  
    1.63 -(setq YaTeX-greek-key-alist-default
    1.64 +(defvar YaTeX-greek-key-alist-default
    1.65    '(
    1.66      ("a"	"alpha"		("a" "α"))
    1.67      ("b"	"beta"		("|>\n|>\n|" "β"))
    1.68 @@ -326,19 +326,18 @@
    1.69      ("W"	"Omega"		("(~)\n~ ~" "Ω"))
    1.70      ("f" "foo")
    1.71      )
    1.72 -)
    1.73 +  "Default LaTeX-math-command alist.")
    1.74  
    1.75  (defvar YaTeX-greek-key-alist-private nil
    1.76    "*User definable key vs LaTeX-math-command alist.")
    1.77  
    1.78 -(setq YaTeX-greek-key-alist
    1.79 +(defvar YaTeX-greek-key-alist
    1.80        (append YaTeX-greek-key-alist-private YaTeX-greek-key-alist-default))
    1.81  
    1.82  ;;(mapcar (function (lambda (x) (YaTeX-math-alist2array x)))
    1.83  ;;	YaTeX-math-key-list)
    1.84  
    1.85 -(setq YaTeX-math-indicator
    1.86 -  "KEY\tLaTeX sequence\t\tsign")
    1.87 +(defvar YaTeX-math-indicator "KEY\tLaTeX sequence\t\tsign")
    1.88  
    1.89  (defvar YaTeX-math-need-image t
    1.90    "*T for displaying pseudo image momentarily.")
    1.91 @@ -585,14 +584,15 @@
    1.92  	  (setq buffer-file-name name)
    1.93  	  (set-buffer-modified-p modified)))))
    1.94  
    1.95 -(defun YaTeX-math-insert-sequence (&optional force)
    1.96 +(defun YaTeX-math-insert-sequence (&optional force initial)
    1.97    "Insert math-mode sequence with image completion."
    1.98    (interactive "P")
    1.99 -  (let*((key "") regkey str  last-char list i
   1.100 +  (let*((key (or initial "")) regkey str  last-char list i
   1.101  	(case-fold-search nil) match sign
   1.102  	(this-key (char-to-string last-command-char))
   1.103  	(alist (symbol-value (cdr (assoc this-key YaTeX-math-key-list))))
   1.104  	(n (length alist)) (beg (point)) result)
   1.105 +    (if initial (insert YaTeX-ec (car (cdr (assoc initial alist)))))
   1.106      (setq result
   1.107  	  (catch 'complete
   1.108  	    (if (and (not force)
   1.109 @@ -669,7 +669,7 @@
   1.110        (message "Abort."))
   1.111       ((eq result 'escape)
   1.112        (delete-region beg (point))
   1.113 -      (insert this-key))
   1.114 +      (call-interactively (global-key-binding this-key)))
   1.115       ((eq result 'select)
   1.116        (message "Done."))
   1.117       ((eq result 'exit)
   1.118 @@ -680,6 +680,21 @@
   1.119        (setq key (concat "^" (regexp-quote (substring key 0 -1))))
   1.120        (insert (YaTeX-math-show-menu key)))))
   1.121  )
   1.122 +
   1.123 +;; ----- Change image completion types -----
   1.124 +(defun YaTeX-math-member-p (item)
   1.125 +  "Check if ITEM is a member of image completion.
   1.126 +If so return the cons of its invocation key and image-string."
   1.127 +  (let ((lists YaTeX-math-key-list) list)
   1.128 +    (catch 'found
   1.129 +      (while lists
   1.130 +	(setq list (symbol-value (cdr (car lists))))
   1.131 +	(while list
   1.132 +	  (if (string= item (nth 1 (car list)))
   1.133 +	      (throw 'found (cons (car (car lists)) (nth 0 (car list)))))
   1.134 +	  (setq list (cdr list)))
   1.135 +	(setq lists (cdr lists))))))
   1.136 +
   1.137  ;;
   1.138  (provide 'yatexmth)
   1.139