yatex

changeset 397:d9c23841313b dev

text reader changed to YaTeX-read-string-or-skip
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 16 Jan 2015 14:59:29 +0900
parents 2fc714f03ddf
children 8c8757ac9b62
files yatexadd.el
diffstat 1 files changed, 25 insertions(+), 32 deletions(-) [+]
line diff
     1.1 --- a/yatexadd.el	Fri Jan 16 10:47:48 2015 +0900
     1.2 +++ b/yatexadd.el	Fri Jan 16 14:59:29 2015 +0900
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*-
     1.5  ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org]
     1.6 -;;; Last modified Fri Jan 16 10:29:11 2015 on firestorm
     1.7 +;;; Last modified Fri Jan 16 14:57:59 2015 on firestorm
     1.8  ;;; $Id$
     1.9  
    1.10  ;;; Code:
    1.11 @@ -26,7 +26,7 @@
    1.12  	(setq width (concat "{" (YaTeX:read-length "Width: ") "}")))
    1.13      (setq loc (YaTeX:read-position "tb")
    1.14  	  bars (string-to-int
    1.15 -		(read-string-with-history
    1.16 +		(YaTeX-read-string-or-skip
    1.17  		 "Number of columns(0 for default format): " "3")))
    1.18      (if (<= bars 0)
    1.19  	(setq				;if 0, simple format
    1.20 @@ -50,7 +50,7 @@
    1.21         (t (setq rule (concat "|" rule "|")
    1.22  		hline "\\hline"))))
    1.23  
    1.24 -    (setq rule (read-string-with-history "rule format: " rule))
    1.25 +    (setq rule (YaTeX-read-string-or-skip "rule format: " rule))
    1.26      (setq YaTeX-single-command "hline")
    1.27  
    1.28      (format "%s%s{%s}" width loc rule)))
    1.29 @@ -176,12 +176,6 @@
    1.30  	  YaTeX:alignat YaTeX:alignat* YaTeX:xalignat YaTeX:xalignat*
    1.31  	  YaTeX:xxalignat YaTeX:xxalignat*))
    1.32  
    1.33 -(defun YaTeX:alignat ()
    1.34 -  (YaTeX:equation)
    1.35 -  (concat "{" (read-string-with-history "Number of cols: ") "}"))
    1.36 -
    1.37 -
    1.38 -
    1.39  (defun YaTeX:list ()
    1.40    "%\n{} %default label\n{} %formatting parameter")
    1.41  
    1.42 @@ -243,7 +237,7 @@
    1.43  (defun YaTeX::parbox (argp)
    1.44    (cond
    1.45     ((= argp 1) (YaTeX:read-length "Width: "))
    1.46 -   ((= argp 2) (read-string-with-history "Text: "))))
    1.47 +   ((= argp 2) (YaTeX-read-string-or-skip "Text: "))))
    1.48  
    1.49  (defun YaTeX::dashbox ()
    1.50    (concat "{" (read-string-with-history "Dash dimension: ") "}"
    1.51 @@ -252,7 +246,7 @@
    1.52  (defun YaTeX::savebox (argp)
    1.53    (cond
    1.54     ((= argp 1) (read-string-with-history "Saved into name: " "\\"))
    1.55 -   ((= argp 2) (read-string-with-history "Text: "))))
    1.56 +   ((= argp 2) (YaTeX-read-string-or-skip "Text: "))))
    1.57  
    1.58  (defvar YaTeX-minibuffer-quick-map nil)
    1.59  (if YaTeX-minibuffer-quick-map nil
    1.60 @@ -309,7 +303,7 @@
    1.61     ")"))
    1.62  
    1.63  (defun YaTeX:itembox ()
    1.64 -  (concat "{" (read-string-with-history "Item heading string: ") "}"))
    1.65 +  (concat "{" (YaTeX-read-string-or-skip "Item heading string: ") "}"))
    1.66  
    1.67  ;;;
    1.68  ;;Sample functions for maketitle-type command.
    1.69 @@ -346,7 +340,7 @@
    1.70  (defun YaTeX:verb ()
    1.71    "Enclose \\verb's contents with the same characters."
    1.72    (let ((quote-char (read-string-with-history "Quoting char: " "|"))
    1.73 -	(contents (read-string-with-history "Quoted contents: ")))
    1.74 +	(contents (YaTeX-read-string-or-skip "Quoted contents: ")))
    1.75      (concat quote-char contents quote-char)))
    1.76  
    1.77  (fset 'YaTeX:verb* 'YaTeX:verb)
    1.78 @@ -356,12 +350,12 @@
    1.79    nil)
    1.80  
    1.81  (defun YaTeX:cite ()
    1.82 -  (let ((comment (read-string-with-history "Comment for citation: ")))
    1.83 +  (let ((comment (YaTeX-read-string-or-skip "Comment for citation: ")))
    1.84      (if (string= comment "") ""
    1.85        (concat "[" comment "]"))))
    1.86  
    1.87  (defun YaTeX:bibitem ()
    1.88 -  (let ((label (read-string-with-history "Citation label for bibitem: ")))
    1.89 +  (let ((label (YaTeX-read-string-or-skip "Citation label for bibitem: ")))
    1.90      (if (string= label "") ""
    1.91        (concat "[" label "]"))))
    1.92  
    1.93 @@ -612,7 +606,7 @@
    1.94    (let ((default (condition-case nil
    1.95  		     (YaTeX::ref-default-label)
    1.96  		   (error (substring (current-time-string) 4)))))
    1.97 -    (read-string-with-history "Give a label for this line: "
    1.98 +    (YaTeX-read-string-or-skip "Give a label for this line: "
    1.99  		 (if YaTeX-emacs-19 (cons default 1) default))))
   1.100  
   1.101  (defun YaTeX::ref-getset-label (buffer point &optional noset)
   1.102 @@ -1403,7 +1397,7 @@
   1.103  	   (hilit-auto-highlight nil)
   1.104  	   (pcnt (regexp-quote YaTeX-comment-prefix))
   1.105  	   (bibrx (concat YaTeX-ec-regexp "bibliography{\\([^}]+\\)}"))
   1.106 -	   (bibptn (read-string-with-history "Pattern: "))
   1.107 +	   (bibptn (YaTeX-read-string-or-skip "Pattern: "))
   1.108  	   (bbuf (get-buffer-create " *bibitems*"))
   1.109  	   (standard-output bbuf)
   1.110  	   (me 'YaTeX::cite)		;shuld set this for using YaTeX::ref
   1.111 @@ -1517,7 +1511,7 @@
   1.112      (let ((argc
   1.113  	   (string-to-int
   1.114  	    (read-string-with-history "Number of arguments(Default 0): ")))
   1.115 -	  (def (read-string-with-history "Definition: "))
   1.116 +	  (def (YaTeX-read-string-or-skip "Definition: "))
   1.117  	  (command (get 'YaTeX::newcommand 'command)))
   1.118        ;;!!! It's illegal to insert string in the add-in function !!!
   1.119        (if (> argc 0) (insert (format "[%d]" argc)))
   1.120 @@ -1627,7 +1621,7 @@
   1.121       nil nil "\\")
   1.122      )
   1.123     ((equal 2 argp)
   1.124 -    (read-string-with-history "Length: " nil 'YaTeX:length-history))))
   1.125 +    (YaTeX-read-string-or-skip "Length: " nil 'YaTeX:length-history))))
   1.126  
   1.127  (fset 'YaTeX::addtolength 'YaTeX::setlength)
   1.128  
   1.129 @@ -1642,7 +1636,7 @@
   1.130       'YaTeX:style-parameters-local
   1.131       nil nil "\\"))
   1.132     ((equal 2 argp)
   1.133 -    (read-string-with-history "Text: "))))
   1.134 +    (YaTeX-read-string-or-skip "Text: "))))
   1.135  
   1.136  (defun YaTeX::newlength (&optional argp)
   1.137    "YaTeX add-in function for arguments of \\newlength"
   1.138 @@ -1666,7 +1660,7 @@
   1.139     ((equal 2 argp)
   1.140      (YaTeX:read-oneof "|lrc" nil t))
   1.141     ((equal 3 argp)
   1.142 -    (read-string-with-history "Item: "))))
   1.143 +    (YaTeX-read-string-or-skip "Item: "))))
   1.144  
   1.145  (defvar YaTeX:documentstyles-default
   1.146    '(("article") ("jarticle") ("j-article")
   1.147 @@ -1813,12 +1807,12 @@
   1.148  	    YaTeX-default-documentclass sname)))))
   1.149  
   1.150  (defun YaTeX::title (&optional argp)
   1.151 -  (prog1 (read-string-with-history "Document Title: ")
   1.152 +  (prog1 (YaTeX-read-string-or-skip "Document Title: ")
   1.153      (setq YaTeX-section-name "author"
   1.154  	  YaTeX-single-command "maketitle")))
   1.155  
   1.156  (defun YaTeX::author (&optional argp)
   1.157 -  (prog1 (read-string-with-history "Document Author: ")
   1.158 +  (prog1 (YaTeX-read-string-or-skip "Document Author: ")
   1.159      (setq YaTeX-section-name "date"
   1.160  	  YaTeX-single-command "maketitle")))
   1.161  
   1.162 @@ -1872,7 +1866,7 @@
   1.163    "Add-in for \\color's argument"
   1.164    (cond
   1.165     ((= argp 1) (YaTeX::color-completing-read "Color: "))
   1.166 -   ((= argp 2) (read-string-with-history "Colored string: "))))
   1.167 +   ((= argp 2) (YaTeX-read-string-or-skip "Colored string: "))))
   1.168  
   1.169  (fset 'YaTeX:color 'YaTeX:textcolor)
   1.170  (fset 'YaTeX::color 'YaTeX::textcolor)
   1.171 @@ -1886,14 +1880,13 @@
   1.172    (cond
   1.173     ((= argp 1) (YaTeX::color-completing-read "Frame color: "))
   1.174     ((= argp 2) (YaTeX::color-completing-read "Inner color: "))
   1.175 -   ((= argp 3) (read-string-with-history "Colored string: "))))
   1.176 +   ((= argp 3) (YaTeX-read-string-or-skip "Colored string: "))))
   1.177  
   1.178  (defun YaTeX:scalebox ()
   1.179    "Add-in for \\scalebox"
   1.180 -  (let ((vmag (read-string
   1.181 -	       (if YaTeX-japan "倍率(負で反転): "
   1.182 +  (let ((vmag (YaTeX-read-string-or-skip (if YaTeX-japan "倍率(負で反転): "
   1.183  		 "Magnification(Negative for flipped): ")))
   1.184 -	(hmag (read-string-with-history (if YaTeX-japan "縦倍率(省略可): "
   1.185 +	(hmag (YaTeX-read-string-or-skip (if YaTeX-japan "縦倍率(省略可): "
   1.186  			     "Vertical magnification(Optional): "))))
   1.187      (if (and hmag (string< "" hmag))
   1.188  	(format "{%s}[%s]" vmag hmag)
   1.189 @@ -1929,7 +1922,7 @@
   1.190      (read-string-with-history (if YaTeX-japan "回転角(度; 左回り): "
   1.191  		   "Angle in degree(unclockwise): ")))
   1.192     ((= argp 2)
   1.193 -	(read-string-with-history (if YaTeX-japan "テキスト: " "Text: ")))))
   1.194 +	(YaTeX-read-string-or-skip (if YaTeX-japan "テキスト: " "Text: ")))))
   1.195  
   1.196  (defun YaTeX:includegraphics ()
   1.197    "Add-in for \\includegraphics's option"
   1.198 @@ -2064,7 +2057,7 @@
   1.199  (defun YaTeX::mask (argp)
   1.200    (cond
   1.201     ((equal argp 1)
   1.202 -    (read-string-with-history "String: "))
   1.203 +    (YaTeX-read-string-or-skip "String: "))
   1.204     ((equal argp 2)
   1.205      (let (c)
   1.206        (while (not (memq c '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K)))
   1.207 @@ -2087,7 +2080,7 @@
   1.208     ((equal argp 4)
   1.209      (YaTeX:read-oneof "lcr" 'quick))
   1.210     ((equal argp 5)
   1.211 -    (read-string-with-history "String: "))))
   1.212 +    (YaTeX-read-string-or-skip "String: "))))
   1.213  
   1.214  (defun YaTeX::textcircled (argp)
   1.215    (cond
   1.216 @@ -2189,7 +2182,7 @@
   1.217  (defun YaTeX::DeclareMathOperator (argp)
   1.218    (cond
   1.219     ((equal argp 1)
   1.220 -    (read-string-with-history "Operator: " "\\"))))
   1.221 +    (YaTeX-read-string-or-skip "Operator: " "\\"))))
   1.222  
   1.223  ;;;
   1.224  ;; Add-in functions for large-type command.