+;; `default-toplevel-value' has been declared in Emacs 24.
+(unless (fboundp 'default-toplevel-value)
+ (defalias 'default-toplevel-value 'symbol-value))
+
+;; ‘format-message’ is new in Emacs 25, and does not exist in XEmacs.
+;; The substitute implementation always uses grave quoting style, for
+;; compatibility with older Emacs.
+(unless (fboundp 'format-message)
+ (defalias 'format-message
+ (lambda (format-string &rest args)
+ (let ((restyled-format-string
+ (let ((start (string-match "[‘’]" format-string)))
+ (if start
+ (tramp-compat-replace-regexp-in-string
+ "[‘’]"
+ (lambda (match) (if (string-equal match "‘") "`" "'"))
+ format-string t t nil start)
+ format-string))))
+ (apply #'format restyled-format-string args)))))
+