1 ;;; sml-compat.el --- Compatibility functions for Emacs variants for sml-mode
3 ;; Copyright (C) 1999-2000 Stefan Monnier <monnier@cs.yale.edu>
5 ;; This program is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 2 of the License, or
8 ;; (at your option) any later version.
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program; if not, write to the Free Software
17 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 (unless (fboundp 'set-keymap-parents)
24 (defun set-keymap-parents (m parents)
25 (if (keymapp parents) (setq parents (list parents)))
29 (reduce (lambda (m1 m2)
30 (let ((m (copy-keymap m1)))
31 (set-keymap-parent m m2) m))
37 (when (and (not (boundp 'temporary-file-directory)) (fboundp 'temp-directory))
38 (defvar temporary-file-directory (temp-directory)))
40 (unless (fboundp 'make-temp-file)
41 ;; Copied from Emacs-21's subr.el
42 (defun make-temp-file (prefix &optional dir-flag)
43 "Create a temporary file.
44 The returned file name (created by appending some random characters at the end
45 of PREFIX, and expanding against `temporary-file-directory' if necessary,
46 is guaranteed to point to a newly created empty file.
47 You can then use `write-region' to write new data into the file.
49 If DIR-FLAG is non-nil, create a new empty directory instead of a file."
51 (while (condition-case ()
55 (expand-file-name prefix temporary-file-directory)))
58 (write-region "" nil file nil 'silent nil 'excl))
60 (file-already-exists t))
61 ;; the file was somehow created by someone else between
62 ;; `make-temp-name' and `write-region', let's try again.
69 ;;; sml-compat.el ends here