Move `set-buffer-multibyte' to emu.el.
[elisp/apel.git] / emu.el
diff --git a/emu.el b/emu.el
index ea58c00..ebb93a2 100644 (file)
--- a/emu.el
+++ b/emu.el
@@ -1,9 +1,8 @@
 ;;; emu.el --- Emulation module for each Emacs variants
 
-;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: emu.el,v 7.46 1997/08/30 08:10:50 morioka Exp $
 ;; Keywords: emulation, compatibility, NEmacs, MULE, Emacs/mule, XEmacs
 
 ;; This file is part of emu.
               ))
         )))
 
+(defmacro defsubst-maybe (name &rest everything-else)
+  (or (and (fboundp name)
+          (not (get name 'defsubst-maybe))
+          )
+      (` (or (fboundp (quote (, name)))
+            (progn
+              (defsubst (, name) (,@ everything-else))
+              (put (quote (, name)) 'defsubst-maybe t)
+              ))
+        )))
+
 (defmacro defmacro-maybe (name &rest everything-else)
   (or (and (fboundp name)
           (not (get name 'defmacro-maybe))
@@ -48,6 +58,7 @@
         )))
 
 (put 'defun-maybe 'lisp-indent-function 'defun)
+(put 'defsubst-maybe 'lisp-indent-function 'defun)
 (put 'defmacro-maybe 'lisp-indent-function 'defun)
 
 (defmacro defconst-maybe (name &rest everything-else)
   (or (and running-xemacs-19 (>= emacs-minor-version 14))
       running-xemacs-20-or-later))
 
-(cond (running-mule-merged-emacs
-       ;; for mule merged EMACS
-       (require 'emu-e20)
+(cond (running-xemacs
+       ;; for XEmacs
+       (require 'emu-xemacs)
+       (cond ((featurep 'mule)
+             ;; for XEmacs with MULE
+             (require 'emu-20)
+             (require 'emu-x20)
+             )
+            (t
+             ;; for XEmacs without MULE
+             (require 'emu-latin1)
+             ))
        )
-      (running-xemacs-with-mule
-       ;; for XEmacs/mule
-       (require 'emu-x20)
+      (running-mule-merged-emacs
+       ;; for Emacs 20.1 and 20.2
+       (require 'emu-e20)
        )
       ((boundp 'MULE)
        ;; for MULE 1.* and 2.*
        (require 'emu-nemacs)
        )
       (t
-       ;; for EMACS 19 and XEmacs 19 (without mule)
+       ;; for Emacs 19
        (require 'emu-e19)
+       (require 'emu-latin1)
        ))
 
 
@@ -253,6 +274,32 @@ Value is nil if OBJECT is not a buffer or if it has been killed.
              (list 'select-window 'save-selected-window-window))))
 
 
+;;; @ Emacs 20.3 emulation
+;;;
+
+(defmacro-maybe string-as-unibyte (string)
+  "Return a unibyte string with the same individual bytes as STRING.
+If STRING is unibyte, the result is STRING itself.
+\[Emacs 20.3 emulating macro]"
+  string)
+
+(defmacro-maybe string-as-multibyte (string)
+  "Return a multibyte string with the same individual bytes as STRING.
+If STRING is multibyte, the result is STRING itself.
+\[Emacs 20.3 emulating macro]"
+  string)
+
+(defsubst-maybe set-buffer-multibyte (flag)
+  "Set the multibyte flag of the current buffer to FLAG.
+If FLAG is t, this makes the buffer a multibyte buffer.
+If FLAG is nil, this makes the buffer a single-byte buffer.
+The buffer contents remain unchanged as a sequence of bytes
+but the contents viewed as characters do change.
+\[Emacs 20.3 emulating function]"
+  (setq enable-multibyte-characters flag)
+  )
+
+
 ;;; @ XEmacs emulation
 ;;;