comparison lisp/hm--html-menus/adapt.el @ 46:6a22abad6937 r19-15

Import from CVS: tag r19-15
author cvs
date Mon, 13 Aug 2007 08:55:31 +0200
parents 8fc7fe29b841
children 131b0175ea99
comparison
equal deleted inserted replaced
45:7705b7aa3b8a 46:6a22abad6937
1 ;;; $Id: adapt.el,v 1.2 1997/02/16 01:29:07 steve Exp $ 1 ;;; $Id: adapt.el,v 1.3 1997/03/26 22:42:37 steve Exp $
2 ;;; 2 ;;;
3 ;;; Copyright (C) 1993, 1994, 1995 Heiko Muenkel 3 ;;; Copyright (C) 1993 - 1997 Heiko Muenkel
4 ;;; email: muenkel@tnt.uni-hannover.de 4 ;;; email: muenkel@tnt.uni-hannover.de
5 ;;; 5 ;;;
6 ;;; This program is free software; you can redistribute it and/or modify 6 ;;; This program is free software; you can redistribute it and/or modify
7 ;;; it under the terms of the GNU General Public License as published by 7 ;;; it under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 2, or (at your option) 8 ;;; the Free Software Foundation; either version 2, or (at your option)
18 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ;;; 19 ;;;
20 ;;; 20 ;;;
21 ;;; Description: 21 ;;; Description:
22 ;;; 22 ;;;
23 ;;; General functions to port Lucid Emacs to GNU Emacs 19. 23 ;;; General functions to port XEmacs functions to GNU Emacs 19.
24 ;;; 24 ;;;
25 ;;; Installation: 25 ;;; Installation:
26 ;;; 26 ;;;
27 ;;; Put this file in one of your lisp load directories. 27 ;;; Put this file in one of your lisp load directories.
28 ;;; 28 ;;;
45 "Returns non nil if the editor is the GNU Emacs 19." 45 "Returns non nil if the editor is the GNU Emacs 19."
46 (and 46 (and
47 (not (adapt-xemacsp)) 47 (not (adapt-xemacsp))
48 (string= (substring emacs-version 0 2) "19"))) 48 (string= (substring emacs-version 0 2) "19")))
49 49
50 ;;; Functions, which doesn't exist in both emacses 50 ;;; Functions, which don't exist in both emacs versions
51 51
52 (defun adapt-region-active-p () 52 (defun adapt-region-active-p ()
53 "Returns t, if a region is active." 53 "Returns t, if a region is active."
54 (if (adapt-xemacsp) 54 (if (adapt-xemacsp)
55 (mark) 55 (mark)
56 mark-active)) 56 mark-active))
57 57
58 58 (if (not (fboundp 'file-remote-p))
59 (defun file-remote-p (file)
60 "Test wether file resides on the local system.
61 The special value 'unknown is returned if no remote file acess package
62 has been loaded."
63 (if (not (featurep 'ange-ftp))
64 (require 'ange-ftp))
65 (if (not (fboundp 'ange-ftp-ftp-p))
66 nil ; better than nothing, if no ange-ftp-ftp-p exists
67 (ange-ftp-ftp-path file))))
68
69
70 ;;; Functions, which don't exist in the Emacs 19
59 (if (adapt-emacs19p) 71 (if (adapt-emacs19p)
60 (progn 72 (progn
61 (load-library "lucid") 73 (load-library "lucid")
62 74
63 (load-library "lmenu") 75 (load-library "lmenu")
236 (defun button-release-event-p (obj) 248 (defun button-release-event-p (obj)
237 "True if OBJ is a mouse-button-release event object." 249 "True if OBJ is a mouse-button-release event object."
238 (and (button-event-p obj) 250 (and (button-event-p obj)
239 (not (button-press-event-p obj))))) 251 (not (button-press-event-p obj)))))
240 252
253 (if (not (fboundp 'button-click-event-p))
254 (defun button-click-event-p (obj)
255 "True if OBJ is a click event obkect."
256 ;; only for the Emacs 19
257 ;; doesn't exist and can't (?) exist in the XEmacs
258 (and (button-event-p obj)
259 (member 'click (event-modifiers obj)))))
260
261 (if (not (fboundp 'mouse-event-p))
262 (defun mouse-event-p (obj)
263 "True if OBJ is a button-press, button-release, or mouse-motion event object."
264 (or (button-event-p obj)
265 (member 'drag (event-modifiers obj)))))
266
241 (if (not (fboundp 'event-window)) 267 (if (not (fboundp 'event-window))
242 (defun event-window (event) 268 (defun event-window (event)
243 "Return the window of the given mouse event. 269 "Return the window of the given mouse event.
244 This may be nil if the event occurred in the border or over a toolbar. 270 This may be nil if the event occurred in the border or over a toolbar.
245 The modeline is considered to be in the window it represents." 271 The modeline is considered to be in the window it represents."
314 ) 340 )
315 341
316 (if (not (fboundp 'redraw-modeline)) 342 (if (not (fboundp 'redraw-modeline))
317 (defalias 'redraw-modeline 'force-mode-line-update)) 343 (defalias 'redraw-modeline 'force-mode-line-update))
318 344
345 (if (not (fboundp 'mouse-track))
346 (defalias 'mouse-track 'mouse-drag-region))
347
319 )) 348 ))
320 349
321 350
322 (provide 'adapt) 351 (provide 'adapt)