# CCL (was: w3mmee vs emacs-w3m problems)

```>> On Mon, 14 May 2001 11:59:24 +0900 (JST)
>> h-saka@lsi.nec.co.jp (Hironori Sakamoto) said as follows:

>\$B\$;\$C\$+\$/(B Mule \$B\$J\$N\$G\$9\$+\$i(B x-moe-internal (\$B\$d(B w3m-m17n \$B\$NFbIt%3!<%I(B)
>\$B\$b(B private charset \$B\$H\$7\$F07\$(\$k\$H\$\$\$\$\$N\$G\$O\$H;W\$\$\$^\$9!#(B

\$B\$H\$\$\$&/\$7J,\$+\$C\$?\$N\$G!"0J2<\$N\$h\$&\$J%3!<%I\$r=q\$\$(B
\$B\$F;n\$7\$F\$_\$^\$7\$?!#(B

# \$B\$3\$s\$J\$N\$G\$\$\$\$\$N\$+!"\$^\$C\$?\$/M}2r\$,B-\$j\$F\$\$\$J\$\$>uBV\$G\$9\$N\$G!"<1\$7\$^\$9!#(B
```
```(require 'pccl)

(define-ccl-program w3m-internal-decode
`(2
(loop
(if (r0 < 128)
(write-repeat r0)
(if (r0 == 128)
(write-repeat 32)
(if (r0 == 144)
(write-repeat 32)
(if (r0 == 160)
(write-repeat 32)))))
(write ,(if (boundp 'MULE)
lc-jp
(charset-id 'japanese-jisx0208)))
(write r0)
(write-repeat r1))))

(define-ccl-program w3m-internal-encode
`(1
(loop
(write-repeat r0))))

(make-ccl-coding-system
'w3m-internal ?E "w3m internal coding system"
'w3m-internal-decode 'w3m-internal-encode)

;; (with-current-buffer (get-buffer-create "*TEST*")
;;   (erase-buffer)
;;         (default-process-coding-system (cons 'w3m-internal '*noconv*)))
;;     (call-process "w3m" nil t nil "-halfdump" "http://namazu.org/~tsuchiya/emacs-w3m/";)))

(defun w3m-rendering-region (start end)
"Do rendering of contents in this buffer as HTML and return title."
(save-restriction
(narrow-to-region start end)
(let ((coding-system-for-write w3m-input-coding-system)
(default-process-coding-system
(cons 'w3m-internal w3m-input-coding-system)))
(if w3m-use-form
(w3m-form-parse-region start end))
(w3m-message "Rendering...")
(apply 'call-process-region
start end w3m-command t t nil
(mapcar (lambda (x)
(if (stringp x)
x
(prin1-to-string (eval x))))
(append (list w3m-halfdump-option)
w3m-halfdump-command-arguments
w3m-halfdump-expand-options)))
(w3m-message "Rendering... done")
(goto-char (point-min))
;; FIXME: Adhoc support for w3m with patch in [w3m-dev 01876].
(and (looking-at "<!DOCTYPE w3mhalfdump public")
(search-forward "\n<pre>\n" nil t)
(delete-region (point-min) (1+ (match-beginning 0))))
(let (title)
(dolist (regexp '("<title_alt[ \t\n]+title=\"\\([^\"]+\\)\">"
"<title>\\([^<]\\)</title>"))
(goto-char (point-min))
(when (re-search-forward regexp nil t)
(setq title (match-string 1))
(delete-region (match-beginning 0) (match-end 0))))
(if (and (null title)
(stringp w3m-current-url)
(< 0 (length (file-name-nondirectory w3m-current-url))))
(setq title (file-name-nondirectory w3m-current-url)))
(setq w3m-current-title (or title "<no-title>"))))))
```
```\$B\$=\$l\$G!"%Y%s%A%^!<%/\$rhttp://localhost/~tsuchiya/")
(setq i (1- i))))
(elp-results))

;;; Emacs21

;; \$B8=:_\$N-Mh\$N(B w3m-m17n \$B\$NFbIt%3!<%I\$KBP1~\$7\$h\$&\$H\$9\$k\$H!"(B
\$BHr\$1\$FDL\$k\$3\$H\$O=PMh\$J\$\$\$H;W\$&\$N\$G!"\$b\$&>/\$78&5f\$7\$F\$_\$h\$&\$H;W\$\$\$^\$9!#(B

--
\$BEZ20(B \$B2mL-(B  ( TSUCHIYA Masatoshi )
http://www-nagao.kuee.kyoto-u.ac.jp/member/tsuchiya/
```

• Namazu Search: [Help]