(defun konqueror-compose-mail (&optional to subj cc dcc body attach)
"Interface function of konqueror for `compose-mail'.
call with `(konqueror-compose-mail \"%t\" \"%s\" \"%c\" \"%b\" \"%B\" \"%A\")."
(interactive)
(let ((headers '(cc dcc body))
others)
(while headers
(when (eval (car headers))
(setq others (cons (cons (capitalize (symbol-name (car headers)))
(eval (car headers)))
others)))
(setq headers (cdr headers)))
;; (mew-user-agent-compose to subj others))) ;; <= お好みでこっちでもよい
(compose-mail to subj others)))
konqueror って コンケラ って読むのね。知らんかった。Mew 以外で使うときは "dcc" を "bcc" にした方が良いのかな?
(add-hook 'w3m-mode-hook
(lambda ()
(define-key w3m-mode-map "\M-k" 'w3m-shimbun-extract)
(define-key w3m-mode-map "\M-K" 'w3m-cookie)))
(setq w3m-filter-rules
`(("\\`http://www\\.geocities\\.co\\.jp/"
w3m-filter-delete-regions
"<DIV ALIGN=CENTER>\n<!--*/GeoGuide/*-->" "<!--*/GeoGuide/*-->\n</DIV>")
("\\`http://[a-z]+\\.hp\\.infoseek\\.co\\.jp/"
w3m-filter-delete-regions
"<!-- start AD -->" "<!-- end AD -->")
("\\`http://linux\\.ascii24\\.com/linux/"
w3m-filter-delete-regions
"<!-- DAC CHANNEL AD START -->" "<!-- DAC CHANNEL AD END -->")
("\\`http://www.?\\.asahi\\.com/" w3m-filter-asahi-kiji) ;; 置き換え
("\\`http://www.?\\.yomiuri\\.co\\.jp/" w3m-filter-yomiuri-kiji))) ;; 追加
(defvar w3m-shimbun-extract nil)
(defun w3m-filter-asahi-kiji (url)
"Convert entity reference of UCS."
(when w3m-use-mule-ucs
(goto-char (point-min))
(let ((case-fold-search t)
end ucs)
(while (re-search-forward "alt=\"\\([^\"]+\\)" nil t)
(goto-char (match-beginning 1))
(setq end (set-marker (make-marker) (match-end 1)))
(while (re-search-forward "\\([0-9]+\\);" (max end (point)) t)
(setq ucs (string-to-number (match-string 1)))
(delete-region (match-beginning 0) (match-end 0))
(insert-char (w3m-ucs-to-char ucs) 1)))))
(when (eq w3m-shimbun-extract t)
(setq w3m-shimbun-extract 'ok)
(let (start end)
(goto-char (point-min))
(when (search-forward "</head>" nil t)
(setq start (match-end 0))
(when (search-forward "<div id=\"kijih\">" nil t)
(delete-region start (match-beginning 0))
(when (and (search-forward "<div class=\"wrapkiji\">" nil t)
(search-forward "alt=\"ここから広告です\"" nil t)
(search-backward "<" nil t))
(setq start (match-beginning 0))
(when (search-forward "</body>" nil t)
(delete-region start (match-beginning 0)))
(goto-char (point-min))
(while (re-search-forward "<table [^>]+>" nil t)
(delete-region (match-beginning 0) (match-end 0)))
(goto-char (point-min))
(while (search-forward "</table>" nil t)
(delete-region (match-beginning 0) (match-end 0)))))))))
(defun w3m-filter-yomiuri-kiji (url)
"Convert entity reference of UCS."
(when (eq w3m-shimbun-extract t)
(setq w3m-shimbun-extract 'ok)
(let (start end)
(goto-char (point-min))
(when (search-forward "</head>" nil t)
(setq start (match-end 0))
(when (search-forward "<!--// headline_start //-->" nil t)
(delete-region start (match-beginning 0))
(when (search-forward "<!--// article_end //-->" nil t)
(setq start (match-end 0))
(when (search-forward "</body>" nil t)
(delete-region start (match-beginning 0)))))))))
(defun w3m-shimbun-extract ()
(interactive)
(if (not (and w3m-current-url
(or
(string-match "\\`http://[^.]+\\.asahi\\.com/" w3m-current-url)
(string-match "\\`http://[^.]+\\.yomiuri\\.co\\.jp/" w3m-current-url))))
(message "読売新聞と朝日新聞だけよ")
(setq w3m-shimbun-extract t)
(w3m-redisplay-this-page)
(when (eq w3m-shimbun-extract 'ok)
(goto-char (point-min))
(forward-line 1))
(setq w3m-shimbun-extract nil)))
適当なので、だめなときはだめ。sb-asahi|yomiuri の機能を使うと良いかもしれない。
(defun tdiary-pre-conv ()
(interactive)
(let (beg end)
(save-excursion
(beginning-of-line)
(cond
((looking-at "^<pre>")
(setq beg (progn (forward-line 1) (point)))
(re-search-forward "^</pre>")
(setq end (progn (forward-line -1) (line-end-position))))
((looking-at "^</pre>")
(setq end (progn (forward-line -1) (line-end-position)))
(re-search-backward "^<pre>")
(setq beg (progn (forward-line 1) (point))))
(t
(re-search-backward "^<pre>")
(setq beg (progn (forward-line 1) (point)))
(re-search-forward "^</pre>")
(setq end (progn (forward-line -1) (line-end-position)))))
(save-restriction
(widen)
(narrow-to-region beg end)
(goto-char (point-min))
(while (re-search-forward "^$" nil t)
(replace-match " "))
(goto-char (point-min))
(while (search-forward "<" nil t)
(replace-match "<"))
(goto-char (point-min))
(while (search-forward ">" nil t)
(replace-match ">"))
(goto-char (point-min))))))