a22ecac845d61a944cb7625d88d4e8c9202ae827
[riece] / lisp / riece-emacs.el
1 ;;; riece-emacs.el --- FSF Emacs specific functions
2 ;; Copyright (C) 1999 Daiki Ueno
3
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Created: 1999-08-21
6 ;; Keywords: emulation
7
8 ;; This file is part of Riece.
9
10 ;; This program 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.
14
15 ;; This program 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.
19
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 the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Code:
26
27 (defalias 'riece-set-case-syntax-pair
28   'set-case-syntax-pair)
29
30 ;;; stolen (and renamed) from gnus-ems.el.
31 ;;; In GNU Emacs, user can intercept whole mouse tracking events by
32 ;;; assigning [mouse-X].  In XEmacs, however, which causes different
33 ;;; effect, that is, the command assigned to [mouse-X] only catches
34 ;;; button-release events.
35 (defvar riece-mouse-2 [mouse-2])
36
37 ;;; popup-menu compatibility stuff, stolen (and renamed) from
38 ;;; semi-def.el.
39 (defmacro riece-popup-menu-bogus-filter-constructor (menu)
40   ;; #### Kludge for FSF Emacs-style menu.
41   (let ((bogus-menu (make-symbol "bogus-menu")))
42     `(let (,bogus-menu selection function)
43        (easy-menu-define ,bogus-menu nil nil ,menu)
44        (setq selection (x-popup-menu t ,bogus-menu))
45        (when selection
46          (setq function (lookup-key ,bogus-menu (apply #'vector selection)))
47          ;; If a callback entry has no name, easy-menu wraps its value.
48          ;; See `easy-menu-make-symbol'.
49          (if (eq t (compare-strings "menu-function-" 0 nil
50                                     (symbol-name function) 0 14))
51              (car (last (symbol-function function)))
52            function)))))
53
54 (defun riece-popup-menu-popup (menu event)
55   (let ((function (riece-popup-menu-bogus-filter-constructor menu)))
56     (if function
57         (funcall function))))
58
59 (defun riece-event-buffer (event)
60   "Return the buffer of the window over which mouse event EVENT occurred."
61   (window-buffer (posn-window (event-start event))))
62
63 (defun riece-event-point (event)
64   "Return the character position of the mouse event EVENT."
65   (posn-point (event-start event)))
66
67 ;;; stolen (and renamed) from gnus-ems.el.
68 (defun riece-region-active-p ()
69   "Say whether the region is active."
70   (and (boundp 'transient-mark-mode)
71        transient-mark-mode
72        (boundp 'mark-active)
73        mark-active))
74
75 (defalias 'riece-make-overlay 'make-overlay)
76 (defalias 'riece-overlay-put 'overlay-put)
77 (defalias 'riece-overlay-start 'overlay-start)
78 (defalias 'riece-overlay-buffer 'overlay-buffer)
79
80 (defalias 'riece-run-at-time 'run-at-time)
81
82 (provide 'riece-emacs)
83
84 ;;; riece-emacs.el ends here