f884117f0d8f464a61c9c06967a1c3c4fce8b1c0
[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 (defun riece-xemacs-hide-modeline ()
27   "Remove modeline from current window."
28   (set-specifier has-modeline-p nil (current-buffer)))
29
30 (when (featurep 'scrollbar)
31   (defun riece-xemacs-hide-scrollbars ()
32     (if (boundp 'horizontal-scrollbar-visible-p)
33         (set-specifier horizontal-scrollbar-visible-p nil (current-buffer))
34       (if (boundp 'scrollbar-height)
35           (set-specifier scrollbar-height 0 (current-buffer)))))
36   (add-hook 'riece-user-list-mode-hook 'riece-xemacs-hide-scrollbars)
37   (add-hook 'riece-channel-list-mode-hook 'riece-xemacs-hide-scrollbars))
38
39 (add-hook 'riece-user-list-mode-hook 'riece-xemacs-hide-modeline)
40 (add-hook 'riece-channel-list-mode-hook 'riece-xemacs-hide-modeline)
41
42 (defun riece-xemacs-mode-line-buffer-identification (line)
43   "Decorate 1st element of `mode-line-buffer-identification' LINE.
44 Modify whole identification by side effect."
45   (let ((id (car line)) chop)
46     (if (and (stringp id) (string-match "^Riece:" id))
47         (progn
48           (setq chop (match-end 0))
49           (nconc
50            (list
51             (cons (copy-extent modeline-buffer-id-left-extent)
52                   (substring id 0 chop))
53             (cons (copy-extent modeline-buffer-id-right-extent)
54                   (substring id chop)))
55            (cdr line)))
56       line)))
57
58 (defun riece-xemacs-simplify-modeline-format ()
59   "Remove unnecessary information from `modeline-format'."
60   (setq modeline-format
61         (remrassq 'modeline-modified
62                   (delq 'modeline-multibyte-status
63                         (copy-sequence mode-line-format)))))
64
65 (defalias 'riece-mode-line-buffer-identification
66   'riece-xemacs-mode-line-buffer-identification)
67
68 (defalias 'riece-simplify-mode-line-format
69   'riece-xemacs-simplify-modeline-format)
70
71 (defalias 'riece-set-case-syntax-pair
72   'put-case-table-pair)
73
74 ;;; stolen (and renamed) from gnus-xmas.el.
75 ;;; In GNU Emacs, user can intercept whole mouse tracking events by
76 ;;; assigning [mouse-X].  In XEmacs, however, which causes different
77 ;;; effect, that is, the command assigned to [mouse-X] only catches
78 ;;; button-release events.
79 (defvar riece-mouse-2 [button2])
80
81 ;;; popup-menu compatibility stuff, stolen (and renamed) from
82 ;;; semi-def.el.
83 (defun riece-popup-menu-popup (menu event)
84   (let ((response (get-popup-menu-response menu event)))
85     (if response
86         (funcall (event-function response) (event-object response)))))
87
88 (defalias 'riece-event-buffer 'event-buffer)
89 (defalias 'riece-event-point 'event-point)
90
91 ;;; stolen (and renamed) from gnus-xmas.el.
92 (defalias 'riece-region-active-p 'region-active-p)
93
94 (provide 'riece-xemacs)
95
96 ;;; riece-xemacs.el ends here