;;; Code:
+(defmacro defvar-maybe (name &rest everything-else)
+ (or (and (boundp name)
+ (not (get name 'defvar-maybe))
+ )
+ (` (or (boundp (quote (, name)))
+ (progn
+ (defvar (, name) (,@ everything-else))
+ (put (quote (, name)) 'defvar-maybe t)
+ ))
+ )))
+
(defmacro defun-maybe (name &rest everything-else)
(or (and (fboundp name)
(not (get name 'defun-maybe))
;;; @ Emacs 19.30 emulation
;;;
-;; This function was imported Emacs 19.30.
+;; imported from Emacs 19.30.
(defun-maybe add-to-list (list-var element)
"Add to the value of LIST-VAR the element ELEMENT if it isn't there yet.
If you want to use `add-to-list' on a variable that is not defined
(get-buffer object)
(buffer-name (get-buffer object))))
-;; This macro was imported Emacs 19.33.
+;; imported from Emacs 19.33.
(defmacro-maybe save-selected-window (&rest body)
"Execute BODY, then select the window that was selected before BODY.
\[Emacs 19.31 emulating function]"
;;; @ Emacs 20.1 emulation
;;;
-;; This macro was imported Emacs 20.2.
+;; imported from Emacs 20.2.
(defmacro-maybe when (cond &rest body)
"(when COND BODY...): if COND yields non-nil, do BODY, else return nil."
(list 'if cond (cons 'progn body)))
-;; This macro was imported Emacs 20.3.
+;; imported from Emacs 20.3.
(defmacro-maybe unless (cond &rest body)
"(unless COND BODY...): if COND yields nil, do BODY, else return nil."
(cons 'if (cons cond (cons nil body))))
(progn (,@ body))
(set-buffer orig-buffer)))))
-;; This macro was imported Emacs 20.2.
+;; imported from Emacs 20.2.
(defmacro-maybe with-current-buffer (buffer &rest body)
"Execute the forms in BODY with BUFFER as the current buffer.
The value returned is the value of the last form in BODY.
(set-buffer (, buffer))
(,@ body))))
-;; This macro was imported Emacs 20.2.
+;; imported from Emacs 20.2.
(defmacro-maybe with-temp-file (file &rest forms)
"Create a new buffer, evaluate FORMS there, and write the buffer to FILE.
The value of the last form in FORMS is returned, like `progn'.
(and (buffer-name (, temp-buffer))
(kill-buffer (, temp-buffer))))))))
-;; This macro was imported Emacs 20.2.
+;; imported from Emacs 20.2.
(defmacro-maybe with-temp-buffer (&rest forms)
"Create a temporary buffer, and evaluate FORMS there like `progn'.
See also `with-temp-file' and `with-output-to-string'."
(and (buffer-name (, temp-buffer))
(kill-buffer (, temp-buffer))))))))
-;; This function was imported Emacs 20.3.
+;; imported from Emacs 20.3.
(defun-maybe last (x &optional n)
"Return the last link of the list X. Its car is the last element.
If X is nil, return nil.
(setq x (cdr x)))
x))
-;; This function was imported Emacs 20.3. (cl function)
+;; imported from Emacs 20.3. (cl function)
(defun-maybe butlast (x &optional n)
"Returns a copy of LIST with the last N elements removed."
(if (and n (<= n 0)) x
(nbutlast (copy-sequence x) n)))
-;; This function was imported Emacs 20.3. (cl function)
+;; imported from Emacs 20.3. (cl function)
(defun-maybe nbutlast (x &optional n)
"Modifies LIST to remove the last N elements."
(let ((m (length x)))
(if (> n 0) (setcdr (nthcdr (- (1- m) n) x) nil))
x))))
-;; This function was imported from XEmacs 21.
+;; imported from XEmacs 21.
(defun-maybe split-string (string &optional pattern)
"Return a list of substrings of STRING which are separated by PATTERN.
If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
;;; @ Emacs 20.3 emulation
;;;
+;; imported from Emacs 20.3.91.
+(defvar-maybe temporary-file-directory
+ (file-name-as-directory
+ (cond ((memq system-type '(ms-dos windows-nt))
+ (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp"))
+ ((memq system-type '(vax-vms axp-vms))
+ (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:"))
+ (t
+ (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp"))))
+ "The directory for writing temporary files.")
+
(defun-maybe line-beginning-position (&optional n)
"Return the character position of the first character on the current line.
With argument N not nil or 1, move forward N - 1 lines first.