1 ;;; riece-emacs.el --- FSF Emacs specific functions
2 ;; Copyright (C) 1999 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
8 ;; This file is part of Riece.
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)
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.
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.
27 (defalias 'riece-set-case-syntax-pair
28 'set-case-syntax-pair)
30 (defalias 'riece-copy-case-table
33 ;;; stolen (and renamed) from gnus-ems.el.
34 ;;; In GNU Emacs, user can intercept whole mouse tracking events by
35 ;;; assigning [mouse-X]. In XEmacs, however, which causes different
36 ;;; effect, that is, the command assigned to [mouse-X] only catches
37 ;;; button-release events.
38 (defvar riece-mouse-2 [mouse-2])
40 ;;; popup-menu compatibility stuff, stolen (and renamed) from
42 (defmacro riece-popup-menu-bogus-filter-constructor (menu)
43 ;; #### Kludge for FSF Emacs-style menu.
44 (let ((bogus-menu (make-symbol "bogus-menu")))
45 `(let (,bogus-menu selection function)
46 (easy-menu-define ,bogus-menu nil nil ,menu)
47 (setq selection (x-popup-menu t ,bogus-menu))
49 (setq function (lookup-key ,bogus-menu (apply #'vector selection)))
50 ;; If a callback entry has no name, easy-menu wraps its value.
51 ;; See `easy-menu-make-symbol'.
52 (if (eq t (compare-strings "menu-function-" 0 nil
53 (symbol-name function) 0 14))
54 (car (last (symbol-function function)))
57 (defun riece-popup-menu-popup (menu event)
58 (let ((function (riece-popup-menu-bogus-filter-constructor menu)))
62 (defun riece-event-buffer (event)
63 "Return the buffer of the window over which mouse event EVENT occurred."
64 (window-buffer (posn-window (event-start event))))
66 (defun riece-event-point (event)
67 "Return the character position of the mouse event EVENT."
68 (posn-point (event-start event)))
70 ;;; stolen (and renamed) from gnus-ems.el.
71 (defun riece-region-active-p ()
72 "Say whether the region is active."
73 (and (boundp 'transient-mark-mode)
78 (defalias 'riece-make-overlay 'make-overlay)
79 (defalias 'riece-overlay-put 'overlay-put)
80 (defalias 'riece-overlay-start 'overlay-start)
81 (defalias 'riece-overlay-buffer 'overlay-buffer)
82 (defalias 'riece-overlays-in 'overlays-in)
83 (defalias 'riece-delete-overlay 'delete-overlay)
85 (defun riece-kill-all-overlays ()
86 "Delete all overlays in the current buffer."
87 (let* ((overlay-lists (overlay-lists))
88 (buffer-read-only nil)
89 (overlays (delq nil (nconc (car overlay-lists) (cdr overlay-lists)))))
91 (delete-overlay (car overlays))
92 (setq overlays (cdr overlays)))))
94 (defalias 'riece-run-at-time 'run-at-time)
95 (defalias 'riece-run-with-idle-timer 'run-with-idle-timer)
96 (defalias 'riece-cancel-timer 'cancel-timer)
98 (provide 'riece-emacs)
100 ;;; riece-emacs.el ends here