yatex

diff yahtml.el @ 60:9e08ed569d80

yahtml: change keystroke of calling browser to [prefix] t p yahtml: don't count <a>tag contents as column in <pre> yahtml: support [prefix] c against src="", align="". and many many more
author yuuji
date Fri, 24 Jan 1997 09:04:06 +0000
parents 48ac97a6b6ce
children b9f753846b6b
line diff
     1.1 --- a/yahtml.el	Wed May 01 15:35:40 1996 +0000
     1.2 +++ b/yahtml.el	Fri Jan 24 09:04:06 1997 +0000
     1.3 @@ -1,7 +1,6 @@
     1.4  ;;; -*- Emacs-Lisp -*-
     1.5 -;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@asciinet.or.jp]
     1.6 -;;; Last modified Tue Apr 23 23:13:12 1996 on inspire
     1.7 -;;; This package is no longer tentative.
     1.8 +;;; (c ) 1994-1997 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
     1.9 +;;; Last modified Fri Jan 24 18:03:01 1997 on supra
    1.10  ;;; $Id$
    1.11  
    1.12  ;;;[Installation]
    1.13 @@ -35,6 +34,8 @@
    1.14  ;;;			`<input name="var" ...>'
    1.15  ;;;  * [prefix] l	Complete typeface-changing commands such as
    1.16  ;;;			`<i> ... </i>' or `<samp> ... </samp>'
    1.17 +;;; 			This completion can be used to make in-line
    1.18 +;;; 			tags which is normally completed with [prefix] b.
    1.19  ;;;  * [prefix] m	Complete single commands such as
    1.20  ;;;			`<br>' or `<hr> or <li>...'
    1.21  ;;;  * M-RET		Intelligent newline; if current TAG is one of
    1.22 @@ -50,7 +51,8 @@
    1.23  ;;;  * [prefix] c	Change html tags on the point.
    1.24  ;;;			When typeing [prefix] c on `href="xxx"', you can 
    1.25  ;;;			change the reference link with completion.
    1.26 -;;;  * [prefix] t b	View current html with WWW browser
    1.27 +;;;  * [prefix] t j	Call weblint on current file.
    1.28 +;;;  * [prefix] t p	View current html with WWW browser
    1.29  ;;; 			(To activate this, never fail to set the lisp
    1.30  ;;; 			 variable yahtml-www-browser.  Recommended value
    1.31  ;;; 			 is "netscape")
    1.32 @@ -60,8 +62,7 @@
    1.33  
    1.34  
    1.35  (require 'yatex)
    1.36 -(defvar yahtml-prefix-map nil)
    1.37 -(defvar yahtml-mode-map nil "Keymap used in yahtml-mode.")
    1.38 +;;; --- customizable variable starts here ---
    1.39  (defvar yahtml-image-viewer "xv" "*Image viewer program")
    1.40  (defvar yahtml-www-browser "netscape"
    1.41    "*WWW Browser command")
    1.42 @@ -77,18 +78,36 @@
    1.43    "*Directory index file name;
    1.44  Consult your site's WWW administrator.")
    1.45  
    1.46 +(defvar yahtml-environment-indent YaTeX-environment-indent
    1.47 +  "*Indentation depth of HTML's listing environment")
    1.48 +
    1.49 +(defvar yahtml-lint-program (if YaTeX-japan "jweblint" "weblint")
    1.50 +  "*Program name to lint HTML file")
    1.51 +(defvar yahtml-hate-too-deep-indentation nil
    1.52 +  "*Non-nil for this variable suppress deep indentation in listing environments.")
    1.53 +
    1.54 +;;; --- customizable variable ends here ---
    1.55 +
    1.56 +(defvar yahtml-prefix-map nil)
    1.57 +(defvar yahtml-mode-map nil "Keymap used in yahtml-mode.")
    1.58 +(defvar yahtml-lint-buffer-map nil "Keymap used in lint buffer.")
    1.59 +(defvar yahtml-shell-command-option
    1.60 +  (or (and (boundp 'shell-command-option) shell-command-option)
    1.61 +      (if (eq system-type 'ms-dos) "/c" "-c")))
    1.62 +
    1.63 +
    1.64  (defun yahtml-define-begend-key-normal (key env &optional map)
    1.65 -  "Define short cut yahtml-insert-begin-end key."
    1.66 +  "Define short cut yahtml-insert-begend key."
    1.67    (YaTeX-define-key
    1.68     key
    1.69     (list 'lambda '(arg) '(interactive "P")
    1.70 -	 (list 'yahtml-insert-begin-end env 'arg))
    1.71 +	 (list 'yahtml-insert-begend 'arg env))
    1.72     map))
    1.73  
    1.74  (defun yahtml-define-begend-region-key (key env &optional map)
    1.75 -  "Define short cut yahtml-insert-begin-end-region key."
    1.76 +  "Define short cut yahtml-insert-begend-region key."
    1.77    (YaTeX-define-key key (list 'lambda nil '(interactive)
    1.78 -			      (list 'yahtml-insert-begin-end env t)) map))
    1.79 +			      (list 'yahtml-insert-begend t env)) map))
    1.80  
    1.81  (defun yahtml-define-begend-key (key env &optional map)
    1.82    "Define short cut key for begin type completion both for
    1.83 @@ -128,20 +147,22 @@
    1.84      (YaTeX-define-key "s" 'yahtml-insert-form map)
    1.85      (YaTeX-define-key "l" 'yahtml-insert-tag map)
    1.86      (YaTeX-define-key "m" 'yahtml-insert-single map)
    1.87 -    (YaTeX-define-key "n" '(lambda () (interactive) (insert "<br>\n")) map)
    1.88 +    (YaTeX-define-key "n" '(lambda () (interactive) (if yahtml-prefer-upcases (insert "<BR>")(insert "<br>"))) map)
    1.89      (if YaTeX-no-begend-shortcut
    1.90  	(progn
    1.91  	  (YaTeX-define-key "B" 'yahtml-insert-begend-region map)
    1.92  	  (YaTeX-define-key "b" 'yahtml-insert-begend map))
    1.93 -      (yahtml-define-begend-key "bh" "HTML" map)
    1.94 -      (yahtml-define-begend-key "bH" "HEAD" map)
    1.95 -      (yahtml-define-begend-key "bt" "TITLE" map)
    1.96 +      (yahtml-define-begend-key "bh" "html" map)
    1.97 +      (yahtml-define-begend-key "bH" "head" map)
    1.98 +      (yahtml-define-begend-key "bt" "title" map)
    1.99        (yahtml-define-begend-key "bT" "table" map)
   1.100 -      (yahtml-define-begend-key "bb" "BODY" map)
   1.101 -      (yahtml-define-begend-key "bd" "DL" map)
   1.102 -      (yahtml-define-begend-key "b1" "H1" map)
   1.103 -      (yahtml-define-begend-key "b2" "H2" map)
   1.104 -      (yahtml-define-begend-key "b3" "H3" map)
   1.105 +      (yahtml-define-begend-key "bb" "body" map)
   1.106 +      (yahtml-define-begend-key "bc" "center" map)
   1.107 +      (yahtml-define-begend-key "bd" "dl" map)
   1.108 +      (yahtml-define-begend-key "bu" "ul" map)
   1.109 +      (yahtml-define-begend-key "b1" "h1" map)
   1.110 +      (yahtml-define-begend-key "b2" "h2" map)
   1.111 +      (yahtml-define-begend-key "b3" "h3" map)
   1.112        (yahtml-define-begend-key "ba" "a" map)
   1.113        (yahtml-define-begend-key "bf" "form" map)
   1.114        (yahtml-define-begend-key "bs" "select" map)
   1.115 @@ -156,17 +177,22 @@
   1.116      (YaTeX-define-key "c" 'yahtml-change-* map)
   1.117      (YaTeX-define-key "t" 'yahtml-browse-menu map)
   1.118      (YaTeX-define-key "a" 'yahtml-complete-mark map)
   1.119 +    (YaTeX-define-key "'" 'yahtml-prev-error map)
   1.120      ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map)
   1.121 -    )
   1.122 -)
   1.123 +    ))
   1.124 +
   1.125 +(if yahtml-lint-buffer-map nil
   1.126 +  (setq yahtml-lint-buffer-map (make-keymap))
   1.127 +  (define-key yahtml-lint-buffer-map " " 'yahtml-jump-to-error-line))
   1.128 +
   1.129  
   1.130  (defvar yahtml-paragraph-start
   1.131    (concat
   1.132 -   "^$\\|<[bh]r>\\|<p>\\|^[ \t]*</?\\(h[1-6]\\|p\\|d[ldt]\\|t[rdh]\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\)>")
   1.133 +   "^$\\|<!--\\|^[ \t]*</?\\(h[1-6]\\|p\\|d[ldt]\\|[bhtd][rdh]\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\|table\\|center\\)\\b")
   1.134    "*Regexp of html paragraph separater")
   1.135  (defvar yahtml-paragraph-separate
   1.136    (concat
   1.137 -   "^$\\|<[bh]r>\\|<p>\\|^[ \t]*</?\\(h[1-6]\\|p\\|d[ldt]\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\)>")
   1.138 +   "^$\\|<!--\\|^[ \t]*</?\\(h[1-6]\\|p\\|[bhtd][ldt]\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\|table\\|center\\|!--\\)\\b")
   1.139    "*Regexp of html paragraph separater")
   1.140  (defvar yahtml-syntax-table nil
   1.141    "*Syntax table for typesetting buffer")
   1.142 @@ -188,14 +214,14 @@
   1.143  (defvar yahtml-tmp-form-table nil)
   1.144  
   1.145  (defvar yahtml-env-table
   1.146 -  '(("html") ("head") ("title") ("body") ("dl") ("a") ("form") ("select")
   1.147 -    ("textarea")
   1.148 +  '(("html") ("head") ("title") ("body") ("dl") ("ul") ("ol") ("pre")
   1.149 +    ("a") ("form") ("select") ("center") ("textarea") ("blockquote")
   1.150      ("OrderedList" . "ol")
   1.151      ("UnorderedList" . "ul")
   1.152      ("DefinitionList" . "dl")
   1.153      ("Preformatted" . "pre")
   1.154      ("table") ("tr") ("th") ("td")
   1.155 -    ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") ("ul")))
   1.156 +    ("h1") ("h2") ("h3") ("h4") ("h5") ("h6")))
   1.157  
   1.158  (defvar yahtml-itemizing-regexp
   1.159    "\\(ul\\|ul\\|dl\\)"
   1.160 @@ -206,8 +232,10 @@
   1.161  
   1.162  ;;; Completion tables for typeface designator
   1.163  (defvar yahtml-typeface-table
   1.164 -  '(("defn") ("em") ("cite") ("code") ("kbd") ("samp")
   1.165 -    ("strong") ("var") ("b") ("i") ("tt") ("u") ("address"))
   1.166 +  (append
   1.167 +   '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp")
   1.168 +     ("strong") ("var") ("b") ("i") ("tt") ("u") ("address"))
   1.169 +   yahtml-env-table)
   1.170    "Default completion table of typeface designator")
   1.171  (defvar yahtml-user-typeface-table nil)
   1.172  (defvar yahtml-tmp-typeface-table nil)
   1.173 @@ -229,20 +257,9 @@
   1.174  (defvar yahtml-last-single-cmd nil)
   1.175  
   1.176  (defvar yahtml-prefer-upcases nil)
   1.177 -(cond
   1.178 - (yahtml-prefer-upcases
   1.179 -  (setq yahtml-form-table
   1.180 -	(mapcar (function (lambda (list) (list (upcase (car list)))))
   1.181 -		yahtml-form-table))
   1.182 -  (setq yahtml-env-table
   1.183 -	(mapcar (function (lambda (list) (list (upcase (car list)))))
   1.184 -		yahtml-env-table))
   1.185 -  (setq yahtml-typeface-table
   1.186 -	(mapcar (function (lambda (list) (list (upcase (car list)))))
   1.187 -		yahtml-typeface-table))))
   1.188  
   1.189  (defvar yahtml-struct-name-regexp
   1.190 -  "\\<\\(h[1-6]\\|[uod]l\\|body\\|title\\|head\\|table\\|t[rhd]\\|pre\\|a\\|form\\|select\\)\\b")
   1.191 +  "\\<\\(h[1-6]\\|[uod]l\\|html\\|body\\|title\\|head\\|table\\|t[rhd]\\|pre\\|a\\|form\\|select\\)\\b")
   1.192  
   1.193  
   1.194  (defun yahtml-mode ()
   1.195 @@ -257,9 +274,10 @@
   1.196      (setq kanji-fileio-code yahtml-kanji-code)))
   1.197    (setq major-mode 'yahtml-mode
   1.198  	mode-name "yahtml")
   1.199 +  (make-local-variable 'YaTeX-kanji-code)
   1.200    (make-local-variable 'YaTeX-ec) (setq YaTeX-ec "")
   1.201    (make-local-variable 'YaTeX-struct-begin)
   1.202 -  (setq YaTeX-struct-begin "<%1%2>")
   1.203 +  (setq YaTeX-struct-begin "<%1%2")
   1.204    (make-local-variable 'YaTeX-struct-end) (setq YaTeX-struct-end "</%1>")
   1.205    (make-local-variable 'YaTeX-struct-name-regexp)
   1.206    (setq YaTeX-struct-name-regexp yahtml-struct-name-regexp)
   1.207 @@ -282,6 +300,8 @@
   1.208    (setq indent-line-function 'yahtml-indent-line)
   1.209    (make-local-variable 'YaTeX-item-regexp)
   1.210    (setq YaTeX-item-regexp "<\\(li\\|d[td]\\)>")
   1.211 +  (make-local-variable 'YaTeX-typesetting-mode-map)
   1.212 +  (setq YaTeX-typesetting-mode-map yahtml-lint-buffer-map)
   1.213    (set-syntax-table yahtml-syntax-table)
   1.214    (use-local-map yahtml-mode-map)
   1.215    (run-hooks 'yahtml-mode-hook))
   1.216 @@ -324,8 +344,8 @@
   1.217     (nreverse
   1.218      '((em	"Embolden" .
   1.219  	  (lambda () (interactive) (yahtml-insert-tag nil "EM")))
   1.220 -      (defn	"Define a word" .
   1.221 -	(lambda () (interactive) (yahtml-insert-tag nil "DEFN")))
   1.222 +      (dfn	"Define a word" .
   1.223 +	(lambda () (interactive) (yahtml-insert-tag nil "DFN")))
   1.224        (cite	"Citation" .
   1.225  	(lambda () (interactive) (yahtml-insert-tag nil "CITE")))
   1.226        (code	"Code" .
   1.227 @@ -434,6 +454,7 @@
   1.228  	  (or (cdr (assoc yahtml-last-begend yahtml-env-table))
   1.229  	      yahtml-last-begend))
   1.230      (setq cmd yahtml-last-begend)
   1.231 +    (if yahtml-prefer-upcases (setq cmd (upcase cmd)))
   1.232      (if region
   1.233  	(let ((beg (region-beginning))
   1.234  	      (end (region-end))
   1.235 @@ -444,12 +465,10 @@
   1.236  	  (insert (format "<%s%s>%s" cmd addin (if bolp "\n" ""))))
   1.237        (insert (format "<%s%s>" cmd (yahtml-addin cmd)))
   1.238        (save-excursion
   1.239 -	(if bolp (progn
   1.240 -		   (insert "\n")
   1.241 -		   (indent-to-column cc)
   1.242 -		   (insert (format "</%s>" cmd)))
   1.243 -	  (insert (format "</%s>" cmd))))
   1.244 -      (if bolp (yahtml-intelligent-newline nil)))))
   1.245 +	(insert "\n")
   1.246 +	(indent-to-column cc)
   1.247 +	(insert (format "</%s>" cmd)))
   1.248 +      (yahtml-intelligent-newline nil))))
   1.249  
   1.250  (defun yahtml-insert-begend-region ()
   1.251    "Call yahtml-insert-begend in the region mode."
   1.252 @@ -461,12 +480,14 @@
   1.253    "Insert <FORM option=\"argument\">."
   1.254     (interactive)
   1.255     (or form
   1.256 -       (setq form
   1.257 -	     (YaTeX-cplread-with-learning
   1.258 -	      "Form: "
   1.259 -	       'yahtml-form-table 'yahtml-user-form-table
   1.260 -	       'yahtml-tmp-form-table)))
   1.261 +       (let ((completion-ignore-case t))
   1.262 +	 (setq form
   1.263 +	       (YaTeX-cplread-with-learning
   1.264 +		"Form: "
   1.265 +		'yahtml-form-table 'yahtml-user-form-table
   1.266 +		'yahtml-tmp-form-table))))
   1.267     (let ((p (point)) q)
   1.268 +     (if yahtml-prefer-upcases (setq form (upcase form)))
   1.269       (insert (format "<%s%s>" form (yahtml-addin form)))
   1.270       ;;(indent-relative-maybe)
   1.271       (if (cdr (assoc form yahtml-form-table))
   1.272 @@ -488,15 +509,20 @@
   1.273  (defun yahtml-collect-labels (&optional file)
   1.274    "Collect current buffers label (<a name=...>).
   1.275  If optional argument FILE is specified collect labels in FILE."
   1.276 -  (let (list)
   1.277 +  (let (list bound)
   1.278      (save-excursion
   1.279        (set-buffer yahtml-completing-buffer)
   1.280 -      (if file (set-buffer (find-file-noselect file)))
   1.281 +      (if file (let (hilit-auto-highlight)
   1.282 +		 (set-buffer (find-file-noselect file))))
   1.283        (save-excursion
   1.284  	(goto-char (point-min))
   1.285  	(while (re-search-forward "<a\\b" nil t)
   1.286 -	  (skip-chars-forward " \t\n")
   1.287 -	  (if (looking-at "name\\s *=\\s *\"?#?\\([^\">]+\\)\"?>")
   1.288 +	  (setq bound (match-end 0))
   1.289 +	  (search-forward ">" nil t)
   1.290 +	  (if (and (re-search-backward "\\(name\\|id\\)=" bound t)
   1.291 +		   (goto-char (match-end 0))
   1.292 +		   (skip-chars-forward " \t\n")
   1.293 +		   (looking-at "\"?#?\\([^\">]+\\)\"?\\b"))
   1.294  	      (setq list (cons
   1.295  			  (list (concat "#" (YaTeX-match-string 1)))
   1.296  			  list))))
   1.297 @@ -568,41 +594,67 @@
   1.298    
   1.299  (defun yahtml:a ()
   1.300    "Add-in function for <a>"
   1.301 -  (or yahtml-urls (yahtml-collect-url-history))
   1.302 -  (setq yahtml-completing-buffer (current-buffer))
   1.303 -;  (concat "href=\""
   1.304 -;	  (completing-read "href: " yahtml-urls)
   1.305 -;	  "\"")
   1.306 -  (message "(H)ref  (N)ame?")
   1.307 -  (cond
   1.308 -   ((string-match "[nN]" (char-to-string (read-char)))
   1.309 -    (concat "name=\"" (read-string "name: ") "\""))
   1.310 -   (t
   1.311 -    (concat "href=\""
   1.312 -	    (read-from-minibuffer "href: " "" yahtml-url-completion-map)
   1.313 -	    "\""))))
   1.314 +  (let ((l yahtml-prefer-upcases))
   1.315 +    (or yahtml-urls (yahtml-collect-url-history))
   1.316 +    (setq yahtml-completing-buffer (current-buffer))
   1.317 +;   (concat "href=\""
   1.318 +;	   (completing-read "href: " yahtml-urls)
   1.319 +;	   "\"")
   1.320 +    (message "(H)ref  (N)ame?")
   1.321 +    (cond
   1.322 +     ((string-match "[nN]" (char-to-string (read-char)))
   1.323 +      (concat (if l "NAME" "name") "=\"" (read-string "name: ") "\""))
   1.324 +     (t
   1.325 +      (concat (if l "HREF" "href") "=\""
   1.326 +	      (read-from-minibuffer "href: " "" yahtml-url-completion-map)
   1.327 +	      "\"")))))
   1.328  
   1.329 +(defvar yahtml-parameters-completion-alist
   1.330 +  '(("align" ("top") ("middle") ("bottom"))
   1.331 +    ("src" . file)
   1.332 +    ("method" ("POST") ("GET"))))
   1.333 +
   1.334 +(defun yahtml-read-parameter (par)
   1.335 +  (let* ((alist (cdr-safe (assoc (downcase par)
   1.336 +				yahtml-parameters-completion-alist)))
   1.337 +	 (prompt (concat par ": "))
   1.338 +	 v)
   1.339 +    (cond
   1.340 +     ((eq alist 'file)
   1.341 +      (read-file-name prompt "" nil nil ""))
   1.342 +     (alist
   1.343 +      (completing-read prompt alist))
   1.344 +     (t 
   1.345 +      (read-string prompt)))))
   1.346 +      
   1.347 +  
   1.348  (defun yahtml:img ()
   1.349    "Add-in function for <img>"
   1.350    (or yahtml-urls (yahtml-collect-url-history))
   1.351 -  (let ((src (read-file-name "src: " "" nil nil ""))
   1.352 -	(alg (completing-read "align: " '(("top") ("middle") ("bottom"))))
   1.353 -	(alt (read-string "alt: ")))
   1.354 -    (concat "src=\"" src "\""
   1.355 -	    (if (string< "" alg) (concat " align=\"" alg "\""))
   1.356 -	    (if (string< "" alt) (concat " alt=\"" alt "\"")))))
   1.357 +  (let ((src (yahtml-read-parameter "src"))
   1.358 +	(alg (yahtml-read-parameter "align"))
   1.359 +	(alt (yahtml-read-parameter "alt"))
   1.360 +	(l yahtml-prefer-upcases))
   1.361 +    (concat (if l "SRC" "src") "=\"" src "\""
   1.362 +	    (if (string< "" alg)
   1.363 +		(concat " " (if l "ALIGN" "align") "=\"" alg "\""))
   1.364 +	    (if (string< "" alt)
   1.365 +		(concat " " (if l "ALT" "alt") "=\"" alt "\"")))))
   1.366  
   1.367  (defun yahtml:form ()
   1.368    "Add-in function `form' input format"
   1.369    (concat
   1.370 -   " method=" (completing-read "Method: " '(("POST") ("GET")) nil t)
   1.371 -   " action=\"" (read-string "Action: ") "\""
   1.372 +   " " (if yahtml-prefer-upcases "METHOD" "method=")
   1.373 +   (completing-read "Method: " '(("POST") ("GET")) nil t)
   1.374 +   " " (if yahtml-prefer-upcases "ACTION" "action") "=\""
   1.375 +   (read-string "Action: ") "\""
   1.376     ))
   1.377  
   1.378  (defun yahtml:select ()
   1.379    "Add-in function for `select' input format"
   1.380    (setq yahtml-last-single-cmd "option")
   1.381 -  (concat " name=\"" (read-string "name: ") "\""))
   1.382 +  (concat " " (if yahtml-prefer-upcases "NAME" "name") "=\""
   1.383 +	  (read-string "name: ") "\""))
   1.384  
   1.385  (defun yahtml:ol ()
   1.386    (setq yahtml-last-single-cmd "li") "")
   1.387 @@ -616,11 +668,12 @@
   1.388  
   1.389  (defvar yahtml-input-types
   1.390    '(("text") ("password") ("checkbox") ("radio") ("submit")
   1.391 -    ("reset") ("image") ("hidden")))
   1.392 +    ("reset") ("image") ("hidden") ("file")))
   1.393  
   1.394  (defun yahtml:input ()
   1.395    "Add-in function for `input' form"
   1.396 -  (let (name type value checked (size "") (maxlength ""))
   1.397 +  (let ((size "") name type value checked (maxlength "")
   1.398 +	(l yahtml-prefer-upcases))
   1.399      (setq name (read-string "name: ")
   1.400  	  type (completing-read "type (default=text): "
   1.401  				yahtml-input-types nil t)
   1.402 @@ -629,11 +682,15 @@
   1.403  	(setq size (read-string "size: ")
   1.404  	      maxlength (read-string "maxlength: ")))
   1.405      (concat
   1.406 -     "name=\"" name "\""
   1.407 -     (if (string< "" type) (concat " type=\"" type "\""))
   1.408 -     (if (string< "" value) (concat " value=\"" value "\""))
   1.409 -     (if (string< "" size) (concat " size=\"" size "\""))
   1.410 -     (if (string< "" maxlength) (concat " maxlength=\"" maxlength "\""))
   1.411 +     (if l "NAME" "name") "=\"" name "\""
   1.412 +     (if (string< "" type)
   1.413 +	 (concat " " (if l "TYPE" "type") "=\"" type "\""))
   1.414 +     (if (string< "" value)
   1.415 +	 (concat " " (if l "VALUE" "value") "=\"" value "\""))
   1.416 +     (if (string< "" size)
   1.417 +	 (concat " " (if l "SIZE" "size") "=\"" size "\""))
   1.418 +     (if (string< "" maxlength)
   1.419 +	 (concat " " (if l "MAXLENGTH" "maxlength") "=\"" maxlength "\""))
   1.420      )))
   1.421  
   1.422  (defun yahtml:textarea ()
   1.423 @@ -641,8 +698,8 @@
   1.424    (interactive)
   1.425    (let (name rows cols)
   1.426      (setq name (read-string "Name: ")
   1.427 -	  cols (read-string "Columns: "
   1.428 -	  rows (read-string "Rows: ")))
   1.429 +	  cols (read-string "Columns: ")
   1.430 +	  rows (read-string "Rows: "))
   1.431      (concat
   1.432       (concat (if yahtml-prefer-upcases "NAME=" "name=")
   1.433  	     "\"" name "\"")
   1.434 @@ -657,24 +714,26 @@
   1.435    "Insert <TAG> </TAG> and put cursor inside of them."
   1.436    (interactive "P")
   1.437    (or tag
   1.438 -      (setq tag
   1.439 -	    (YaTeX-cplread-with-learning
   1.440 -	     (format "Tag %s(default %s): "
   1.441 -		     (if region-mode "region: " "") yahtml-last-typeface-cmd)
   1.442 -	     'yahtml-typeface-table 'yahtml-user-typeface-table
   1.443 -	     'yahtml-tmp-typeface-table)))
   1.444 +      (let ((completion-ignore-case t))
   1.445 +	(setq tag
   1.446 +	      (YaTeX-cplread-with-learning
   1.447 +	       (format "Tag %s(default %s): "
   1.448 +		       (if region-mode "region: " "") yahtml-last-typeface-cmd)
   1.449 +	       'yahtml-typeface-table 'yahtml-user-typeface-table
   1.450 +	       'yahtml-tmp-typeface-table))))
   1.451    (if (string= "" tag) (setq tag yahtml-last-typeface-cmd))
   1.452 -  (setq tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag)
   1.453 -	yahtml-last-typeface-cmd tag)
   1.454 +  (setq tag (or (cdr (assoc tag yahtml-typeface-table)) tag))
   1.455 +  (setq yahtml-last-typeface-cmd tag
   1.456 +	tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag))
   1.457    (if region-mode
   1.458        (if (if (string< "19" emacs-version) (mark t) (mark))
   1.459  	  (save-excursion
   1.460  	    (if (> (point) (mark)) (exchange-point-and-mark))
   1.461 -	    (insert "<" tag ">")
   1.462 +	    (insert (format "<%s%s>" tag (yahtml-addin tag)))
   1.463  	    (exchange-point-and-mark)
   1.464  	    (insert "</" tag ">"))
   1.465  	(message "No mark set now"))
   1.466 -    (insert (format "<%s> " tag))
   1.467 +    (insert (format "<%s%s>" tag (yahtml-addin tag)))
   1.468      (save-excursion (insert (format "</%s>" tag)))))
   1.469  
   1.470  (defun yahtml-insert-single (cmd)
   1.471 @@ -688,22 +747,30 @@
   1.472  		   (concat "(default " yahtml-last-single-cmd ")") ""))
   1.473         'yahtml-single-cmd-table 'yahtml-user-single-cmd-table
   1.474         'yahtml-tmp-single-cmd-table))))
   1.475 -  (if (string< "" cmd) (setq yahtml-last-single-cmd cmd))
   1.476 -  (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd))
   1.477 +  (if (string= "" cmd) (setq cmd yahtml-last-single-cmd))
   1.478    (setq yahtml-last-single-cmd
   1.479 -	(or (cdr (assoc yahtml-last-single-cmd yahtml-single-cmd-table))
   1.480 -	    yahtml-last-single-cmd))
   1.481 -  (insert (format "<%s>" yahtml-last-single-cmd)))
   1.482 +	(or (cdr (assoc cmd yahtml-single-cmd-table)) cmd))
   1.483 +  (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase)
   1.484 +		     yahtml-last-single-cmd))
   1.485 +  (insert (format "<%s>" cmd)))
   1.486  
   1.487  ;;; ---------- Jump ----------
   1.488  (defun yahtml-on-href-p ()
   1.489    "Check if point is on href clause."
   1.490 -  (let ((p (point)) cmd)
   1.491 +  (let ((p (point)) e cmd (case-fold-search t))
   1.492      (save-excursion
   1.493 -      (or (bobp) (skip-chars-backward "^ \t\n"))
   1.494 -      (and (looking-at "href\\s *=\\s *\"?\\([^\"> \t\n]+\\)\"?")
   1.495 +      (and (string= (YaTeX-inner-environment t) "a")
   1.496 +	   (save-excursion
   1.497 +	     (search-forward "</a>" nil t)
   1.498 +	     (setq e (point)))
   1.499 +	   (goto-char (get 'YaTeX-inner-environment 'point))
   1.500 +	   (search-forward "href" e t)
   1.501 +	   (search-forward "=" e t)
   1.502 +	   (skip-chars-forward " \t\n")
   1.503 +	   (looking-at "\"?\\([^\"> \t\n]+\\)\"?")
   1.504  	   (< p (match-end 0))
   1.505 -	   (YaTeX-match-string 1)))))
   1.506 +	   (YaTeX-match-string 1)
   1.507 +	   ))))
   1.508  
   1.509  (defun yahtml-netscape-sentinel (proc mes)
   1.510    (cond
   1.511 @@ -717,8 +784,9 @@
   1.512  	  (progn
   1.513  	    (message "Starting netscape...")
   1.514  	    (start-process
   1.515 -	     "browser" (process-buffer proc) shell-file-name "-c"
   1.516 -	     (format "%s %s" yahtml-www-browser
   1.517 +	     "browser" (process-buffer proc)
   1.518 +	     shell-file-name yahtml-shell-command-option
   1.519 +	     (format "%s \"%s\"" yahtml-www-browser
   1.520  		     (get 'yahtml-netscape-sentinel 'url)))
   1.521  	    (message "Starting netscape...Done")))
   1.522        (set-buffer cb)))))
   1.523 @@ -729,25 +797,28 @@
   1.524    "Call WWW Browser to see HREF."
   1.525    (let ((pb "* WWW Browser *") (cb (current-buffer)))
   1.526      (cond
   1.527 -     ((string-match "[Nn]etscape" yahtml-www-browser)
   1.528 +     ((and (string-match "[Nn]etscape" yahtml-www-browser)
   1.529 +	   (not (eq system-type 'windows-nt)))
   1.530        (if (get-buffer pb)
   1.531  	  (progn (set-buffer pb) (erase-buffer) (set-buffer cb)))
   1.532        (put 'yahtml-netscape-sentinel 'url href)
   1.533        (set-process-sentinel
   1.534         (setq yahtml-browser-process
   1.535  	     (start-process
   1.536 -	      "browser" pb shell-file-name "-c"
   1.537 -	      (format "%s -remote 'openURL(%s)'" yahtml-www-browser href)))
   1.538 +	      "browser" pb shell-file-name yahtml-shell-command-option ;"-c"
   1.539 +	      (format "%s -remote \"openURL(%s)\"" yahtml-www-browser href)))
   1.540         'yahtml-netscape-sentinel))
   1.541       ((and (string= "w3" yahtml-www-browser) (fboundp 'w3-fetch))
   1.542        (w3-fetch href))
   1.543       ((stringp yahtml-www-browser)
   1.544 -      (if (eq (process-status yahtml-browser-process) 'run)
   1.545 +      (if (and yahtml-browser-process
   1.546 +	       (eq (process-status yahtml-browser-process) 'run))
   1.547  	  (message "%s is already running" yahtml-www-browser)
   1.548  	(setq yahtml-browser-process
   1.549  	      (start-process
   1.550 -	       "browser" "* WWW Browser *" shell-file-name
   1.551 -	       (format "%s %s" yahtml-www-browser href)))))
   1.552 +	       "browser" "* WWW Browser *"
   1.553 +	       shell-file-name yahtml-shell-command-option
   1.554 +	       (format "%s \"%s\"" yahtml-www-browser href)))))
   1.555       (t
   1.556        (message "Sorry, jump across http is not supported.")))))
   1.557  
   1.558 @@ -756,7 +827,7 @@
   1.559    (let ((href (yahtml-on-href-p)) file name)
   1.560      (if href
   1.561  	(cond
   1.562 -	 ((string-match "^http:" href)
   1.563 +	 ((string-match "^\\(ht\\|f\\)tp:" href)
   1.564  	  (yahtml-browse-html href))
   1.565  	 (t (setq file (substring href 0 (string-match "#" href)))
   1.566  	    (if (string-match "#" href)
   1.567 @@ -782,13 +853,13 @@
   1.568  
   1.569  (defun yahtml-on-begend-p (&optional p)
   1.570    "Check if point is on begend clause."
   1.571 -  (let ((p (point)) cmd (case-fold-search t))
   1.572 +  (let ((p (or p (point))) cmd (case-fold-search t))
   1.573      (save-excursion
   1.574 -      (if p (goto-char p))
   1.575 +      (goto-char p)
   1.576        (if (equal (char-after (point)) ?<) (forward-char 1))
   1.577        (if (and (re-search-backward "<" nil t)
   1.578  	       (looking-at
   1.579 -		(concat "<\\(/?" yahtml-command-regexp "\\)\\b"))
   1.580 +		(concat "<\\(/?" yahtml-struct-name-regexp "\\)\\b"))
   1.581  	       (condition-case nil
   1.582  		   (forward-list 1)
   1.583  		 (error nil))
   1.584 @@ -852,7 +923,8 @@
   1.585  	(progn
   1.586  	  (message "Invoking %s %s..." yahtml-image-viewer image)
   1.587  	  (start-process
   1.588 -	   "Viewer" " * Image Viewer *" shell-file-name "-c"
   1.589 +	   "Viewer" " * Image Viewer *"
   1.590 +	   shell-file-name yahtml-shell-command-option ;"-c"
   1.591  	   (concat yahtml-image-viewer " " image))
   1.592  	  (message "Invoking %s %s...Done" yahtml-image-viewer image)))))
   1.593  
   1.594 @@ -902,9 +974,25 @@
   1.595  
   1.596  
   1.597  ;;; ---------- changing ----------
   1.598 +(defun yahtml-on-assignment-p ()
   1.599 +  "Return if current point is on parameter assignment.
   1.600 +If so, return parameter name, otherwise nil.
   1.601 +This function should be able to treat white spaces in value, but not yet."
   1.602 +  (let ((p (point)))
   1.603 +    (save-excursion
   1.604 +      (put 'yahtml-on-assignment-p 'region nil)
   1.605 +      (skip-chars-backward "^ \t")
   1.606 +      (and (looking-at "\\([A-Za-z0-9]+\\)\\s *=\\s *\"?\\([^ \t\"]+\\)\"?")
   1.607 +	   (< p (match-end 0))
   1.608 +	   (>= p (1- (match-beginning 2)))
   1.609 +	   (put 'yahtml-on-assignment-p 'region
   1.610 +		(cons (match-beginning 2) (match-end 2)))
   1.611 +	   (YaTeX-match-string 1)))))
   1.612 +
   1.613  (defun yahtml-change-begend ()
   1.614    (let ((tag (yahtml-on-begend-p))
   1.615  	(completion-ignore-case t)
   1.616 +	(case-fold-search t)
   1.617  	(p (point)) (q (make-marker))
   1.618  	(default (append yahtml-env-table yahtml-typeface-table))
   1.619  	(user (append yahtml-user-env-table yahtml-user-typeface-table))
   1.620 @@ -913,20 +1001,30 @@
   1.621      (cond
   1.622       (tag
   1.623        (cond
   1.624 -       ((and (equal tag "a")
   1.625 +       ((and (string-match "^a$" tag)
   1.626  	     (save-excursion
   1.627  	       (and
   1.628 -		(re-search-backward "<a" nil t)
   1.629 +		(re-search-backward "<a\\b" nil t)
   1.630  		(goto-char (match-end 0))
   1.631  		(skip-chars-forward " \t\n")
   1.632 +		(setq b1 (point))
   1.633 +		(search-forward ">" nil t)
   1.634 +		(setq e1 (match-beginning 0))
   1.635 +		(goto-char b1)
   1.636 +		(re-search-forward "href\\s *=" e1 t)
   1.637  		(>= p (point))
   1.638 -		(looking-at "href\\s *=\\s *\"?\\([^\"> \t\n]+\\)\"?")
   1.639 +		(goto-char (match-end 0))
   1.640 +		(skip-chars-forward " \t\n")
   1.641 +		(looking-at "\"?\\([^\"> \t\n]+\\)\"?")
   1.642  		(< p (match-end 0)))))
   1.643  	(setq b1 (match-beginning 1) e1 (match-end 1)
   1.644 +	      yahtml-completing-buffer (current-buffer)
   1.645  	      href (read-from-minibuffer
   1.646  		    "Change href to: " "" yahtml-url-completion-map))
   1.647  	(if (string< "" href)
   1.648  	    (progn
   1.649 +	      ;;(setq href  ;??
   1.650 +		;;    (if yahtml-prefer-upcases (upcase href) (downcase href)))
   1.651  	      (delete-region b1 e1)
   1.652  	      (goto-char b1)
   1.653  	      (insert href))))
   1.654 @@ -945,25 +1043,64 @@
   1.655  	      (progn
   1.656  		(set-marker q (point))
   1.657  		(goto-char p)))
   1.658 -	  (setq tag (YaTeX-cplread-with-learning
   1.659 -		     (format "Change `%s' to(default %s): "
   1.660 -			     tag yahtml-last-begend)
   1.661 -		     'default 'user 'tmp))
   1.662 +	  (setq tag (let ((completion-ignore-case t))
   1.663 +		      (YaTeX-cplread-with-learning
   1.664 +		       (format "Change `%s' to(default %s): "
   1.665 +			       tag yahtml-last-begend)
   1.666 +		       'default 'user 'tmp)))
   1.667  	  (delete-region (point) (progn (skip-chars-forward "^>") (point)))
   1.668  	  (if (string= "" tag) (setq tag yahtml-last-begend))
   1.669  	  (setq yahtml-last-begend
   1.670  		(or (cdr (assoc tag yahtml-env-table)) tag)
   1.671  		tag yahtml-last-begend)
   1.672 +	  (setq tag (if yahtml-prefer-upcases (upcase tag) (downcase tag)))
   1.673  	  (insert (format "%s%s" tag (yahtml-addin tag)))
   1.674  	  (goto-char q)
   1.675  	  (delete-region (point) (progn (skip-chars-forward "^>") (point)))
   1.676 -	  (insert tag))))))))
   1.677 +	  (insert tag))))
   1.678 +      t))))
   1.679 +
   1.680 +(defun yahtml-change-command ()
   1.681 +  (let ((p (point)) (case-fold-search t) cmd par new
   1.682 +	(beg (make-marker)) (end (make-marker)))
   1.683 +    (skip-chars-backward "^<")
   1.684 +    (if (and
   1.685 +	 (looking-at yahtml-command-regexp)
   1.686 +	 (progn
   1.687 +	   (set-marker beg (match-beginning 0))
   1.688 +	   (set-marker end (match-end 0))
   1.689 +	   t)				;for further work
   1.690 +	 (progn
   1.691 +	   (forward-char -1)
   1.692 +	   (condition-case nil
   1.693 +	       (forward-list 1)
   1.694 +	     (error nil))
   1.695 +	   (< p (point))))
   1.696 +	(progn
   1.697 +	  (goto-char p)
   1.698 +	  (if (setq par (yahtml-on-assignment-p))
   1.699 +	      (progn
   1.700 +		(setq new (yahtml-read-parameter par))
   1.701 +		(set-marker beg (car (get 'yahtml-on-assignment-p 'region)))
   1.702 +		(set-marker end (cdr (get 'yahtml-on-assignment-p 'region))))
   1.703 +	    (setq new
   1.704 +		  (YaTeX-cplread-with-learning
   1.705 +		   "Change form to: "
   1.706 +		   'yahtml-form-table 'yahtml-user-form-table
   1.707 +		   'yahtml-tmp-form-table)))
   1.708 +	  (delete-region beg end)
   1.709 +	  (goto-char beg)
   1.710 +	  (insert new)
   1.711 +	  t)
   1.712 +      (goto-char p)
   1.713 +      nil)))
   1.714  
   1.715  (defun yahtml-change-* ()
   1.716    "Change current position's HTML tag (set)."
   1.717    (interactive)
   1.718    (cond
   1.719     ((yahtml-change-begend))
   1.720 +   ((yahtml-change-command))
   1.721    ))
   1.722  
   1.723  ;;; ---------- commenting ----------
   1.724 @@ -977,34 +1114,93 @@
   1.725  
   1.726  
   1.727  
   1.728 +(defun yahtml-inner-environment-but (exclude &optional quick)
   1.729 +  "Return the inner environment but matches with EXCLUDE tag."
   1.730 +  (let (e)
   1.731 +    (save-excursion
   1.732 +      (while (and (setq e (YaTeX-inner-environment quick))
   1.733 +		  (string-match exclude e))
   1.734 +	(goto-char (get 'YaTeX-inner-environment 'point))))
   1.735 +    e))
   1.736 +
   1.737  ;;; ---------- filling ----------
   1.738 +
   1.739 +(defvar yahtml-saved-move-to-column (symbol-function 'move-to-column))
   1.740 +(defun yahtml-move-to-column (col &optional force)
   1.741 +  (beginning-of-line)
   1.742 +  (let ((ccol 0))
   1.743 +  (while (and (> col ccol) (not (eolp)))
   1.744 +    (if (eq (following-char) ?\<)
   1.745 +	(progn
   1.746 +	  (while (and (not (eq (following-char) ?\>))
   1.747 +		      (not (eolp)))
   1.748 +		   (forward-char))
   1.749 +	  (or (eolp) (forward-char)))
   1.750 +      (or (eolp) (forward-char))
   1.751 +      (if (eq (preceding-char) ?\t)
   1.752 +	  (let ((wd (- 8 (% (+ ccol 8) 8))))
   1.753 +	    (if (and force (< col (+ ccol wd)))
   1.754 +		(progn
   1.755 +		  (backward-char 1)
   1.756 +		  (insert-char ?\  (- col ccol))
   1.757 +		  (setq ccol col))
   1.758 +	      (setq ccol (+ ccol wd))))
   1.759 +	(setq ccol (1+ ccol)))
   1.760 +      (if (and YaTeX-japan
   1.761 +	       (string-match "[chj]" (char-category (preceding-char))))
   1.762 +	  (setq ccol (1+ ccol)))))
   1.763 +  (if (and force (> col ccol))
   1.764 +      (progn
   1.765 +	(insert-char ?\  (- col ccol))
   1.766 +	col)
   1.767 +    ccol)))
   1.768 +
   1.769  (defun yahtml-fill-paragraph (arg)
   1.770    (interactive "P")
   1.771 -  (let ((case-fold-search t) (p (point)))
   1.772 +  (let*((case-fold-search t) (p (point))
   1.773 +	(e (or (yahtml-inner-environment-but "^a\\b" t) "html"))
   1.774 +	(prep (string-match "^pre$" e))
   1.775 +	(ps1 (if prep (default-value 'paragraph-start)
   1.776 +	       paragraph-start))
   1.777 +	(ps2 (if prep (concat (default-value 'paragraph-start)
   1.778 +			      "\\|^\\s *</?pre>")
   1.779 +	       paragraph-start)))
   1.780      (save-excursion
   1.781 -      (fill-region-as-paragraph
   1.782 -       (progn (re-search-backward paragraph-start nil t)
   1.783 -	      (or (save-excursion
   1.784 -		    (goto-char (match-end 0))
   1.785 -		    (if (looking-at "[ \t]*$")
   1.786 -			(progn (forward-line 1) (point))))
   1.787 -		  (point)))
   1.788 -       (progn (goto-char p)
   1.789 -	      (re-search-forward paragraph-start nil t)
   1.790 -	      (match-beginning 0))))))
   1.791 +      (unwind-protect
   1.792 +	  (progn
   1.793 +	    (if prep
   1.794 +		(fset 'move-to-column 'yahtml-move-to-column))
   1.795 +	    (fill-region-as-paragraph
   1.796 +	     (progn (re-search-backward paragraph-start nil t)
   1.797 +		    (or (save-excursion
   1.798 +			  (goto-char (match-end 0))
   1.799 +			  (skip-chars-forward " \t>")
   1.800 +			  (if (looking-at "[ \t]*$")
   1.801 +			      (progn (forward-line 1) (point))))
   1.802 +			(point)))
   1.803 +	     (progn (goto-char p)
   1.804 +		    (re-search-forward ps2 nil t)
   1.805 +		    (match-beginning 0))))
   1.806 +	(fset 'move-to-column yahtml-saved-move-to-column)))))
   1.807 +
   1.808 +;(defun yahtml-indent-new-commnet-line ()
   1.809 +;  (unwind-protect
   1.810 +;      (progn
   1.811 +;	(fset 'move-to-column 'yahtml-move-to-column)
   1.812 +;	(apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft))))
   1.813 +;    (fset 'move-to-column yahtml-saved-move-to-column)))
   1.814  
   1.815  ;;; 
   1.816  ;;; ---------- indentation ----------
   1.817  ;;; 
   1.818 -(defvar yahtml-hate-too-deep-indentation nil)
   1.819  (defun yahtml-indent-line ()
   1.820    (interactive)
   1.821 -  (let ((envs "[uod]l\\|table\\|t[rhd]\\|select\\|a\\b")
   1.822 +  (let ((envs "[uod]l\\|table\\|t[rhd]\\|select")
   1.823  	(itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)>")
   1.824  	inenv p col peol (case-fold-search t))
   1.825      (save-excursion
   1.826        (beginning-of-line)
   1.827 -      (setq inenv (or (YaTeX-inner-environment) "html")
   1.828 +      (setq inenv (or (yahtml-inner-environment-but "^a\\b" t) "html")
   1.829  	    col (get 'YaTeX-inner-environment 'indent)
   1.830  	    p (get 'YaTeX-inner-environment 'point)
   1.831  	    op))
   1.832 @@ -1020,7 +1216,7 @@
   1.833  	   ((or (looking-at itms)
   1.834  		(and yahtml-hate-too-deep-indentation
   1.835  		     (looking-at (concat "<" envs))))
   1.836 -	    (YaTeX-reindent (+ col YaTeX-environment-indent)))
   1.837 +	    (YaTeX-reindent (+ col yahtml-environment-indent)))
   1.838  	   ((and (< p (point))
   1.839  		 (save-excursion
   1.840  		   (and
   1.841 @@ -1033,7 +1229,7 @@
   1.842  		    (setq col (current-column)))))
   1.843  	    (YaTeX-reindent col))
   1.844  	   (t
   1.845 -	    (YaTeX-reindent (+ col YaTeX-environment-indent)))))))
   1.846 +	    (YaTeX-reindent (+ col yahtml-environment-indent)))))))
   1.847        (and (bolp) (skip-chars-forward " \t"))
   1.848        (if (and (setq inenv (yahtml-on-begend-p))
   1.849  	       (string-match (concat "^\\(" envs "\\)") inenv))
   1.850 @@ -1075,19 +1271,33 @@
   1.851  ;     (t nil))))
   1.852  
   1.853  ;;; 
   1.854 -;;; ---------- Browsing ----------
   1.855 +;;; ---------- Lint and Browsing ----------
   1.856  ;;; 
   1.857  (defun yahtml-browse-menu ()
   1.858    "Browsing menu"
   1.859    (interactive)
   1.860 -  (message "B)rowse R)eload...")
   1.861 +  (message "J)weblint p)Browse R)eload...")
   1.862    (let ((c (char-to-string (read-char))))
   1.863      (cond
   1.864 -     ((string-match "[bj]" c)
   1.865 +     ((string-match "j" c)
   1.866 +      (yahtml-lint-buffer (current-buffer)))
   1.867 +     ((string-match "[bp]" c)
   1.868        (yahtml-browse-current-file))
   1.869       ((string-match "r" c)
   1.870        (yahtml-browse-reload)))))
   1.871  
   1.872 +(defvar yahtml-lint-buffer "*weblint*")
   1.873 +
   1.874 +(defun yahtml-lint-buffer (buf)
   1.875 +  "Call lint on buffer BUF."
   1.876 +  (interactive "bCall lint on buffer: ")
   1.877 +  (setq buf (get-buffer buf))
   1.878 +  (YaTeX-save-buffers)
   1.879 +  (YaTeX-typeset
   1.880 +   (concat yahtml-lint-program " "
   1.881 +	   (file-name-nondirectory (buffer-file-name buf)))
   1.882 +   yahtml-lint-buffer  "lint" "lint"))
   1.883 +
   1.884  (defun yahtml-file-to-url (file)
   1.885    "Convert local unix file name to URL.
   1.886  If no matches found in yahtml-path-url-alist, return raw file name."
   1.887 @@ -1095,6 +1305,10 @@
   1.888      (if (file-directory-p file)
   1.889  	(setq file (expand-file-name yahtml-directory-index file))
   1.890        (setq file (expand-file-name file)))
   1.891 +    (if (string-match "^[A-Za-z]:/" file)
   1.892 +	(progn
   1.893 +	  ;; (aset file 1 ?|) ;これは要らないらしい…
   1.894 +	  (setq file (concat "///" file))))
   1.895      (while list
   1.896        (if (string-match (concat "^" (regexp-quote (car (car list)))) file)
   1.897  	  (setq url (cdr (car list))
   1.898 @@ -1158,7 +1372,7 @@
   1.899        (set-process-sentinel
   1.900         (setq yahtml-browser-process
   1.901  	     (start-process
   1.902 -	      "browser" pb shell-file-name "-c"
   1.903 +	      "browser" pb shell-file-name yahtml-shell-command-option ;"-c"
   1.904  	      (format "%s -remote 'reload'" yahtml-www-browser)))
   1.905         'yahtml-netscape-sentinel))
   1.906       (t
   1.907 @@ -1168,9 +1382,10 @@
   1.908  (defun yahtml-intelligent-newline (arg)
   1.909    "Intelligent newline for HTML"
   1.910    (interactive "P")
   1.911 -  (let ((env (downcase (or (YaTeX-inner-environment) "html"))) func)
   1.912 +  (let (env func)
   1.913 +    (end-of-line)
   1.914 +    (setq env (downcase (or (YaTeX-inner-environment) "html")))
   1.915      (setq func (intern-soft (concat "yahtml-intelligent-newline-" env)))
   1.916 -    (end-of-line)
   1.917      (newline)
   1.918      (if (and env func (fboundp func))
   1.919  	(funcall func))))
   1.920 @@ -1219,7 +1434,7 @@
   1.921  
   1.922  ;;; ---------- complete marks ----------
   1.923  (defun yahtml-complete-mark ()
   1.924 -  "Complete &gt, &lt, &asterisk, and &quote."
   1.925 +  "Complete &gt, &lt, &ampersand, and &quote."
   1.926    (interactive)
   1.927    (message "1:< 2:> 3:& 4:\"")
   1.928    (let ((c (read-char)))
   1.929 @@ -1231,7 +1446,30 @@
   1.930        (insert (format "&%s;" (nth c '("lt" "gt" "amp" "quot")))))))
   1.931  
   1.932  
   1.933 -;;; ---------- ----------
   1.934 +;;; ---------- jump to error line ----------
   1.935 +(defvar yahtml-error-line-regexp
   1.936 +  "^\\(.*\\)(\\([0-9]+\\)):"
   1.937 +  "*Regexp of error position which is produced by lint program.")
   1.938 +(defun yahtml-prev-error ()
   1.939 +  "Jump to previous error seeing lint buffer."
   1.940 +  (interactive)
   1.941 +  (or (get-buffer yahtml-lint-buffer)
   1.942 +      (error "No lint program ran."))
   1.943 +  (YaTeX-showup-buffer yahtml-lint-buffer nil t)
   1.944 +  (yahtml-jump-to-error-line))
   1.945 +
   1.946 +(defun yahtml-jump-to-error-line ()
   1.947 +  (interactive)
   1.948 +  (let ((p (point)) (e (point-end-of-line)))
   1.949 +    (end-of-line)
   1.950 +    (if (re-search-backward yahtml-error-line-regexp nil t)
   1.951 +	(let ((f (YaTeX-match-string 1))
   1.952 +	      (l (string-to-int (YaTeX-match-string 2))))
   1.953 +	  (forward-line -1)
   1.954 +	  (YaTeX-showup-buffer f nil t)
   1.955 +	  (goto-line l))
   1.956 +      (message "No line number usage"))))
   1.957 +    
   1.958  ;;; ---------- ----------
   1.959  
   1.960  ;;;