;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: emu.el,v 7.40 1997/03/06 21:35:37 morioka Exp $
+;; Version: $Id: emu.el,v 7.48 1997/09/07 02:37:40 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))
)))
(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 (boundp name)
+ (not (get name 'defconst-maybe))
+ )
+ (` (or (boundp (quote (, name)))
+ (progn
+ (defconst (, name) (,@ everything-else))
+ (put (quote (, name)) 'defconst-maybe t)
+ ))
+ )))
+
-(or (boundp 'emacs-major-version)
- (defconst emacs-major-version (string-to-int emacs-version)))
-(or (boundp 'emacs-minor-version)
- (defconst emacs-minor-version
- (string-to-int
- (substring
- emacs-version
- (string-match (format "%d\\." emacs-major-version) emacs-version)
- ))))
+(defconst-maybe emacs-major-version (string-to-int emacs-version))
+(defconst-maybe emacs-minor-version
+ (string-to-int
+ (substring emacs-version
+ (string-match (format "%d\\." emacs-major-version)
+ emacs-version))))
(defvar running-emacs-18 (<= emacs-major-version 18))
(defvar running-xemacs (string-match "XEmacs" emacs-version))
(defun charsets-to-mime-charset (charsets)
"Return MIME charset from list of charset CHARSETS.
This function refers variable `charsets-mime-charset-alist'
-and `default-mime-charset'. [emu.el]"
+and `default-mime-charset'."
(if charsets
(or (catch 'tag
(let ((rest charsets-mime-charset-alist)
- cell csl)
+ cell)
(while (setq cell (car rest))
(if (catch 'not-subset
(let ((set1 charsets)
default-mime-charset)))
+;;; @ Emacs 19 emulation
+;;;
+
+(defun-maybe minibuffer-prompt-width ()
+ "Return the display width of the minibuffer prompt."
+ (save-excursion
+ (set-buffer (window-buffer (minibuffer-window)))
+ (current-column)
+ ))
+
+
;;; @ Emacs 19.29 emulation
;;;
(and (consp obj)(eq (car obj) 'lambda))
))
+(defun-maybe point-at-eol (&optional arg buffer)
+ "Return the character position of the last character on the current line.
+With argument N not nil or 1, move forward N - 1 lines first.
+If scan reaches end of buffer, return that position.
+This function does not move point. [XEmacs emulating function]"
+ (save-excursion
+ (if buffer
+ (set-buffer buffer)
+ )
+ (if arg
+ (forward-line (1- arg))
+ )
+ (end-of-line)
+ (point)
+ ))
+
;;; @ for XEmacs 20
;;;
(or (fboundp 'int-char)
(fset 'int-char (symbol-function 'identity))
)
+(or (fboundp 'char-or-char-int-p)
+ (fset 'char-or-char-int-p (symbol-function 'integerp))
+ )
;;; @ for text/richtext and text/enriched
;;;
-(cond ((or running-emacs-19_29-or-later running-xemacs-19_14-or-later)
+(cond ((fboundp 'richtext-decode)
+ ;; have richtext.el
+ )
+ ((or running-emacs-19_29-or-later running-xemacs-19_14-or-later)
;; have enriched.el
(autoload 'richtext-decode "richtext")
(or (assq 'text/richtext format-alist)