Improve skip test if socks server is unavailable
[navi2ch.git] / navi2ch-e21.el
blob8b5715f7f23edeb47a58e411e7f0fbd4406930fa
1 ;;; navi2ch-e21.el --- GNU Emacs 21 module for navi2ch -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 2001, 2002, 2004 by Navi2ch Project
4 ;; Copyright (C) 2000,2001 Katsumi Yamaoka <yamaoka@jpl.org>
5 ;; Copyright (C) 2000,2001 Yuuichi Teranishi <teranisi@gohome.org>
7 ;; Author: UEYAMA Rui <rui314159@users.sourceforge.net>
8 ;; Keywords: network, 2ch
10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; This file is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; Commentary:
29 ;;; Code:
30 (provide 'navi2ch-e21)
31 (defconst navi2ch-e21-ident
32 "$Id$")
34 (eval-when-compile
35 (require 'cl-lib)
36 (require 'navi2ch-decls)
37 (require 'navi2ch-inline))
39 (require 'navi2ch-vars)
41 ;;; \e$B0J2<!"\e(BWanderlust (wl-e21.el) \e$B$+$i$[$H$s$I%3%T%Z!#$3$l:G6/!#\e(B
42 (add-hook 'navi2ch-hook 'navi2ch-offline-init-icons)
44 (eval-when-compile
45 (navi2ch-defalias-maybe 'display-mouse-p 'ignore)
46 (navi2ch-defalias-maybe 'make-mode-line-mouse-map 'ignore)
47 (navi2ch-defalias-maybe 'display-images-p 'ignore)
48 (navi2ch-defalias-maybe 'image-type-available-p 'ignore)
49 (navi2ch-defalias-maybe 'find-image 'ignore)
50 (defmacro navi2ch-e21-display-image-p ()
51 '(and (display-images-p)
52 (image-type-available-p 'xpm))))
54 (defvar navi2ch-online-image nil)
55 (defvar navi2ch-offline-image nil)
57 (defun navi2ch-offline-init-icons ()
58 (let ((props (when (display-mouse-p)
59 (list 'local-map (purecopy (make-mode-line-mouse-map
60 'mouse-2 #'navi2ch-toggle-offline))
61 'help-echo "mouse-2 toggles offline mode"))))
62 (if (navi2ch-e21-display-image-p)
63 (progn
64 (unless navi2ch-online-image
65 (let ((load-path (cons navi2ch-icon-directory load-path)))
66 (setq navi2ch-online-image (find-image
67 `((:type xpm
68 :file ,navi2ch-online-icon
69 :ascent center)))
70 navi2ch-offline-image (find-image
71 `((:type xpm
72 :file ,navi2ch-offline-icon
73 :ascent center))))))
74 (setq navi2ch-modeline-online
75 (apply 'navi2ch-propertize navi2ch-online-indicator
76 `(display ,navi2ch-online-image ,@props))
77 navi2ch-modeline-offline
78 (apply 'navi2ch-propertize navi2ch-offline-indicator
79 `(display ,navi2ch-offline-image ,@props))))
80 (when props
81 (setq navi2ch-modeline-online
82 (apply 'navi2ch-propertize navi2ch-online-indicator props)
83 navi2ch-modeline-offline
84 (apply 'navi2ch-propertize navi2ch-offline-indicator props))))))
86 ;;; navi2ch-e21.el ends here