Mercurial > emacs
diff lisp/net/tramp-compat.el @ 110374:932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
(tramp-compat-font-lock-add-keywords, tramp-compat-process-get)
(tramp-compat-process-put): New defuns.
* net/tramp.el (top):
* net/tramp-gvfs.el (top):
* net/tramp-cache.el (top): Use `tramp-compat-font-lock-add-keywords'.
* net/tramp.el (tramp-progress-reporter-update): Use
`tramp-compat-funcall.
* net/tramp.el (tramp-process-actions):
* net/tramp-gvfs.el (tramp-handle-vc-registered):
* net/tramp-sh.el (tramp-gvfs-handler-askquestion)
(tramp-get-remote-stat, tramp-get-remote-readlink): Use
`tramp-compat-with-temp-message'.
* net/tramp-sh.el (top): Require 'cl.
(tramp-handle-start-file-process): Use `tramp-compat-process-get'.
(tramp-open-connection-setup-interactive-shell): Use
`tramp-compat-process-put'.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Wed, 15 Sep 2010 22:27:11 +0200 |
parents | 4b26adbef9a2 |
children | 670fe38909f5 |
line wrap: on
line diff
--- a/lisp/net/tramp-compat.el Wed Sep 15 18:03:25 2010 +0000 +++ b/lisp/net/tramp-compat.el Wed Sep 15 22:27:11 2010 +0200 @@ -96,11 +96,6 @@ (defvar byte-compile-not-obsolete-vars nil)) (setq byte-compile-not-obsolete-vars '(directory-sep-char)) - ;; `with-temp-message' does not exists in XEmacs. - (condition-case nil - (with-temp-message (current-message) nil) - (error (defmacro with-temp-message (message &rest body) `(progn ,@body)))) - ;; For not existing functions, or functions with a changed argument ;; list, there are compiler warnings. We want to avoid them in ;; cases we know what we do. @@ -114,10 +109,6 @@ (unless (fboundp 'set-buffer-multibyte) (defalias 'set-buffer-multibyte 'ignore)) - ;; `font-lock-add-keywords' does not exist in XEmacs. - (unless (fboundp 'font-lock-add-keywords) - (defalias 'font-lock-add-keywords 'ignore)) - ;; The following functions cannot be aliases of the corresponding ;; `tramp-handle-*' functions, because this would bypass the locking ;; mechanism. @@ -190,6 +181,19 @@ 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards) (ad-activate 'file-expand-wildcards))))) +;; `with-temp-message' does not exists in XEmacs. +(if (fboundp 'with-temp-message) + (defalias 'tramp-compat-with-temp-message 'with-temp-message) + (defun tramp-compat-with-temp-message (message &rest body) + "Display MESSAGE temporarily if non-nil while BODY is evaluated." + `(progn ,@body))) + +;; `font-lock-add-keywords' does not exist in XEmacs. +(defun tramp-compat-font-lock-add-keywords (mode keywords &optional how) + "Add highlighting KEYWORDS for MODE." + (ignore-errors + (tramp-compat-funcall 'font-lock-add-keywords mode keywords how))) + (defsubst tramp-compat-line-beginning-position () "Return point at beginning of line (compat function). Calls `line-beginning-position' or `point-at-bol' if defined, else @@ -474,6 +478,18 @@ (setenv "UNIX95" unix95) result))))) +;; The following functions do not exist in XEmacs. We ignore this; +;; they are used for checking a remote tty. +(defun tramp-compat-process-get (process propname) + "Return the value of PROCESS' PROPNAME property. +This is the last value stored with `(process-put PROCESS PROPNAME VALUE)'." + (ignore-errors (tramp-compat-funcall 'process-get process propname))) + +(defun tramp-compat-process-put (process propname value) + "Change PROCESS' PROPNAME property to VALUE. +It can be retrieved with `(process-get PROCESS PROPNAME)'." + (ignore-errors (tramp-compat-funcall 'process-put process propname value))) + (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-compat 'force)))