[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp |
Date: |
Sun, 04 Oct 2015 13:55:27 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> + ;; `directory-listing-before-filename-regexp' does not exist in
> + ;; XEmacs. Since we use it only in tramp-adb.el, it doesn't harm to
> + ;; declare it here.
> + (unless (boundp 'directory-listing-before-filename-regexp)
> + (defvar directory-listing-before-filename-regexp nil))
Why not do
(defvar directory-listing-before-filename-regexp)
at top-level, which AFAIK works in all emacsen and is less harmful?
> +(autoload 'locate-dominating-file "files")
> +(autoload 'tramp-compat-replace-regexp-in-string "tramp-compat")
IIUC it's one of the best ways to silence the XEmacs byte-compiler, but
it's a bit dangerous. So I suggest the patch below instead,
Stefan
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 595e0ef..01481d6 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1030,8 +1030,7 @@ E.g. a host name \"192.168.1.1#5555\" returns
\"192.168.1.1:5555\"
;; unwanted entries first.
(tramp-flush-connection-property nil)
(with-tramp-connection-property (tramp-get-connection-process vec) "device"
- (let* ((method (tramp-file-name-method vec))
- (host (tramp-file-name-host vec))
+ (let* ((host (tramp-file-name-host vec))
(port (tramp-file-name-port vec))
(devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
(tramp-compat-replace-regexp-in-string
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index e645195..794e0f3 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -57,7 +57,6 @@
(require 'format-spec)
(require 'shell)
- (require 'trampver)
(require 'tramp-loaddefs)
;; As long as password.el is not part of (X)Emacs, it shouldn't be
@@ -212,6 +211,11 @@
(funcall ,bodysym)
,@handlers))))))
+(defmacro tramp-declare-function (f file)
+ (if (fboundp 'declare-function)
+ `(declare-function ,f ,file)
+ `(autoload ',f ,file)))
+
;; `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."
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 433b2ba..65dc51d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -515,7 +515,6 @@ as given in your `~/.profile'."
(const :tag "Private Directories" tramp-own-remote-path)
(string :tag "Directory"))))
-;;;###tramp-autoload
(defcustom tramp-remote-process-environment
`("TMOUT=0" "LC_CTYPE=''"
,(format "TERM=%s" tramp-terminal-type)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index df64f49..bc404e1 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -57,6 +57,7 @@
;;; Code:
(require 'tramp-compat)
+(require 'trampver)
;; Pacify byte-compiler.
(eval-when-compile
@@ -1178,8 +1179,7 @@ entry does not exist, return nil."
(defun tramp-file-name-port (vec)
"Return the port number of VEC."
(save-match-data
- (let ((method (tramp-file-name-method vec))
- (host (tramp-file-name-host vec)))
+ (let ((host (tramp-file-name-host vec)))
(or (and (stringp host)
(string-match tramp-host-with-port-regexp host)
(string-to-number (match-string 2 host)))
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 5c42f3a..b554879a 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -30,6 +30,8 @@
;; version check is defined in macro AC_EMACS_INFO of aclocal.m4;
;; should be changed only there.
+(require 'tramp-compat)
+
;;;###tramp-autoload
(defconst tramp-version "2.2.13-pre"
"This version of Tramp.")
@@ -39,8 +41,7 @@
"Email address to send bug reports to.")
;; `locate-dominating-file' does not exist in XEmacs. But it is not used here.
-(autoload 'locate-dominating-file "files")
-(autoload 'tramp-compat-replace-regexp-in-string "tramp-compat")
+(tramp-declare-function locate-dominating-file "files")
(defun tramp-repository-get-version ()
"Try to return as a string the repository revision of the Tramp sources."
- Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp,
Stefan Monnier <=