yatex
diff yahtml.el @ 394:67fa6d791bc9
Workaround for `Same buffer in multiple frames' applied to yahtml
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Fri, 16 Jan 2015 10:13:08 +0900 |
parents | c44910b36b95 |
children | 2fc714f03ddf |
line diff
1.1 --- a/yahtml.el Thu Jan 15 23:21:24 2015 +0900 1.2 +++ b/yahtml.el Fri Jan 16 10:13:08 2015 +0900 1.3 @@ -1,6 +1,6 @@ 1.4 ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- 1.5 ;;; (c) 1994-2013 by HIROSE Yuuji [yuuji(@)yatex.org] 1.6 -;;; Last modified Thu Jan 15 11:34:59 2015 on firestorm 1.7 +;;; Last modified Fri Jan 16 10:00:10 2015 on firestorm 1.8 ;;; $Id$ 1.9 1.10 (defconst yahtml-revision-number "1.77" 1.11 @@ -898,7 +898,7 @@ 1.12 (defun yahtml-read-css (alist) 1.13 (let ((completion-ignore-case t) (delim " ") 1.14 (minibuffer-completion-table alist)) 1.15 - (read-from-minibuffer 1.16 + (read-from-minibuffer-with-history 1.17 (substitute-command-keys 1.18 (if YaTeX-japan 1.19 "クラス(複数指定は\\[quoted-insert] SPCで区切る): " 1.20 @@ -1125,12 +1125,13 @@ 1.21 (setq yahtml-completing-buffer (current-buffer) 1.22 yahtml-urls (append yahtml-urls-private yahtml-urls-local) 1.23 href (yahtml-escape-chars-string 1.24 - (read-from-minibuffer "href: " "" yahtml-url-completion-map))) 1.25 + (read-from-minibuffer-with-history 1.26 + "href: " "" yahtml-url-completion-map))) 1.27 (prog1 1.28 (concat (yahtml-make-optional-argument 1.29 "href" href) 1.30 (yahtml-make-optional-argument 1.31 - "name" (read-string "name: "))) 1.32 + "name" (read-string-with-history "name: "))) 1.33 (if (and (string-match "^http://" href) 1.34 (null (assoc href yahtml-urls-private)) 1.35 (null (assoc href yahtml-urls-local))) 1.36 @@ -1179,13 +1180,14 @@ 1.37 ((eq alist 'command) 1.38 (if (fboundp 'read-shell-command) 1.39 (read-shell-command prompt) 1.40 - (read-string prompt))) 1.41 + (read-string-with-history prompt))) 1.42 ((and alist (symbolp alist)) 1.43 - (completing-read prompt (symbol-value alist) nil nil default)) 1.44 + (completing-read-with-history 1.45 + prompt (symbol-value alist) nil nil default)) 1.46 (alist 1.47 - (completing-read prompt alist nil nil default)) 1.48 + (completing-read-with-history prompt alist nil nil default)) 1.49 (t 1.50 - (read-string prompt default))))) 1.51 + (read-string-with-history prompt default))))) 1.52 1.53 (defun yahtml-make-optional-argument (opt arg) 1.54 "Make optional argument string." 1.55 @@ -1211,11 +1213,11 @@ 1.56 (cond 1.57 (yahtml-html4-strict nil) 1.58 (t 1.59 - (let ((b (read-string "bgcolor=")) 1.60 + (let ((b (read-string-with-history "bgcolor=")) 1.61 (bg (yahtml-read-parameter "background" "")) 1.62 - (x (read-string "text color=")) 1.63 - (l (read-string "link color=")) 1.64 - (v (read-string "vlink color="))) 1.65 + (x (read-string-with-history "text color=")) 1.66 + (l (read-string-with-history "link color=")) 1.67 + (v (read-string-with-history "vlink color="))) 1.68 (concat 1.69 (yahtml-make-optional-argument "bgcolor" b) 1.70 (yahtml-make-optional-argument "background" bg) 1.71 @@ -1236,7 +1238,7 @@ 1.72 (let ((src (yahtml-read-parameter "src")) 1.73 (alg (yahtml-read-parameter "align")) 1.74 alt 1.75 - (brd (read-string "border=")) 1.76 + (brd (read-string-with-history "border=")) 1.77 (l yahtml-prefer-upcase-attributes) 1.78 info width height bytes comments) 1.79 (and (stringp src) (string< "" src) (file-exists-p src) 1.80 @@ -1394,21 +1396,21 @@ 1.81 "Add-in function `form' input format" 1.82 (concat 1.83 " " (if yahtml-prefer-upcase-attributes "METHOD" "method") "=\"" 1.84 - (completing-read "Method: " '(("POST") ("GET")) nil t) 1.85 + (completing-read-with-history "Method: " '(("POST") ("GET")) nil t) 1.86 "\"" 1.87 (yahtml-make-optional-argument 1.88 (if yahtml-prefer-upcase-attributes "ENCTYPE" "enctype") 1.89 - (completing-read 1.90 + (completing-read-with-history 1.91 "Enctype: " 1.92 '(("application/x-www-form-urlencoded") ("multipart/form-data")))) 1.93 " " (if yahtml-prefer-upcase-attributes "ACTION" "action") "=\"" 1.94 - (read-string "Action: ") "\"")) 1.95 + (read-string-with-history "Action: ") "\"")) 1.96 1.97 (defun yahtml:select () 1.98 "Add-in function for `select' input format" 1.99 (setq yahtml-last-single-cmd "option") 1.100 (concat " " (if yahtml-prefer-upcase-attributes "NAME" "name") "=\"" 1.101 - (read-string "name: ") "\"")) 1.102 + (read-string-with-history "name: ") "\"")) 1.103 1.104 (defun yahtml:ol () 1.105 "Add-in function for <ol>" 1.106 @@ -1439,7 +1441,7 @@ 1.107 "Add-in function for `input' form" 1.108 (let ((size "") name type value checked (maxlength "") 1.109 (l yahtml-prefer-upcase-attributes)) 1.110 - (setq name (read-string "name: ") 1.111 + (setq name (read-string-with-history "name: ") 1.112 type (YaTeX-completing-read-or-skip "type (default=text): " 1.113 yahtml-input-types nil t) 1.114 value (YaTeX-read-string-or-skip "value: ")) 1.115 @@ -1457,9 +1459,9 @@ 1.116 "Add-in function for `textarea'" 1.117 (interactive) 1.118 (let (name rows cols) 1.119 - (setq name (read-string "Name: ") 1.120 - cols (read-string "Columns: ") 1.121 - rows (read-string "Rows: ")) 1.122 + (setq name (read-string-with-history "Name: ") 1.123 + cols (read-string-with-history "Columns: ") 1.124 + rows (read-string-with-history "Rows: ")) 1.125 (concat 1.126 (concat (if yahtml-prefer-upcase-attributes "NAME=" "name=") 1.127 "\"" name "\"") 1.128 @@ -1468,7 +1470,7 @@ 1.129 1.130 (defun yahtml:table () 1.131 "Add-in function for `table'" 1.132 - (let ((b (read-string "border=")) 1.133 + (let ((b (read-string-with-history "border=")) 1.134 (a (yahtml-read-parameter 1.135 "align" nil '(("align" ("right")("center")))))) 1.136 (if yahtml-html4-strict 1.137 @@ -1506,13 +1508,13 @@ 1.138 (defun yahtml:font () 1.139 "Add-in function for `font'" 1.140 (concat 1.141 - (yahtml-make-optional-argument "color" (read-string "color=")) 1.142 - (yahtml-make-optional-argument "size" (read-string "size=")))) 1.143 + (yahtml-make-optional-argument "color" (read-string-with-history "color=")) 1.144 + (yahtml-make-optional-argument "size" (read-string-with-history "size=")))) 1.145 1.146 (defun yahtml:style () 1.147 "Add-in function for `style'" 1.148 (yahtml-make-optional-argument 1.149 - "type" (read-string "type=" "text/css"))) 1.150 + "type" (read-string-with-history "type=" "text/css"))) 1.151 1.152 (defun yahtml:script () 1.153 "Add-in function for `script'" 1.154 @@ -1547,7 +1549,8 @@ 1.155 "type" (yahtml-read-parameter "type" "text/css")) 1.156 (progn 1.157 (setq href 1.158 - (read-from-minibuffer "href: " "" yahtml-url-completion-map)) 1.159 + (read-from-minibuffer-with-history 1.160 + "href: " "" yahtml-url-completion-map)) 1.161 (if (string< "" href) 1.162 (progn 1.163 (if (and (file-exists-p (yahtml-url-to-path href)) 1.164 @@ -1564,7 +1567,8 @@ 1.165 "type" (yahtml-read-parameter "type" "text/css")) 1.166 (yahtml-make-optional-argument 1.167 "href" 1.168 - (read-from-minibuffer "href: " "" yahtml-url-completion-map))))))) 1.169 + (read-from-minibuffer-with-history 1.170 + "href: " "" yahtml-url-completion-map))))))) 1.171 1.172 (defvar yahtml:meta-names 1.173 '(("name" ("keywords")("author")("copyright")("date")("GENERATOR")))) 1.174 @@ -1591,18 +1595,19 @@ 1.175 "content" 1.176 (cond 1.177 ((string-match "date" name) 1.178 - (read-string "Date: " (current-time-string))) 1.179 + (read-string-with-history "Date: " (current-time-string))) 1.180 ((string-match "author" name) 1.181 - (read-string "Author: " 1.182 + (read-string-with-history "Author: " 1.183 (if (and (user-full-name) (string< "" (user-full-name))) 1.184 (user-full-name) 1.185 (user-login-name)))) 1.186 ((string-match "GENERATOR" name) 1.187 - (setq content (read-string "Generator: " "User-agent: ")) 1.188 + (setq content (read-string-with-history 1.189 + "Generator: " "User-agent: ")) 1.190 (if (string-match "yahtml" content) 1.191 (message "Thank you!")) 1.192 content) 1.193 - (t (read-string (concat name ": "))))))))) 1.194 + (t (read-string-with-history (concat name ": "))))))))) 1.195 1.196 (defun yahtml:br () 1.197 (yahtml-make-optional-argument "clear" (yahtml-read-parameter "clear"))) 1.198 @@ -2376,7 +2381,8 @@ 1.199 (let ((e (cond 1.200 ((null e) "td") 1.201 ((stringp e) e) 1.202 - (t (read-string "Enclose with(`thd' means th td td..): " "th")))) 1.203 + (t (read-string-with-history 1.204 + "Enclose with(`thd' means th td td..): " "th")))) 1.205 (ws "[ \t]") 1.206 elm p i) 1.207 (if (string= delim "") (setq delim " \t\n")) 1.208 @@ -2408,8 +2414,8 @@ 1.209 "Enclose lines in a form tab-sv/csv with <tr><td>..</td></tr>." 1.210 (interactive "P\nsDelimiter(s): \nr") 1.211 (setq e (if (and e (listp e)) 1.212 - (read-string "Enclose with(td or th, `thd' -> th td td td...: " 1.213 - "th"))) 1.214 + (read-string-with-history 1.215 + "Enclose with(td or th, `thd' -> th td td td...: " "th"))) 1.216 (save-excursion 1.217 (save-restriction 1.218 (narrow-to-region (point) (mark)) 1.219 @@ -2866,7 +2872,7 @@ 1.220 (YaTeX-reindent c)))) 1.221 1.222 (defun yahtml-intelligent-newline-head () 1.223 - (let ((title (read-string "Document title: ")) 1.224 + (let ((title (read-string-with-history "Document title: ")) 1.225 (b "<title>") (e "</title>") p) 1.226 (yahtml-indent-line) 1.227 (insert (format "%s" (if yahtml-prefer-upcases (upcase b) b))) 1.228 @@ -2927,7 +2933,8 @@ 1.229 (setq line (concat line (if (and (= i 0) th) "<th></th>" 1.230 "<td></td>")) 1.231 th nil i (1+ i))) 1.232 - (setq fmt (read-string "`th' or `td' format: " "th td td")) 1.233 + (setq fmt (read-string-with-history 1.234 + "`th' or `td' format: " "th td td")) 1.235 (while (string-match "t\\(h\\)\\|td" fmt i) 1.236 (setq line (concat line (if (match-beginning 1) "<th></th>" 1.237 "<td></td>"))