From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: Michael Albinus <michael.albinus@gmx.de>
Subject: Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp
Date: Sun, 04 Oct 2015 13:55:27 -0400 [thread overview]
Message-ID: <jwvlhbih68t.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <E1Zih21-0002Jx-Pv@vcs.savannah.gnu.org> (Michael Albinus's message of "Sun, 04 Oct 2015 11:00:42 +0000")
> + ;; `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."
next parent reply other threads:[~2015-10-04 17:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20151004110041.8886.52525@vcs.savannah.gnu.org>
[not found] ` <E1Zih21-0002Jx-Pv@vcs.savannah.gnu.org>
2015-10-04 17:55 ` Stefan Monnier [this message]
2015-10-04 18:12 ` [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp Michael Albinus
2015-10-05 1:06 ` Stefan Monnier
2015-10-18 8:13 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvlhbih68t.fsf-monnier+emacsdiffs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=michael.albinus@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.