Import Upstream version 20180207
[hcoop/debian/mlton.git] / ide / emacs / compat.el
CommitLineData
7f918cf1
CE
1;; Copyright (C) 2007-2008 Vesa Karvonen
2;;
3;; MLton is released under a BSD-style license.
4;; See the file MLton-LICENSE for details.
5
6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7;; Gnu Emacs / XEmacs compatibility workarounds
8
9(if (string-match "XEmacs" emacs-version)
10 (defun compat-replace-regexp-in-string (str regexp rep)
11 (replace-in-string str regexp rep t))
12 (defun compat-replace-regexp-in-string (str regexp rep)
13 (replace-regexp-in-string regexp rep str t t)))
14
15(if (string-match "XEmacs" emacs-version)
16 (defun compat-error (str &rest objs)
17 (error 'error (concat "Error: " (apply (function format) str objs) ".")))
18 (defalias 'compat-error (function error)))
19
20(if (string-match "XEmacs" emacs-version)
21 (defalias 'compat-add-local-hook (function add-local-hook))
22 (defun compat-add-local-hook (hook fn)
23 (add-hook hook fn nil t)))
24
25(if (string-match "XEmacs" emacs-version)
26 (defun compat-abbreviate-file-name (file)
27 (abbreviate-file-name file t))
28 (defalias 'compat-abbreviate-file-name (function abbreviate-file-name)))
29
30(if (string-match "XEmacs" emacs-version)
31 (defalias 'compat-delete-timer (function delete-itimer))
32 (defalias 'compat-delete-timer (function cancel-timer)))
33
34(if (string-match "XEmacs" emacs-version)
35 (defalias 'compat-read-file-name (function read-file-name))
36 (defun compat-read-file-name (&optional a b c d e f)
37 (funcall (function read-file-name) a b c d e)))
38
39(if (string-match "XEmacs" emacs-version)
40 (defalias 'compat-process-live-p (function process-live-p))
41 (defun compat-process-live-p (process)
42 (case (process-status process)
43 ((run stop) t))))
44
45(if (string-match "XEmacs" emacs-version)
46 (defun compat-compilation-parse-errors ()
47 (funcall compilation-parse-errors-function nil nil))
48 (defun compat-compilation-parse-errors ()
49 (compilation-compat-parse-errors (point-max))))
50
51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
52
53(provide 'compat)