* Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp
[not found] ` <E1Zih21-0002Jx-Pv@vcs.savannah.gnu.org>
@ 2015-10-04 17:55 ` Stefan Monnier
2015-10-04 18:12 ` Michael Albinus
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2015-10-04 17:55 UTC (permalink / raw)
To: emacs-devel; +Cc: Michael Albinus
> + ;; `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."
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp
2015-10-04 17:55 ` [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp Stefan Monnier
@ 2015-10-04 18:12 ` Michael Albinus
2015-10-05 1:06 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2015-10-04 18:12 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> + ;; `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?
I've tried this first. XEmacs denies to cooperate.
>> +(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,
I'm just collecting my baggage for being offline for about a week. I'll
check when I'm back.
> Stefan
Best regards, Michael.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp
2015-10-04 18:12 ` Michael Albinus
@ 2015-10-05 1:06 ` Stefan Monnier
2015-10-18 8:13 ` Michael Albinus
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2015-10-05 1:06 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel
>>> + ;; `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?
> I've tried this first. XEmacs denies to cooperate.
In which sense does it deny to cooperate?
[ You do need to put the declaration in the file where it's used (rather
than in tramp-compat.el), of course. ]
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp
2015-10-05 1:06 ` Stefan Monnier
@ 2015-10-18 8:13 ` Michael Albinus
0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2015-10-18 8:13 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> Why not do
>>> (defvar directory-listing-before-filename-regexp)
>>> at top-level, which AFAIK works in all emacsen and is less harmful?
>> I've tried this first. XEmacs denies to cooperate.
>
> In which sense does it deny to cooperate?
> [ You do need to put the declaration in the file where it's used (rather
> than in tramp-compat.el), of course. ]
It works also with XEmacs. Don't know, how and why I did it wrong.
> Stefan
Best regards, Michael.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-18 8:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20151004110041.8886.52525@vcs.savannah.gnu.org>
[not found] ` <E1Zih21-0002Jx-Pv@vcs.savannah.gnu.org>
2015-10-04 17:55 ` [Emacs-diffs] master acfb5cd: Improve XEmacs compatibility of Tramp Stefan Monnier
2015-10-04 18:12 ` Michael Albinus
2015-10-05 1:06 ` Stefan Monnier
2015-10-18 8:13 ` Michael Albinus
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).