yatex

diff yatexlib.el @ 49:eb0512bfcb7f

Abolish user-article table. Use normal read-string instead. Supply smart add-in function for documentstyle. Update user dictionary whenever new words entered. Enhance [prefix] c. Allow user defined sectioning commands in yatexsec.
author yuuji
date Fri, 25 Nov 1994 08:26:13 +0000
parents d7e7b4654058
children b0371b6ed799
line diff
     1.1 --- a/yatexlib.el	Mon Oct 24 17:26:47 1994 +0000
     1.2 +++ b/yatexlib.el	Fri Nov 25 08:26:13 1994 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4  ;;; YaTeX library of general functions.
     1.5  ;;; yatexlib.el
     1.6  ;;; (c )1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
     1.7 -;;; Last modified Mon Oct 10 22:14:14 1994 on VFR
     1.8 +;;; Last modified Thu Nov 24 02:20:45 1994 on VFR
     1.9  ;;; $Id$
    1.10  
    1.11  ;;;###autoload
    1.12 @@ -11,7 +11,7 @@
    1.13  Optional arguments after BOUND, ERR, CNT are passed literally to search-forward
    1.14  or search-backward.
    1.15  Optional sixth argument FUNC changes search-function."
    1.16 -  (let ((sfunc (if func func 'search-forward)) found md)
    1.17 +  (let ((sfunc (or func 'search-forward)) found md)
    1.18      (while (and (prog1
    1.19  		    (setq found (funcall sfunc string bound err cnt))
    1.20  		  (setq md (match-data)))
    1.21 @@ -122,7 +122,7 @@
    1.22    "Make BUFFER show up in certain window (but current window)
    1.23  that gives the maximum value by the FUNC.  FUNC should take an argument
    1.24  of its window object.  Non-nil for optional third argument SELECT selects
    1.25 -that window."
    1.26 +that window.  This function never selects minibuffer window."
    1.27    (or (and (if YaTeX-emacs-19
    1.28  	       (get-buffer-window buffer t)
    1.29  	     (get-buffer-window buffer))
    1.30 @@ -158,7 +158,8 @@
    1.31  	  (switch-to-buffer buffer)
    1.32  	  (or select (select-window window)))
    1.33  	 ((= (length wlist) 2)
    1.34 -	  (other-window 1)
    1.35 +	  ;(other-window 1);This does not work properly on Emacs-19
    1.36 +	  (select-window (get-lru-window))
    1.37  	  (switch-to-buffer buffer)
    1.38  	  (or select (select-window window)))
    1.39  	 (t				;if one-window
    1.40 @@ -208,23 +209,33 @@
    1.41    "Return (buffer-substring (match-beginning n) (match-beginning m))."
    1.42    (if (match-beginning n)
    1.43        (buffer-substring (match-beginning n)
    1.44 -			(match-end (if m m n))))
    1.45 +			(match-end (or m n))))
    1.46  )
    1.47  
    1.48  ;;;###autoload
    1.49  (defun YaTeX-minibuffer-complete ()
    1.50 -  "Complete in minibuffer"
    1.51 +  "Complete in minibuffer.
    1.52 +If the symbol 'delim is bound and is string, its value is assumed to be
    1.53 +the character class of delimiters.  Completion will be performed on
    1.54 +the last field separated by those delimiters."
    1.55    (interactive)
    1.56 -  (let (beg word compl)
    1.57 -    (setq beg (if (and (boundp 'delim) delim)
    1.58 +  (let (beg word compl (md (match-data)))
    1.59 +    (setq beg (if (and (boundp 'delim) (stringp delim))
    1.60  		  (save-excursion
    1.61  		    (skip-chars-backward (concat "^" delim))
    1.62 -		    (1- (point)))
    1.63 +		    (point))
    1.64  		(point-min))
    1.65  	  word (buffer-substring beg (point-max))
    1.66  	  compl (try-completion word minibuffer-completion-table))
    1.67      (cond
    1.68 -     ((eq compl t) nil)
    1.69 +     ((eq compl t)
    1.70 +      (let ((p (point)) (max (point-max)))
    1.71 +	(goto-char max)
    1.72 +	(insert " [Sole completion]")
    1.73 +	(goto-char p)
    1.74 +	(sit-for 1)
    1.75 +	(delete-region max (point-max))
    1.76 +	(goto-char p)))
    1.77       ((eq compl nil)
    1.78        (ding)
    1.79        (save-excursion
    1.80 @@ -240,7 +251,8 @@
    1.81  	 (all-completions word minibuffer-completion-table))))
    1.82       (t (delete-region beg (point-max))
    1.83  	(insert compl))
    1.84 -     ))
    1.85 +     )
    1.86 +    (store-match-data md))
    1.87  )
    1.88  
    1.89