diff --git a/yahtml.el b/yahtml.el index 86d9bf6..c6c0069 100644 --- a/yahtml.el +++ b/yahtml.el @@ -1,6 +1,6 @@ ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- ;;; (c) 1994-2013 by HIROSE Yuuji [yuuji(@)yatex.org] -;;; Last modified Thu Jan 15 11:34:59 2015 on firestorm +;;; Last modified Fri Jan 16 10:00:10 2015 on firestorm ;;; $Id$ (defconst yahtml-revision-number "1.77" @@ -898,7 +898,7 @@ (defun yahtml-read-css (alist) (let ((completion-ignore-case t) (delim " ") (minibuffer-completion-table alist)) - (read-from-minibuffer + (read-from-minibuffer-with-history (substitute-command-keys (if YaTeX-japan "�N���X(�����w���\\[quoted-insert] SPC�ŋ�؂�): " @@ -1125,12 +1125,13 @@ (setq yahtml-completing-buffer (current-buffer) yahtml-urls (append yahtml-urls-private yahtml-urls-local) href (yahtml-escape-chars-string - (read-from-minibuffer "href: " "" yahtml-url-completion-map))) + (read-from-minibuffer-with-history + "href: " "" yahtml-url-completion-map))) (prog1 (concat (yahtml-make-optional-argument "href" href) (yahtml-make-optional-argument - "name" (read-string "name: "))) + "name" (read-string-with-history "name: "))) (if (and (string-match "^http://" href) (null (assoc href yahtml-urls-private)) (null (assoc href yahtml-urls-local))) @@ -1179,13 +1180,14 @@ ((eq alist 'command) (if (fboundp 'read-shell-command) (read-shell-command prompt) - (read-string prompt))) + (read-string-with-history prompt))) ((and alist (symbolp alist)) - (completing-read prompt (symbol-value alist) nil nil default)) + (completing-read-with-history + prompt (symbol-value alist) nil nil default)) (alist - (completing-read prompt alist nil nil default)) + (completing-read-with-history prompt alist nil nil default)) (t - (read-string prompt default))))) + (read-string-with-history prompt default))))) (defun yahtml-make-optional-argument (opt arg) "Make optional argument string." @@ -1211,11 +1213,11 @@ (cond (yahtml-html4-strict nil) (t - (let ((b (read-string "bgcolor=")) + (let ((b (read-string-with-history "bgcolor=")) (bg (yahtml-read-parameter "background" "")) - (x (read-string "text color=")) - (l (read-string "link color=")) - (v (read-string "vlink color="))) + (x (read-string-with-history "text color=")) + (l (read-string-with-history "link color=")) + (v (read-string-with-history "vlink color="))) (concat (yahtml-make-optional-argument "bgcolor" b) (yahtml-make-optional-argument "background" bg) @@ -1236,7 +1238,7 @@ (let ((src (yahtml-read-parameter "src")) (alg (yahtml-read-parameter "align")) alt - (brd (read-string "border=")) + (brd (read-string-with-history "border=")) (l yahtml-prefer-upcase-attributes) info width height bytes comments) (and (stringp src) (string< "" src) (file-exists-p src) @@ -1394,21 +1396,21 @@ "Add-in function `form' input format" (concat " " (if yahtml-prefer-upcase-attributes "METHOD" "method") "=\"" - (completing-read "Method: " '(("POST") ("GET")) nil t) + (completing-read-with-history "Method: " '(("POST") ("GET")) nil t) "\"" (yahtml-make-optional-argument (if yahtml-prefer-upcase-attributes "ENCTYPE" "enctype") - (completing-read + (completing-read-with-history "Enctype: " '(("application/x-www-form-urlencoded") ("multipart/form-data")))) " " (if yahtml-prefer-upcase-attributes "ACTION" "action") "=\"" - (read-string "Action: ") "\"")) + (read-string-with-history "Action: ") "\"")) (defun yahtml:select () "Add-in function for `select' input format" (setq yahtml-last-single-cmd "option") (concat " " (if yahtml-prefer-upcase-attributes "NAME" "name") "=\"" - (read-string "name: ") "\"")) + (read-string-with-history "name: ") "\"")) (defun yahtml:ol () "Add-in function for
    " @@ -1439,7 +1441,7 @@ "Add-in function for `input' form" (let ((size "") name type value checked (maxlength "") (l yahtml-prefer-upcase-attributes)) - (setq name (read-string "name: ") + (setq name (read-string-with-history "name: ") type (YaTeX-completing-read-or-skip "type (default=text): " yahtml-input-types nil t) value (YaTeX-read-string-or-skip "value: ")) @@ -1457,9 +1459,9 @@ "Add-in function for `textarea'" (interactive) (let (name rows cols) - (setq name (read-string "Name: ") - cols (read-string "Columns: ") - rows (read-string "Rows: ")) + (setq name (read-string-with-history "Name: ") + cols (read-string-with-history "Columns: ") + rows (read-string-with-history "Rows: ")) (concat (concat (if yahtml-prefer-upcase-attributes "NAME=" "name=") "\"" name "\"") @@ -1468,7 +1470,7 @@ (defun yahtml:table () "Add-in function for `table'" - (let ((b (read-string "border=")) + (let ((b (read-string-with-history "border=")) (a (yahtml-read-parameter "align" nil '(("align" ("right")("center")))))) (if yahtml-html4-strict @@ -1506,13 +1508,13 @@ (defun yahtml:font () "Add-in function for `font'" (concat - (yahtml-make-optional-argument "color" (read-string "color=")) - (yahtml-make-optional-argument "size" (read-string "size=")))) + (yahtml-make-optional-argument "color" (read-string-with-history "color=")) + (yahtml-make-optional-argument "size" (read-string-with-history "size=")))) (defun yahtml:style () "Add-in function for `style'" (yahtml-make-optional-argument - "type" (read-string "type=" "text/css"))) + "type" (read-string-with-history "type=" "text/css"))) (defun yahtml:script () "Add-in function for `script'" @@ -1547,7 +1549,8 @@ "type" (yahtml-read-parameter "type" "text/css")) (progn (setq href - (read-from-minibuffer "href: " "" yahtml-url-completion-map)) + (read-from-minibuffer-with-history + "href: " "" yahtml-url-completion-map)) (if (string< "" href) (progn (if (and (file-exists-p (yahtml-url-to-path href)) @@ -1564,7 +1567,8 @@ "type" (yahtml-read-parameter "type" "text/css")) (yahtml-make-optional-argument "href" - (read-from-minibuffer "href: " "" yahtml-url-completion-map))))))) + (read-from-minibuffer-with-history + "href: " "" yahtml-url-completion-map))))))) (defvar yahtml:meta-names '(("name" ("keywords")("author")("copyright")("date")("GENERATOR")))) @@ -1591,18 +1595,19 @@ "content" (cond ((string-match "date" name) - (read-string "Date: " (current-time-string))) + (read-string-with-history "Date: " (current-time-string))) ((string-match "author" name) - (read-string "Author: " + (read-string-with-history "Author: " (if (and (user-full-name) (string< "" (user-full-name))) (user-full-name) (user-login-name)))) ((string-match "GENERATOR" name) - (setq content (read-string "Generator: " "User-agent: ")) + (setq content (read-string-with-history + "Generator: " "User-agent: ")) (if (string-match "yahtml" content) (message "Thank you!")) content) - (t (read-string (concat name ": "))))))))) + (t (read-string-with-history (concat name ": "))))))))) (defun yahtml:br () (yahtml-make-optional-argument "clear" (yahtml-read-parameter "clear"))) @@ -2376,7 +2381,8 @@ (let ((e (cond ((null e) "td") ((stringp e) e) - (t (read-string "Enclose with(`thd' means th td td..): " "th")))) + (t (read-string-with-history + "Enclose with(`thd' means th td td..): " "th")))) (ws "[ \t]") elm p i) (if (string= delim "") (setq delim " \t\n")) @@ -2408,8 +2414,8 @@ "Enclose lines in a form tab-sv/csv with ..." (interactive "P\nsDelimiter(s): \nr") (setq e (if (and e (listp e)) - (read-string "Enclose with(td or th, `thd' -> th td td td...: " - "th"))) + (read-string-with-history + "Enclose with(td or th, `thd' -> th td td td...: " "th"))) (save-excursion (save-restriction (narrow-to-region (point) (mark)) @@ -2866,7 +2872,7 @@ (YaTeX-reindent c)))) (defun yahtml-intelligent-newline-head () - (let ((title (read-string "Document title: ")) + (let ((title (read-string-with-history "Document title: ")) (b "") (e "") p) (yahtml-indent-line) (insert (format "%s" (if yahtml-prefer-upcases (upcase b) b))) @@ -2927,7 +2933,8 @@ (setq line (concat line (if (and (= i 0) th) "" "")) th nil i (1+ i))) - (setq fmt (read-string "`th' or `td' format: " "th td td")) + (setq fmt (read-string-with-history + "`th' or `td' format: " "th td td")) (while (string-match "t\\(h\\)\\|td" fmt i) (setq line (concat line (if (match-beginning 1) "" "")) diff --git a/yatex.el b/yatex.el index 617b98b..fc8186d 100644 --- a/yatex.el +++ b/yatex.el @@ -1,6 +1,6 @@ ;;; yatex.el --- Yet Another tex-mode for emacs //�쒹// -*- coding: sjis -*- ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Fri Jan 16 08:38:34 2015 on firestorm +;;; Last modified Fri Jan 16 09:19:57 2015 on firestorm ;;; $Id$ ;;; The latest version of this software is always available at; ;;; http://www.yatex.org/ @@ -972,7 +972,7 @@ (addin-args (funcall arg-reader j)) (YaTeX-skip-default-reader "") (t - (read-string + (read-string-with-history (format "Argument %d of %s: " j section))))) (insert (concat ;to allow nil return value @@ -2209,7 +2209,7 @@ (if (not (YaTeX-on-begin-end-p)) (comment-out-region (if alt-prefix - (read-string "Insert prefix: ") + (read-string-with-history "Insert prefix: ") YaTeX-comment-prefix)) (YaTeX-comment-uncomment-env 'comment-out-region))) @@ -2218,7 +2218,7 @@ (interactive "P") (if (not (YaTeX-on-begin-end-p)) (uncomment-out-region - (if alt-prefix (read-string "Remove prefix: ") + (if alt-prefix (read-string-with-history "Remove prefix: ") YaTeX-comment-prefix) (region-beginning) (region-end) YaTeX-uncomment-once) (YaTeX-comment-uncomment-env 'uncomment-out-region))) diff --git a/yatexadd.el b/yatexadd.el index 40e8e6a..ac6ed6d 100644 --- a/yatexadd.el +++ b/yatexadd.el @@ -1,7 +1,7 @@ ;;; yatexadd.el --- YaTeX add-in functions ;;; yatexadd.el rev.21 ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Tue Jan 6 08:53:41 2015 on firestorm +;;; Last modified Fri Jan 16 09:33:05 2015 on firestorm ;;; $Id$ ;;; Code: @@ -27,7 +27,8 @@ (setq width (concat "{" (YaTeX:read-length "Width: ") "}"))) (setq loc (YaTeX:read-position "tb") bars (string-to-int - (read-string "Number of columns(0 for default format): " "3"))) + (read-string-with-history + "Number of columns(0 for default format): " "3"))) (if (<= bars 0) (setq ;if 0, simple format rule YaTeX:tabular-default-rule @@ -41,7 +42,7 @@ (setq ans (read-char)) (cond ((or (equal ans ?t) (equal ans ?T)) - (setq ans (read-string "Rule width: " "1pt") + (setq ans (read-string-with-history "Rule width: " "1pt") rule (concat "@{" (format YaTeX:tabular-thick-vrule ans) "}" rule @@ -50,7 +51,7 @@ (t (setq rule (concat "|" rule "|") hline "\\hline")))) - (setq rule (read-string "rule format: " rule)) + (setq rule (read-string-with-history "rule format: " rule)) (setq YaTeX-single-command "hline") (format "%s%s{%s}" width loc rule))) @@ -58,10 +59,10 @@ (fset 'YaTeX:tabular* 'YaTeX:tabular) (fset 'YaTeX:supertabular 'YaTeX:tabular) (defun YaTeX:alignat () - (concat "{" (read-string "Number of columns: ") "}")) + (concat "{" (read-string-with-history "Number of columns: ") "}")) (defun YaTeX:array () (concat (YaTeX:read-position "tb") - "{" (read-string "Column format: ") "}")) + "{" (read-string-with-history "Column format: ") "}")) (defun YaTeX:subequations () (message (if YaTeX-japan "������₷���R�����g�ɕς����ref�⊮���y��" "Changing comment string reduces effort at `ref' completion")) @@ -178,7 +179,7 @@ (defun YaTeX:alignat () (YaTeX:equation) - (concat "{" (read-string "Number of cols: ") "}")) + (concat "{" (read-string-with-history "Number of cols: ") "}")) @@ -191,10 +192,10 @@ (defun YaTeX:thebibliography () (setq YaTeX-section-name "bibitem") - (concat "{" (read-string "Longest label: ") "}")) + (concat "{" (read-string-with-history "Longest label: ") "}")) (defun YaTeX:multicols () - (concat "{" (read-string "Number of columns: ") "}")) + (concat "{" (read-string-with-history "Number of columns: ") "}")) ;; wrapfig.sty @@ -214,7 +215,7 @@ (defun YaTeX:multiput () (concat (YaTeX:read-coordinates "Pos") (YaTeX:read-coordinates "Step") - "{" (read-string "How many times: ") "}")) + "{" (read-string-with-history "How many times: ") "}")) (defun YaTeX:put () (YaTeX:read-coordinates "Pos")) @@ -243,16 +244,16 @@ (defun YaTeX::parbox (argp) (cond ((= argp 1) (YaTeX:read-length "Width: ")) - ((= argp 2) (read-string "Text: ")))) + ((= argp 2) (read-string-with-history "Text: ")))) (defun YaTeX::dashbox () - (concat "{" (read-string "Dash dimension: ") "}" + (concat "{" (read-string-with-history "Dash dimension: ") "}" (YaTeX:read-coordinates "Dimension"))) (defun YaTeX::savebox (argp) (cond - ((= argp 1) (read-string "Saved into name: " "\\")) - ((= argp 2) (read-string "Text: ")))) + ((= argp 1) (read-string-with-history "Saved into name: " "\\")) + ((= argp 2) (read-string-with-history "Text: ")))) (defvar YaTeX-minibuffer-quick-map nil) (if YaTeX-minibuffer-quick-map nil @@ -301,13 +302,15 @@ (defun YaTeX:read-coordinates (&optional mes varX varY) (concat "(" - (read-string (format "%s %s: " (or mes "Dimension") (or varX "X"))) + (read-string-with-history + (format "%s %s: " (or mes "Dimension") (or varX "X"))) "," - (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y"))) + (read-string-with-history + (format "%s %s: " (or mes "Dimension") (or varY "Y"))) ")")) (defun YaTeX:itembox () - (concat "{" (read-string "Item heading string: ") "}")) + (concat "{" (read-string-with-history "Item heading string: ") "}")) ;;; ;;Sample functions for maketitle-type command. @@ -322,9 +325,9 @@ (defun YaTeX:lim () "Insert limit notation of \\lim." (YaTeX:check-completion-type 'maketitle) - (let ((var (read-string "Variable: ")) limit) + (let ((var (read-string-with-history "Variable: ")) limit) (if (string= "" var) "" - (setq limit (read-string "Limit ($ means infinity): ")) + (setq limit (read-string-with-history "Limit ($ means infinity): ")) (if (string= "$" limit) (setq limit "\\infty")) (concat "_{" var " \\rightarrow " limit "}")))) @@ -335,15 +338,16 @@ (defun YaTeX:read-boundary (ULchar) "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar." - (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): ")))) + (let ((bndry (read-string-with-history + (concat ULchar "{???} ($ for infinity): ")))) (if (string= bndry "") "" (if (string= bndry "$") (setq bndry "\\infty")) (concat ULchar "{" bndry "}")))) (defun YaTeX:verb () "Enclose \\verb's contents with the same characters." - (let ((quote-char (read-string "Quoting char: " "|")) - (contents (read-string "Quoted contents: "))) + (let ((quote-char (read-string-with-history "Quoting char: " "|")) + (contents (read-string-with-history "Quoted contents: "))) (concat quote-char contents quote-char))) (fset 'YaTeX:verb* 'YaTeX:verb) @@ -353,12 +357,12 @@ nil) (defun YaTeX:cite () - (let ((comment (read-string "Comment for citation: "))) + (let ((comment (read-string-with-history "Comment for citation: "))) (if (string= comment "") "" (concat "[" comment "]")))) (defun YaTeX:bibitem () - (let ((label (read-string "Citation label for bibitem: "))) + (let ((label (read-string-with-history "Citation label for bibitem: "))) (if (string= label "") "" (concat "[" label "]")))) @@ -609,7 +613,7 @@ (let ((default (condition-case nil (YaTeX::ref-default-label) (error (substring (current-time-string) 4))))) - (read-string "Give a label for this line: " + (read-string-with-history "Give a label for this line: " (if YaTeX-emacs-19 (cons default 1) default)))) (defun YaTeX::ref-getset-label (buffer point &optional noset) @@ -1256,7 +1260,7 @@ (let*((chmode (boundp (intern-soft "old"))) (dlab (if chmode old ;if called via YaTeX-change-section (tricky...) (YaTeX::ref-default-label))) - (label (read-string + (label (read-string-with-history (format "New %s name: " (or labname "label")) (cons dlab 1)))) (if (string< "" label) @@ -1400,7 +1404,7 @@ (hilit-auto-highlight nil) (pcnt (regexp-quote YaTeX-comment-prefix)) (bibrx (concat YaTeX-ec-regexp "bibliography{\\([^}]+\\)}")) - (bibptn (read-string "Pattern: ")) + (bibptn (read-string-with-history "Pattern: ")) (bbuf (get-buffer-create " *bibitems*")) (standard-output bbuf) (me 'YaTeX::cite) ;shuld set this for using YaTeX::ref @@ -1507,13 +1511,14 @@ (defun YaTeX::newcommand (&optional argp) (cond ((= argp 1) - (let ((command (read-string "Define newcommand: " "\\"))) + (let ((command (read-string-with-history "Define newcommand: " "\\"))) (put 'YaTeX::newcommand 'command (substring command 1)) command)) ((= argp 2) (let ((argc - (string-to-int (read-string "Number of arguments(Default 0): "))) - (def (read-string "Definition: ")) + (string-to-int + (read-string-with-history "Number of arguments(Default 0): "))) + (def (read-string-with-history "Definition: ")) (command (get 'YaTeX::newcommand 'command))) ;;!!! It's illegal to insert string in the add-in function !!! (if (> argc 0) (insert (format "[%d]" argc))) @@ -1540,7 +1545,7 @@ (defun YaTeX::newcounter (&optional argp) (cond ((= argp 1) - (read-string "New counter name: ")) + (read-string-with-history "New counter name: ")) (t ""))) ;; @@ -1638,13 +1643,13 @@ 'YaTeX:style-parameters-local nil nil "\\")) ((equal 2 argp) - (read-string "Text: ")))) + (read-string-with-history "Text: ")))) (defun YaTeX::newlength (&optional argp) "YaTeX add-in function for arguments of \\newlength" (cond ((equal argp 1) - (let ((length (read-string "Length variable: " "\\"))) + (let ((length (read-string-with-history "Length variable: " "\\"))) (if (string< "" length) (YaTeX-update-table (list length) @@ -1658,11 +1663,11 @@ "YaTeX add-in function for arguments of \\multicolumn." (cond ((equal 1 argp) - (read-string "Number of columns: ")) + (read-string-with-history "Number of columns: ")) ((equal 2 argp) (YaTeX:read-oneof "|lrc" nil t)) ((equal 3 argp) - (read-string "Item: ")))) + (read-string-with-history "Item: ")))) (defvar YaTeX:documentstyles-default '(("article") ("jarticle") ("j-article") @@ -1809,12 +1814,12 @@ YaTeX-default-documentclass sname))))) (defun YaTeX::title (&optional argp) - (prog1 (read-string "Document Title: ") + (prog1 (read-string-with-history "Document Title: ") (setq YaTeX-section-name "author" YaTeX-single-command "maketitle"))) (defun YaTeX::author (&optional argp) - (prog1 (read-string "Document Author: ") + (prog1 (read-string-with-history "Document Author: ") (setq YaTeX-section-name "date" YaTeX-single-command "maketitle"))) @@ -1868,7 +1873,7 @@ "Add-in for \\color's argument" (cond ((= argp 1) (YaTeX::color-completing-read "Color: ")) - ((= argp 2) (read-string "Colored string: ")))) + ((= argp 2) (read-string-with-history "Colored string: ")))) (fset 'YaTeX:color 'YaTeX:textcolor) (fset 'YaTeX::color 'YaTeX::textcolor) @@ -1882,14 +1887,14 @@ (cond ((= argp 1) (YaTeX::color-completing-read "Frame color: ")) ((= argp 2) (YaTeX::color-completing-read "Inner color: ")) - ((= argp 3) (read-string "Colored string: ")))) + ((= argp 3) (read-string-with-history "Colored string: ")))) (defun YaTeX:scalebox () "Add-in for \\scalebox" (let ((vmag (read-string (if YaTeX-japan "�{��(���Ŕ��]): " "Magnification(Negative for flipped): "))) - (hmag (read-string (if YaTeX-japan "�c�{��(�ȗ���): " + (hmag (read-string-with-history (if YaTeX-japan "�c�{��(�ȗ���): " "Vertical magnification(Optional): ")))) (if (and hmag (string< "" hmag)) (format "{%s}[%s]" vmag hmag) @@ -1904,9 +1909,11 @@ (if (string< "" (setq r (YaTeX:read-oneof "htbpB"))) (concat "[origin=" r "]"))) ((memq c '(?X ?x ?Y ?y)) - (setq r (read-string "" (if YaTeX-emacs-19 (cons defx 3) defx)) + (setq r (read-string-with-history + "" (if YaTeX-emacs-19 (cons defx 3) defx)) x (if (string< "x=" r) r) - r (read-string "" (if YaTeX-emacs-19 (cons defy 3) defy)) + r (read-string-with-history + "" (if YaTeX-emacs-19 (cons defy 3) defy)) y (if (string< "y=" r) r) something (or x y)) (format "%s%s%s%s%s" @@ -1920,10 +1927,10 @@ "Argument add-in for \\rotatebox" (cond ((= argp 1) - (read-string (if YaTeX-japan "��]�p(�x; �����): " + (read-string-with-history (if YaTeX-japan "��]�p(�x; �����): " "Angle in degree(unclockwise): "))) ((= argp 2) - (read-string (if YaTeX-japan "�e�L�X�g: " "Text: "))))) + (read-string-with-history (if YaTeX-japan "�e�L�X�g: " "Text: "))))) (defun YaTeX:includegraphics () "Add-in for \\includegraphics's option" @@ -2058,7 +2065,7 @@ (defun YaTeX::mask (argp) (cond ((equal argp 1) - (read-string "String: ")) + (read-string-with-history "String: ")) ((equal argp 2) (let (c) (while (not (memq c '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K))) @@ -2081,12 +2088,12 @@ ((equal argp 4) (YaTeX:read-oneof "lcr" 'quick)) ((equal argp 5) - (read-string "String: ")))) + (read-string-with-history "String: ")))) (defun YaTeX::textcircled (argp) (cond ((equal argp 1) - (let ((char (read-string "Circled char: ")) + (let ((char (read-string-with-history "Circled char: ")) (left "") (right "") c) (setq c (read-char "Enclose also with (s)mall (t)iny s(C)riptsize (N)one:")) @@ -2183,7 +2190,7 @@ (defun YaTeX::DeclareMathOperator (argp) (cond ((equal argp 1) - (read-string "Operator: " "\\")))) + (read-string-with-history "Operator: " "\\")))) ;;; ;; Add-in functions for large-type command.