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 ;;; stolen (and renamed) from gnus-ems.el.
28 ;;; In GNU Emacs, user can intercept whole mouse tracking events by
29 ;;; assigning [mouse-X]. In XEmacs, however, which causes different
30 ;;; effect, that is, the command assigned to [mouse-X] only catches
31 ;;; button-release events.
32 (defvar riece-mouse-2 [mouse-2])
34 ;;; popup-menu compatibility stuff, stolen (and renamed) from
36 (defmacro riece-popup-menu-bogus-filter-constructor (menu)
37 ;; #### Kludge for FSF Emacs-style menu.
38 (let ((bogus-menu (make-symbol "bogus-menu")))
39 `(let (,bogus-menu selection function)
40 (easy-menu-define ,bogus-menu nil nil ,menu)
41 (setq selection (x-popup-menu t ,bogus-menu))
43 (setq function (lookup-key ,bogus-menu (apply #'vector selection)))
44 ;; If a callback entry has no name, easy-menu wraps its value.
45 ;; See `easy-menu-make-symbol'.
46 (if (eq t (compare-strings "menu-function-" 0 nil
47 (symbol-name function) 0 14))
48 (car (last (symbol-function function)))
51 (defun riece-popup-menu-popup (menu event)
52 (let ((function (riece-popup-menu-bogus-filter-constructor menu)))
56 (defun riece-event-buffer (event)
57 "Return the buffer of the window over which mouse event EVENT occurred."
58 (window-buffer (posn-window (event-start event))))
60 (defun riece-event-point (event)
61 "Return the character position of the mouse event EVENT."
62 (posn-point (event-start event)))
64 ;;; stolen (and renamed) from gnus-ems.el.
65 (defun riece-region-active-p ()
66 "Say whether the region is active."
67 (and (boundp 'transient-mark-mode)
72 (defalias 'riece-make-overlay 'make-overlay)
73 (defalias 'riece-overlay-put 'overlay-put)
74 (defalias 'riece-overlay-start 'overlay-start)
75 (defalias 'riece-overlay-buffer 'overlay-buffer)
76 (defalias 'riece-overlays-in 'overlays-in)
77 (defalias 'riece-delete-overlay 'delete-overlay)
79 (defun riece-kill-all-overlays ()
80 "Delete all overlays in the current buffer."
81 (let* ((overlay-lists (overlay-lists))
82 (buffer-read-only nil)
83 (overlays (delq nil (nconc (car overlay-lists) (cdr overlay-lists)))))
85 (delete-overlay (car overlays))
86 (setq overlays (cdr overlays)))))
88 (defalias 'riece-run-at-time 'run-at-time)
89 (defalias 'riece-run-with-idle-timer 'run-with-idle-timer)
90 (defalias 'riece-cancel-timer 'cancel-timer)
92 (defalias 'riece-match-string-no-properties 'match-string-no-properties)
94 (defun riece-propertize-modeline-string (string &rest properties)
95 (add-text-properties 0 (length string) properties string)
98 (defun riece-put-text-property-nonsticky (start end prop value
100 (add-text-properties start end
101 (list prop value 'front-sticky nil 'rear-nonsticky t)
104 (defalias 'riece-facep 'facep)
106 (provide 'riece-emacs)
108 ;;; riece-emacs.el ends here