tm 7.49.
[elisp/apel.git] / emu.el
1 ;;;
2 ;;; emu.el --- Emulation module for each Emacs variants
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; modified by Shuhei KOBAYASHI <shuhei@cmpt01.phys.tohoku.ac.jp>
9 ;;; Version:
10 ;;;     $Id: emu.el,v 7.5 1996/04/14 00:11:18 morioka Exp $
11 ;;; Keywords: emulation, compatibility, NEmacs, Mule, XEmacs
12 ;;;
13 ;;; This file is part of tl (Tiny Library).
14 ;;;
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.
19 ;;;
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.
24 ;;;
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.
28 ;;;
29 ;;; Code:
30
31 (defvar running-xemacs (string-match "XEmacs" emacs-version))
32
33 (cond ((boundp 'MULE)  (require 'emu-mule))
34       ((boundp 'NEMACS)(require 'emu-nemacs))
35       (t               (require 'emu-orig))
36       )
37
38 (defvar running-emacs-18 (<= emacs-major-version 18))
39 (defvar running-emacs-19 (and (not running-xemacs)
40                               (= emacs-major-version 19)))
41 (defvar running-emacs-19_29-or-later
42   (or (and running-emacs-19 (>= emacs-minor-version 29))
43       (>= emacs-major-version 20)))
44
45
46 ;;; @ Emacs 19.29 emulation
47 ;;;
48
49 (or (fboundp 'buffer-substring-no-properties)
50     (defun buffer-substring-no-properties (beg end)
51       "Return the text from BEG to END, without text properties, as a string."
52       (let ((string (buffer-substring beg end)))
53         (tl:set-text-properties 0 (length string) nil string)
54         string))
55     )
56
57 (cond ((or running-emacs-19_29-or-later running-xemacs)
58        ;; for Emacs 19.29 or later and XEmacs
59        (defalias 'tl:read-string 'read-string)
60        )
61       (t
62        ;; for Emacs 19.28 or earlier
63        (defun tl:read-string (prompt &optional initial-input history)
64          (read-string prompt initial-input)
65          )
66        ))
67
68
69 ;;; @ XEmacs emulation
70 ;;;
71
72 (or (fboundp 'functionp)
73     (defun functionp (obj)
74       "Returns t if OBJ is a function, nil otherwise.
75 \[emu.el; XEmacs emulating function]"
76       (or (subrp obj)
77           (byte-code-function-p obj)
78           (and (symbolp obj)(fboundp obj))
79           (and (consp obj)(eq (car obj) 'lambda))
80           ))
81     )
82         
83
84 ;;; @ end
85 ;;;
86
87 (provide 'emu)
88
89 ;;; emu.el ends here