(add-hook 'w3m-mode-hook (lambda () (define-key w3m-mode-map "\M-k" 'w3m-shimbun-noextract) (define-key w3m-mode-map "\M-K" 'w3m-cookie))) (setq w3m-use-filter t) (setq w3m-filter-rules `( ;; .... ("\\`http://www.?\\.yomiuri\\.co\\.jp/" w3m-filter-yomiuri-kiji) ("\\`http://www.?\\.sankei\\.co\\.jp/" w3m-filter-sankei-kiji) ("\\`http://www.?\\.asahi\\.com/" w3m-filter-asahi-kiji))) (defun w3m-shimbun-noextract () (interactive) (if (not (and w3m-current-url (or (string-match "\\`http://[^.]+\\.asahi\\.com/" w3m-current-url) (string-match "\\`http://[^.]+\\.sankei\\.co\\.jp/" w3m-current-url) (string-match "\\`http://[^.]+\\.yomiuri\\.co\\.jp/" w3m-current-url)))) (message "読売新聞/産経新聞/朝日新聞だけよ") (w3m-redisplay-this-page))) (defun w3m-filter-yomiuri-kiji (url) (when (and (or (featurep 'shimbun) (require 'shimbun)) (fboundp 'shimbun-japanese-hankaku-buffer)) (shimbun-japanese-hankaku-buffer t)) (unless (eq this-command 'w3m-shimbun-noextract) (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)) (when (search-forward "</html>" nil t) (delete-region (match-end 0) (point-max)))))))))) (defun w3m-filter-sankei-kiji (url) (when (and (or (featurep 'shimbun) (require 'shimbun)) (fboundp 'shimbun-japanese-hankaku-buffer)) (shimbun-japanese-hankaku-buffer t)) (unless (eq this-command 'w3m-shimbun-noextract) (let (start end) (goto-char (point-min)) (when (search-forward "<body>" nil t) (setq start (match-end 0)) (when (search-forward "<!--▼記事本文▼-->" nil t) (delete-region start (match-beginning 0)) (when (search-forward "<!--▲記事本文▲-->" nil t) (setq start (match-end 0)) (when (search-forward "</body>" nil t) (delete-region start (match-beginning 0)) (when (search-forward "</html>" nil t) (delete-region (match-end 0) (point-max)))))))))) (defun w3m-filter-asahi-kiji (url) (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 (and (or (featurep 'shimbun) (require 'shimbun)) (fboundp 'shimbun-japanese-hankaku-buffer)) (shimbun-japanese-hankaku-buffer t)) (unless (eq this-command 'w3m-shimbun-noextract) (let (start end) (goto-char (point-min)) (when (search-forward "</head>" nil t) (setq start (match-end 0)) (when (or (search-forward "<h1 class=\"kijimidashi\">" nil t) (search-forward "<!-- Start of Headline -->" nil t) (search-forward "<!-- Start of photo -->" nil t) (search-forward "<!-- Start of Kiji -->" nil t)) (delete-region start (match-beginning 0)) (when (or (search-forward "<!-- google_ad_section_end" nil t) (search-forward "<div class=\"clear\">" nil t) (search-forward "<div class=\"pr\">" nil t) (search-forward "<div class=\"list\">" 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)))))))))本文だけになった記事の全部をみたいときは、M-k を押す。もともと M-k だった w3m-cookie() は M-K へ移動