yatex
changeset 102:4be83051f641 dev
Documentation fix.
Clean up codes.
author | yuuji@gentei.org |
---|---|
date | Thu, 08 Oct 2009 21:48:27 +0900 |
parents | 970c50beb4ce |
children | f2f0d1eedd39 |
files | yahtml.el |
diffstat | 1 files changed, 36 insertions(+), 65 deletions(-) [+] |
line diff
1.1 --- a/yahtml.el Mon Sep 28 13:09:16 2009 +0900 1.2 +++ b/yahtml.el Thu Oct 08 21:48:27 2009 +0900 1.3 @@ -1,7 +1,7 @@ 1.4 ;;; -*- Emacs-Lisp -*- 1.5 ;;; (c) 1994-2009 by HIROSE Yuuji [yuuji@yatex.org] 1.6 -;;; Last modified Mon Sep 28 10:45:04 2009 on firestorm 1.7 -;;; $Id$ 1.8 +;;; Last modified Thu Oct 8 21:46:07 2009 on firestorm 1.9 +;;; $Id: yahtml.el,v ce2deaceb818 2009/09/28 02:37:27 yuuji $ 1.10 1.11 (defconst yahtml-revision-number "1.72" 1.12 "Revision number of running yahtml.el") 1.13 @@ -43,10 +43,12 @@ 1.14 ;;; AddType "text/html; charset=Shift_JIS" .html (SJISの場合) 1.15 ;;; AddType "text/html; charset=iso2022-jp" .html (JISの場合) 1.16 ;;; AddType "text/html; charset=EUC-JP" .html (EUCの場合) 1.17 +;;; AddType "text/html; charset=utf-8" .html (UTF-8の場合) 1.18 ;;; 1.19 ;;; .htaccess が作れない場合は 1.20 ;;; (setq yahtml-kanji-code 2) 1.21 -;;; ;HTMLファイルの漢字コードを変更する場合は 1=SJIS、2=JIS、3=EUC 1.22 +;;; ;HTMLファイルの漢字コードを変更する場合は 1.23 +;;; ;1=SJIS、2=JIS、3=EUC 4=UTF-8 1.24 ;;; ;で設定して下さい。デフォルトは 2 です。 1.25 ;;; 1.26 ;;; を適切に書き換えて ~/.emacs に足して下さい。 1.27 @@ -168,7 +170,6 @@ 1.28 ;;; 1.29 1.30 1.31 -;(require 'yatex) 1.32 (require 'yatexlib) 1.33 ;;; --- customizable variable starts here --- 1.34 (defvar yahtml-prefix "\C-c" 1.35 @@ -235,7 +236,7 @@ 1.36 1.37 (defvar yahtml-use-css t "*Use stylesheet or not") 1.38 1.39 -(defvar yahtml-image-inspection-bytes 50000 ;256 1.40 +(defvar yahtml-image-inspection-bytes 50000 1.41 "*Number of bytes to inspect the image for geometry information") 1.42 (defvar yahtml:img-default-alt-format "%xx%y(%sbytes)" 1.43 "*Default format of img entity's ALT attributes. 1.44 @@ -357,8 +358,7 @@ 1.45 (yahtml-define-begend-key "bS" "span" map) 1.46 (yahtml-define-begend-key "bp" "pre" map) 1.47 (YaTeX-define-key "b " 'yahtml-insert-begend map) 1.48 - (YaTeX-define-key "B " 'yahtml-insert-begend-region map) 1.49 - ) 1.50 + (YaTeX-define-key "B " 'yahtml-insert-begend-region map)) 1.51 (YaTeX-define-key "e" 'YaTeX-end-environment map) 1.52 (YaTeX-define-key ">" 'yahtml-comment-region map) 1.53 (YaTeX-define-key "<" 'yahtml-uncomment-region map) 1.54 @@ -372,8 +372,7 @@ 1.55 (YaTeX-define-key ":" 'yahtml-translate-reverse-region map) 1.56 (YaTeX-define-key "#" 'yahtml-escape-chars-region map) 1.57 ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map) 1.58 - (YaTeX-define-key "\e" 'yahtml-quit map) 1.59 - ) 1.60 + (YaTeX-define-key "\e" 'yahtml-quit map)) 1.61 (substitute-all-key-definition 1.62 'fill-paragraph 'yahtml-fill-paragraph yahtml-mode-map) 1.63 (substitute-all-key-definition 1.64 @@ -400,8 +399,8 @@ 1.65 (make-syntax-table (standard-syntax-table))) 1.66 (modify-syntax-entry ?\< "(>" yahtml-syntax-table) 1.67 (modify-syntax-entry ?\> ")<" yahtml-syntax-table) 1.68 - (modify-syntax-entry ?\n " " yahtml-syntax-table) 1.69 -) 1.70 + (modify-syntax-entry ?\n " " yahtml-syntax-table)) 1.71 + 1.72 (defvar yahtml-command-regexp "[A-Za-z0-9]+" 1.73 "Regexp of constituent of html commands.") 1.74 1.75 @@ -485,8 +484,6 @@ 1.76 (defvar yahtml-current-completion-type nil 1.77 "Has current completion type. This may be used in yahtml addin functions.") 1.78 1.79 -;(defvar yahtml-struct-name-regexp 1.80 -; "\\<\\(h[1-6]\\|[uod]l\\|html\\|body\\|title\\|head\\|table\\|t[rhd]\\|pre\\|a\\|form\\|select\\|center\\|blockquote\\)\\b") 1.81 (defvar yahtml-struct-name-regexp 1.82 (concat 1.83 "\\<\\(" 1.84 @@ -541,10 +538,8 @@ 1.85 (setq ldir dir 1.86 dir (substring dir 0 (string-match "/$" dir)) 1.87 dir (file-name-directory dir)))) 1.88 - line 1.89 - )) 1.90 - (t nil)) 1.91 - ) 1.92 + line)) 1.93 + (t nil))) 1.94 1.95 (defun yahtml-dir-default-charset () 1.96 (let*((fn (file-name-nondirectory (or buffer-file-name ""))) 1.97 @@ -586,8 +581,7 @@ 1.98 (setq index-list (cons (substring line 0 x) index-list) 1.99 line (substring line (match-end 1))) 1.100 (setq index-list (cons line index-list) 1.101 - line "")) 1.102 - ) 1.103 + line ""))) 1.104 (or (nreverse index-list) 1.105 (if (listp yahtml-directory-index) 1.106 yahtml-directory-index 1.107 @@ -651,9 +645,7 @@ 1.108 ;;(font-lock-mode -1) 1.109 (font-lock-mode 1) ;;Why should I fontify again??? 1.110 ;; in yatex-mode, there's no need to refontify... 1.111 - (font-lock-fontify-buffer) 1.112 - )) 1.113 - )) 1.114 + (font-lock-fontify-buffer))))) 1.115 (set-syntax-table yahtml-syntax-table) 1.116 (use-local-map yahtml-mode-map) 1.117 (YaTeX-read-user-completion-table) 1.118 @@ -754,8 +746,7 @@ 1.119 (strong "Strong" . 1.120 (lambda () (interactive) (yahtml-insert-tag nil "STRONG"))) 1.121 (VAR "Variable notation" . 1.122 - (lambda () (interactive) (yahtml-insert-tag nil "VAR"))) 1.123 - ))) 1.124 + (lambda () (interactive) (yahtml-insert-tag nil "VAR")))))) 1.125 (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags")) 1.126 (YaTeX-define-menu 1.127 'yahtml-menu-map-typeface 1.128 @@ -767,8 +758,7 @@ 1.129 (tt "Typewriter" . 1.130 (lambda () (interactive) (yahtml-insert-tag nil "TT"))) 1.131 (u "Underlined" . 1.132 - (lambda () (interactive) (yahtml-insert-tag nil "U"))) 1.133 - ))) 1.134 + (lambda () (interactive) (yahtml-insert-tag nil "U")))))) 1.135 (setq yahtml-menu-map-listing (make-sparse-keymap "listing")) 1.136 (YaTeX-define-menu 1.137 'yahtml-menu-map-listing 1.138 @@ -778,8 +768,7 @@ 1.139 (ol "Ordered" . 1.140 (lambda () (interactive) (yahtml-insert-begend nil "OL"))) 1.141 (dl "Definition" . 1.142 - (lambda () (interactive) (yahtml-insert-begend nil "DL"))) 1.143 - ))) 1.144 + (lambda () (interactive) (yahtml-insert-begend nil "DL")))))) 1.145 (setq yahtml-menu-map-item (make-sparse-keymap "item")) 1.146 (YaTeX-define-menu 1.147 'yahtml-menu-map-item 1.148 @@ -789,8 +778,7 @@ 1.149 (dt "Define term" . 1.150 (lambda () (interactive) (yahtml-insert-single "dt"))) 1.151 (dd "Description of term" . 1.152 - (lambda () (interactive) (yahtml-insert-single "dd"))) 1.153 - ))) 1.154 + (lambda () (interactive) (yahtml-insert-single "dd")))))) 1.155 (define-key yahtml-mode-map [menu-bar yahtml] 1.156 (cons "yahtml" yahtml-menu-map)) 1.157 (YaTeX-define-menu 1.158 @@ -806,16 +794,14 @@ 1.159 (cons (list 'logi "Logical tags") 1.160 (cons "logical" yahtml-menu-map-logical)) 1.161 (cons (list 'type "Typeface tags") 1.162 - (cons "typeface" yahtml-menu-map-typeface)) 1.163 - ))) 1.164 + (cons "typeface" yahtml-menu-map-typeface))))) 1.165 (if (featurep 'xemacs) 1.166 (add-hook 'yahtml-mode-hook 1.167 '(lambda () 1.168 (or (assoc "yahtml" current-menubar) 1.169 (progn 1.170 (set-buffer-menubar (copy-sequence current-menubar)) 1.171 - (add-submenu nil yahtml-menu-map)))))) 1.172 - )) 1.173 + (add-submenu nil yahtml-menu-map)))))))) 1.174 1.175 ;;; ----------- Completion ---------- 1.176 (defvar yahtml-last-begend "html") 1.177 @@ -937,16 +923,14 @@ 1.178 (setq list (cons 1.179 (list (concat "#" (YaTeX-match-string 1))) 1.180 list)))) 1.181 - list))) 1.182 - ) 1.183 + list)))) 1.184 1.185 (defvar yahtml-url-completion-map nil "Key map used in URL completion buffer") 1.186 (if yahtml-url-completion-map nil 1.187 (setq yahtml-url-completion-map 1.188 (copy-keymap minibuffer-local-completion-map)) 1.189 (define-key yahtml-url-completion-map "\t" 'yahtml-complete-url) 1.190 - (define-key yahtml-url-completion-map " " 'yahtml-complete-url) 1.191 -) 1.192 + (define-key yahtml-url-completion-map " " 'yahtml-complete-url)) 1.193 1.194 (defun yahtml-complete-url () 1.195 "Complete external URL from history or local file name." 1.196 @@ -1094,8 +1078,7 @@ 1.197 (null (assoc href yahtml-urls-local))) 1.198 (YaTeX-update-table 1.199 (list href) 1.200 - 'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local)) 1.201 - ))) 1.202 + 'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local))))) 1.203 1.204 (defvar yahtml-parameters-completion-alist 1.205 '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center")) 1.206 @@ -1340,8 +1323,7 @@ 1.207 height (yahtml-hex-value 22 4 t))) 1.208 (t 1.209 (setq width (yahtml-hex-value 18 2 t) 1.210 - height (yahtml-hex-value 20 2 t))))) 1.211 - )) 1.212 + height (yahtml-hex-value 20 2 t))))))) 1.213 (message "") 1.214 (kill-buffer tmpbuf)) 1.215 (list width height bytes depth (nreverse comment))))) 1.216 @@ -1352,8 +1334,7 @@ 1.217 " " (if yahtml-prefer-upcase-attributes "METHOD" "method") "=" 1.218 (completing-read "Method: " '(("POST") ("GET")) nil t) 1.219 " " (if yahtml-prefer-upcase-attributes "ACTION" "action") "=\"" 1.220 - (read-string "Action: ") "\"" 1.221 - )) 1.222 + (read-string "Action: ") "\"")) 1.223 1.224 (defun yahtml:select () 1.225 "Add-in function for `select' input format" 1.226 @@ -1402,8 +1383,7 @@ 1.227 (yahtml-make-optional-argument "type" type) 1.228 (yahtml-make-optional-argument "value" value) 1.229 (yahtml-make-optional-argument "size" size) 1.230 - (yahtml-make-optional-argument "maxlength" maxlength) 1.231 - ))) 1.232 + (yahtml-make-optional-argument "maxlength" maxlength)))) 1.233 1.234 (defun yahtml:textarea () 1.235 "Add-in function for `textarea'" 1.236 @@ -1515,8 +1495,8 @@ 1.237 (yahtml-make-optional-argument 1.238 "type" (yahtml-read-parameter "type" "text/css")) 1.239 (yahtml-make-optional-argument 1.240 - "href" (read-from-minibuffer "href: " "" yahtml-url-completion-map)) 1.241 - ))))) 1.242 + "href" 1.243 + (read-from-minibuffer "href: " "" yahtml-url-completion-map))))))) 1.244 1.245 (defvar yahtml:meta-names 1.246 '(("name" ("keywords")("author")("copyright")("date")("GENERATOR")))) 1.247 @@ -1577,11 +1557,9 @@ 1.248 (yahtml-make-optional-argument 1.249 "height" (yahtml-read-parameter "height")) 1.250 (yahtml-make-optional-argument 1.251 - "align" (yahtml-read-parameter "align")) 1.252 - )) 1.253 + "align" (yahtml-read-parameter "align")))) 1.254 (t 1.255 - "" 1.256 - )))) 1.257 + "")))) 1.258 1.259 (defun yahtml:abbr () 1.260 "Add-in function for abbr." 1.261 @@ -1620,7 +1598,6 @@ 1.262 (interactive) 1.263 (yahtml-insert-tag t tag)) 1.264 1.265 - 1.266 (defvar yahtml-need-single-closer nil) ;for test 1.267 (defun yahtml-insert-single (cmd) 1.268 "Insert <CMD>." 1.269 @@ -1701,8 +1678,7 @@ 1.270 (skip-chars-forward " \t\n") 1.271 (looking-at "\"?\\([^\"> \t\n]+\\)\"?")) 1.272 (< p (match-end 0)) 1.273 - (YaTeX-match-string 1) 1.274 - )))) 1.275 + (YaTeX-match-string 1))))) 1.276 1.277 (defun yahtml-netscape-sentinel (proc mes) 1.278 (cond 1.279 @@ -1813,8 +1789,7 @@ 1.280 (if (and (re-search-backward "<" nil t) 1.281 (looking-at 1.282 ;(concat "<\\(/?" yahtml-struct-name-regexp "\\)\\b") 1.283 - "<\\(/?[A-Z][A-Z0-9]*\\)\\b" 1.284 - ) 1.285 + "<\\(/?[A-Z][A-Z0-9]*\\)\\b") 1.286 (condition-case nil 1.287 (forward-list 1) 1.288 (error nil)) 1.289 @@ -1947,8 +1922,7 @@ 1.290 ((yahtml-goto-corresponding-img)) 1.291 ((yahtml-goto-corresponding-source other)) 1.292 ((yahtml-goto-corresponding-begend)) 1.293 - (t (message "I don't know where to go.")) 1.294 - )) 1.295 + (t (message "I don't know where to go.")))) 1.296 1.297 (defun yahtml-goto-corresponding-*-other-window () 1.298 "Go to corresponding object." 1.299 @@ -2012,8 +1986,7 @@ 1.300 "Kill current position's HTML tag (set)." 1.301 (interactive "P") 1.302 (cond 1.303 - ((yahtml-kill-begend whole)) 1.304 - )) 1.305 + ((yahtml-kill-begend whole)))) 1.306 1.307 1.308 ;;; ---------- changing ---------- 1.309 @@ -2161,8 +2134,7 @@ 1.310 (interactive) 1.311 (cond 1.312 ((yahtml-change-begend)) 1.313 - ((yahtml-change-command)) 1.314 - )) 1.315 + ((yahtml-change-command)))) 1.316 1.317 ;;; ---------- commenting ---------- 1.318 1.319 @@ -2184,8 +2156,7 @@ 1.320 (beginning-of-line) 1.321 (forward-line 1)) 1.322 (set-marker e (point)) 1.323 - ;(comment-region beg (point) (if uncom (list 4))) 1.324 - )) 1.325 + ;(comment-region beg (point) (if uncom (list 4))))) 1.326 (t ;(comment-region (region-beginning) (region-end) (if uncom (list 4))) 1.327 (setq beg (region-beginning)) 1.328 (set-marker e (region-end))))