2 ;;; emu.el --- Emulation module for each Emacs variants
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; modified by Shuhei KOBAYASHI <shuhei@cmpt01.phys.tohoku.ac.jp>
10 ;;; $Id: emu.el,v 7.8 1996/04/24 00:13:31 morioka Exp $
11 ;;; Keywords: emulation, compatibility, NEmacs, Mule, XEmacs
13 ;;; This file is part of tl (Tiny Library).
15 ;;; This program is free software; you can redistribute it and/or
16 ;;; modify it under the terms of the GNU General Public License as
17 ;;; published by the Free Software Foundation; either version 2, or
18 ;;; (at your option) any later version.
20 ;;; This program is distributed in the hope that it will be useful,
21 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 ;;; General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with This program. If not, write to the Free Software
27 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
31 (or (boundp 'emacs-major-version)
32 (defconst emacs-major-version (string-to-int emacs-version)))
34 (defvar running-emacs-18 (<= emacs-major-version 18))
35 (defvar running-xemacs (string-match "XEmacs" emacs-version))
36 (defvar running-xemacs-20 (and running-xemacs
37 (>= emacs-major-version 20)))
38 (defvar running-emacs-19 (and (not running-xemacs)
39 (= emacs-major-version 19)))
40 (defvar running-emacs-19_29-or-later
41 (or (and running-emacs-19 (>= emacs-minor-version 29))
42 (>= emacs-major-version 20)))
44 (cond ((boundp 'MULE) (require 'emu-mule))
45 ((boundp 'NEMACS)(require 'emu-nemacs))
46 (t (require 'emu-orig))
50 ;;; @ Emacs 19.29 emulation
53 (or (fboundp 'buffer-substring-no-properties)
54 (defun buffer-substring-no-properties (beg end)
55 "Return the text from BEG to END, without text properties, as a string."
56 (let ((string (buffer-substring beg end)))
57 (tl:set-text-properties 0 (length string) nil string)
61 (cond ((or running-emacs-19_29-or-later running-xemacs)
62 ;; for Emacs 19.29 or later and XEmacs
63 (defalias 'tl:read-string 'read-string)
66 ;; for Emacs 19.28 or earlier
67 (defun tl:read-string (prompt &optional initial-input history)
68 (read-string prompt initial-input)
73 ;;; @ XEmacs emulation
76 (or (fboundp 'functionp)
77 (defun functionp (obj)
78 "Returns t if OBJ is a function, nil otherwise.
79 \[emu.el; XEmacs emulating function]"
81 (byte-code-function-p obj)
82 (and (symbolp obj)(fboundp obj))
83 (and (consp obj)(eq (car obj) 'lambda))
91 (or (fboundp 'char-int)
92 (fset 'char-int (symbol-function 'identity))
94 (or (fboundp 'int-char)
95 (fset 'int-char (symbol-function 'identity))