This commit was generated by cvs2svn to compensate for changes in r453,
[elisp/apel.git] / emu.el
diff --git a/emu.el b/emu.el
index c460ebc..3a7d971 100644 (file)
--- a/emu.el
+++ b/emu.el
@@ -3,8 +3,8 @@
 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: emu.el,v 7.24 1996/09/04 15:49:30 morioka Exp $
-;; Keywords: emulation, compatibility, NEmacs, Mule, XEmacs
+;; Version: $Id: emu.el,v 7.34 1996/09/23 17:42:26 morioka Exp $
+;; Keywords: emulation, compatibility, NEmacs, MULE, XEmacs
 
 ;; This file is part of tl (Tiny Library).
 
@@ -19,8 +19,8 @@
 ;; General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING.  If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
 ;;; Code:
 
 (defvar running-emacs-18 (<= emacs-major-version 18))
 (defvar running-xemacs (string-match "XEmacs" emacs-version))
+
+(defvar running-mule-merged-emacs (and (not (boundp 'MULE))
+                                      (not running-xemacs) (featurep 'mule)))
+(defvar running-xemacs-with-mule (and running-xemacs (featurep 'mule)))
+
+(defvar running-emacs-19 (and (not running-xemacs) (= emacs-major-version 19)))
+(defvar running-emacs-19_29-or-later
+  (or (and running-emacs-19 (>= emacs-minor-version 29))
+      (and (not running-xemacs)(>= emacs-major-version 20))))
+
 (defvar running-xemacs-19 (and running-xemacs
                               (= emacs-major-version 19)))
-(defvar running-xemacs-20 (and running-xemacs
-                              (= emacs-major-version 20)))
 (defvar running-xemacs-20-or-later (and running-xemacs
                                        (>= emacs-major-version 20)))
 (defvar running-xemacs-19_14-or-later
   (or (and running-xemacs-19 (>= emacs-minor-version 14))
       running-xemacs-20-or-later))
-(defvar running-emacs-19 (and (not running-xemacs)
-                             (= emacs-major-version 19)))
-(defvar running-emacs-19_29-or-later
-  (or (and running-emacs-19 (>= emacs-minor-version 29))
-      (and (not running-xemacs)(>= emacs-major-version 20))))
 
-(cond ((boundp 'MULE)
-       (require 'emu-mule)
+(cond (running-mule-merged-emacs
+       ;; for mule merged EMACS
+       (require 'emu-e20)
        )
-      ((and running-xemacs-20 (featurep 'mule))
+      (running-xemacs-with-mule
+       ;; for XEmacs/mule
        (require 'emu-x20)
        )
+      ((boundp 'MULE)
+       ;; for MULE 1.* and 2.*
+       (require 'emu-mule)
+       )
       ((boundp 'NEMACS)
+       ;; for NEmacs and NEpoch
        (require 'emu-nemacs)
        )
       (t
+       ;; for EMACS 19 and XEmacs 19 (without mule)
        (require 'emu-e19)
        ))
 
 
+;;; @ binary access
+;;;
+
+(defun insert-binary-file-contents-literally
+  (filename &optional visit beg end replace)
+  "Like `insert-file-contents-literally', q.v., but don't code conversion.
+A buffer may be modified in several ways after reading into the buffer due
+to advanced Emacs features, such as file-name-handlers, format decoding,
+find-file-hooks, etc.
+  This function ensures that none of these modifications will take place.
+\[emu.el]"
+  (as-binary-input-file
+   (insert-file-contents-literally filename visit beg end replace)
+   ))
+
+
 ;;; @ MIME charset
 ;;;
 
@@ -100,6 +127,9 @@ and `default-mime-charset'. [emu.el]"
 ;;; @ EMACS 19.29 emulation
 ;;;
 
+(defvar path-separator ":"
+  "Character used to separate concatenated paths.")
+
 (or (fboundp 'buffer-substring-no-properties)
     (defun buffer-substring-no-properties (beg end)
       "Return the text from BEG to END, without text properties, as a string.
@@ -138,20 +168,55 @@ into a hook function that will be run only after loading the package.
     )
 
 
-;;; @ EMACS 19.32 emulation
+;;; @ EMACS 19.30 emulation
+;;;
+
+(cond ((fboundp 'insert-file-contents-literally)
+       )
+      ((boundp 'file-name-handler-alist)
+       (defun insert-file-contents-literally
+        (filename &optional visit beg end replace)
+        "Like `insert-file-contents', q.v., but only reads in the file.
+A buffer may be modified in several ways after reading into the buffer due
+to advanced Emacs features, such as file-name-handlers, format decoding,
+find-file-hooks, etc.
+  This function ensures that none of these modifications will take place.
+\[emu.el; Emacs 19.30 emulating function]"
+        (let (file-name-handler-alist)
+          (insert-file-contents filename visit beg end replace)
+          ))
+       )
+      (t
+       (defalias 'insert-file-contents-literally 'insert-file-contents)
+       ))
+
+
+;;; @ EMACS 19.31 emulation
 ;;;
 
 (or (fboundp 'buffer-live-p)
     (defun buffer-live-p (object)
       "Return non-nil if OBJECT is a buffer which has not been killed.
 Value is nil if OBJECT is not a buffer or if it has been killed.
-\[emu.el; EMACS 19.32 emulating function]"
+\[emu.el; EMACS 19.31 emulating function]"
       (and object
           (get-buffer object)
           (buffer-name (get-buffer object))
           ))
     )
 
+(or (fboundp 'save-selected-window)
+    ;; This function was imported Emacs 19.33.
+    (defmacro save-selected-window (&rest body)
+      "Execute BODY, then select the window that was selected before BODY.
+\[emu.el; EMACS 19.31 emulating function]"
+      (list 'let
+           '((save-selected-window-window (selected-window)))
+           (list 'unwind-protect
+                 (cons 'progn body)
+                 (list 'select-window 'save-selected-window-window)))) 
+    )
+
 
 ;;; @ XEmacs emulation
 ;;;