Initial revision
[riece] / lisp / riece-xemacs.el
1 ;;; riece-xemacs.el --- XEmacs specific functions
2 ;; Copyright (C) 1998-2003 Daiki Ueno
3
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Keywords: emulation
6
7 ;; This file is part of Riece.
8
9 ;; This program is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Code:
25
26 (require 'riece-compat)
27
28 (defun riece-xemacs-hide-modeline ()
29   "Remove modeline from current window."
30   (set-specifier has-modeline-p nil (current-buffer)))
31
32 (when (featurep 'scrollbar)
33   (defun riece-xemacs-hide-scrollbars ()
34     (if (boundp 'horizontal-scrollbar-visible-p)
35         (set-specifier horizontal-scrollbar-visible-p nil (current-buffer))
36       (if (boundp 'scrollbar-height)
37           (set-specifier scrollbar-height 0 (current-buffer)))))
38   (add-hook 'riece-user-list-mode-hook 'riece-xemacs-hide-scrollbars)
39   (add-hook 'riece-channel-list-mode-hook 'riece-xemacs-hide-scrollbars))
40
41 (add-hook 'riece-user-list-mode-hook 'riece-xemacs-hide-modeline)
42 (add-hook 'riece-channel-list-mode-hook 'riece-xemacs-hide-modeline)
43
44 (defun riece-xemacs-mode-line-buffer-identification (line)
45   "Decorate 1st element of `mode-line-buffer-identification' LINE.
46 Modify whole identification by side effect."
47   (let ((id (car line)) chop)
48     (if (and (stringp id) (string-match "^Riece:" id))
49         (progn
50           (setq chop (match-end 0))
51           (nconc
52            (list
53             (cons (copy-extent modeline-buffer-id-left-extent)
54                   (substring id 0 chop))
55             (cons (copy-extent modeline-buffer-id-right-extent)
56                   (substring id chop)))
57            (cdr line)))
58       line)))
59
60 (defun riece-xemacs-simplify-modeline-format ()
61   "Remove unnecessary information from `modeline-format'."
62   (setq modeline-format
63         (remrassq 'modeline-modified
64                   (delq 'modeline-multibyte-status
65                         (copy-sequence mode-line-format)))))
66
67 (defalias 'riece-mode-line-buffer-identification
68   'riece-xemacs-mode-line-buffer-identification)
69
70 (defalias 'riece-simplify-mode-line-format
71   'riece-xemacs-simplify-modeline-format)
72
73 (provide 'riece-xemacs)
74
75 ;;; riece-xemacs.el ends here