From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp Date: Sun, 04 Oct 2015 13:55:27 -0400 Message-ID: References: <20151004110041.8886.52525@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443981349 4348 80.91.229.3 (4 Oct 2015 17:55:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 4 Oct 2015 17:55:49 +0000 (UTC) Cc: Michael Albinus To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 04 19:55:40 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZinVb-0005uk-MF for ged-emacs-devel@m.gmane.org; Sun, 04 Oct 2015 19:55:39 +0200 Original-Received: from localhost ([::1]:43274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZinVb-0005Nt-0U for ged-emacs-devel@m.gmane.org; Sun, 04 Oct 2015 13:55:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZinVW-0005Mv-FC for emacs-devel@gnu.org; Sun, 04 Oct 2015 13:55:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZinVR-0005zk-FX for emacs-devel@gnu.org; Sun, 04 Oct 2015 13:55:34 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:18194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZinVR-0005xt-9C for emacs-devel@gnu.org; Sun, 04 Oct 2015 13:55:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A5FgA731xV/3aQs2tcgxCEAoVVwD6CTQQCAoE8PBEBAQEBAQEBgQpBBYNdAQEEViMQCzAEEhQYDYhjzyMBAQEBBgIgizqEIhEBUQcYhBUFi0STU5IUg1kjhBQigT2BOwEBAQ X-IPAS-Result: A0A5FgA731xV/3aQs2tcgxCEAoVVwD6CTQQCAoE8PBEBAQEBAQEBgQpBBYNdAQEEViMQCzAEEhQYDYhjzyMBAQEBBgIgizqEIhEBUQcYhBUFi0STU5IUg1kjhBQigT2BOwEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="167396603" Original-Received: from 107-179-144-118.cpe.teksavvy.com (HELO pastel.home) ([107.179.144.118]) by ironport2-out.teksavvy.com with ESMTP; 04 Oct 2015 13:55:28 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id B70F16175A; Sun, 4 Oct 2015 13:55:27 -0400 (EDT) In-Reply-To: (Michael Albinus's message of "Sun, 04 Oct 2015 11:00:42 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:190894 Archived-At: > + ;; `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."