[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: view-source
で
font-lock
安宅さんのコードを参考にして、HTML のソースを表示するときに、
font-lock-defaults を設定するように変更してみました。問題がなければ、
取り込んでくださいませ。
2005-07-16 Hiroshi Fujishima <hiroshi.fujishima@gmail.com>
* w3m.el (w3m-view-source): When running Emacs 21 or later and
viewing the html source, Set font-lock-defaults.
Index: w3m.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m.el,v
retrieving revision 1.1156
diff -u -r1.1156 w3m.el
--- w3m.el 15 Jul 2005 03:01:08 -0000 1.1156
+++ w3m.el 16 Jul 2005 01:02:01 -0000
@@ -7881,14 +7881,41 @@
(let ((w3m-prefer-cache t))
(cond
((string-match "\\`about://source/" w3m-current-url)
- (w3m-goto-url (substring w3m-current-url (match-end 0))))
+ (w3m-goto-url (substring w3m-current-url (match-end 0)))
+ (when (featurep 'w3m-e21)
+ (setq font-lock-defaults nil
+ font-lock-set-defaults nil)))
((string-match "\\`about://header/" w3m-current-url)
(w3m-goto-url (concat "about://source/"
(substring w3m-current-url (match-end 0))))
- (setq truncate-lines nil))
+ (setq truncate-lines nil)
+ (when (featurep 'w3m-e21)
+ (require 'sgml-mode)
+ (setq font-lock-defaults
+ '((sgml-font-lock-keywords
+ sgml-font-lock-keywords-1
+ sgml-font-lock-keywords-2)
+ nil t nil nil
+ (font-lock-syntactic-keywords
+ . sgml-font-lock-syntactic-keywords))
+ font-lock-set-defaults nil)
+ (font-lock-set-defaults)
+ (font-lock-fontify-buffer)))
(t
(w3m-goto-url (concat "about://source/" w3m-current-url))
- (setq truncate-lines nil))))
+ (setq truncate-lines nil)
+ (when (featurep 'w3m-e21)
+ (require 'sgml-mode)
+ (setq font-lock-defaults
+ '((sgml-font-lock-keywords
+ sgml-font-lock-keywords-1
+ sgml-font-lock-keywords-2)
+ nil t nil nil
+ (font-lock-syntactic-keywords
+ . sgml-font-lock-syntactic-keywords))
+ font-lock-set-defaults nil)
+ (font-lock-set-defaults)
+ (font-lock-fontify-buffer)))))
(w3m-message "Can't view page source")))
(defun w3m-make-separator ()
--
Hiroshi Fujishima