X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=wl%2Fwl-demo.el;h=3e06c69ebd9d0a7bc6f4519bb0f4fabe60d331b3;hb=7b1c7e63938a59f9e887f91104ac866dd2fdd573;hp=2db1cb13ffcb9ddf2b2ce31df4a8e1e6ee61a7ed;hpb=d96c4da402f1f157f57a52284be39290ad095a06;p=elisp%2Fwanderlust.git diff --git a/wl/wl-demo.el b/wl/wl-demo.el index 2db1cb1..3e06c69 100644 --- a/wl/wl-demo.el +++ b/wl/wl-demo.el @@ -29,7 +29,7 @@ ;;; Code: (defconst wl-demo-copyright-notice - "Copyright (C) 1998-2001 Yuuichi Teranishi " + "Copyright (C) 1998-2002 Yuuichi Teranishi " "A declaration of the copyright on Wanderlust.") (eval-when-compile @@ -41,7 +41,7 @@ (defconst wl-demo-icon-name (concat "wl-" (wl-version-status) - (if (string-match "^... Dec \\([ 1][0-9]\\|2[0-4]\\)" + (if (string-match "^... Dec \\([ 1][0-9]\\|2[0-5]\\)" (current-time-string)) "-xmas-logo" "-logo")) @@ -122,7 +122,8 @@ Yet Another Message Interface On Emacsen" (module-installed-p 'bitmap) (setq wl-demo-bitmap-mule-available-p t)))) '("bitmap" . bitmap)))) - (if wl-on-emacs21 + (if (and wl-on-emacs21 + (image-type-available-p 'xbm)) ;; Prefer xbm rather than bitmap on Emacs 21. (delq nil (list xpm xbm bitmap '("ascii"))) (delq nil (list xpm bitmap xbm '("ascii"))))) @@ -143,8 +144,9 @@ Return a number of lines that an image occupies in the buffer." (when (boundp 'default-gutter-visible-p) (set-specifier (symbol-value 'default-gutter-visible-p) nil (current-buffer))) - (set-specifier (symbol-value 'scrollbar-height) 0 (current-buffer)) - (set-specifier (symbol-value 'scrollbar-width) 0 (current-buffer))) + (when (featurep 'scrollbar) + (set-specifier (symbol-value 'scrollbar-height) 0 (current-buffer)) + (set-specifier (symbol-value 'scrollbar-width) 0 (current-buffer)))) (if (and file (if (and wl-icon-directory (file-directory-p wl-icon-directory)) @@ -199,25 +201,38 @@ Return a number of lines that an image occupies in the buffer." ((eq 'bitmap image-type) ;; Use ready-composed bitmap image. (require 'bitmap) - (if wl-on-emacs21 - (progn - ;; Decode bitmap data line by line. - (let ((coding-system-for-read 'raw-text)) - (insert-file-contents file)) - (set-buffer-multibyte t) - (while (not (eobp)) - (decode-coding-region (point) (line-end-position) - 'iso-2022-7bit) - (forward-line 1)) - (goto-char (point-min))) - (let ((coding-system-for-read 'iso-2022-7bit) - (input-coding-system '*iso-2022-jp*)) - (insert-file-contents file))) - (end-of-line) + (let ((coding-system-for-read 'iso-2022-7bit) + (input-coding-system '*iso-2022-jp*)) + (insert-file-contents file)) + (goto-char (point-max)) + (unless (bolp) + (insert "\n")) + (setq width 0) + (while (progn + (end-of-line 0) + (not (bobp))) + (setq width (max width (current-column)))) + ;; Emacs 21.1 would fail to decode composite chars + ;; if it has been built without fixing coding.c. + (when (and wl-on-emacs21 + (>= width 80)) + (erase-buffer) + (let ((coding-system-for-read 'raw-text)) + (insert-file-contents file)) + (goto-char (point-max)) + (unless (bolp) + (insert "\n")) + (setq width 0) + (while (progn + (end-of-line 0) + (not (bobp))) + ;; Decode bitmap data line by line. + (decode-coding-region (line-beginning-position) + (point) + 'iso-2022-7bit) + (setq width (max width (current-column))))) (indent-rigidly (point-min) (point-max) - (max 0 (/ (1+ (- (window-width) - (current-column))) - 2))) + (max 0 (/ (1+ (- (window-width) width)) 2))) (put-text-property (point-min) (point-max) 'face 'wl-highlight-logo-face) (count-lines (point-min) (goto-char (point-max)))) @@ -301,6 +316,7 @@ argument." (get-buffer-create "*WL Demo*")))) (switch-to-buffer buffer) (setq buffer-read-only nil) + (buffer-disable-undo) (erase-buffer) (setq truncate-lines t tab-width 8)