From: Michael Albinus <michael.albinus@gmx.de>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 31357@debbugs.gnu.org
Subject: bug#31357: 26.1; tramp-make-tramp-file-name: incompatible lisp changes in 26.1 ?
Date: Thu, 03 May 2018 17:26:11 +0200 [thread overview]
Message-ID: <87k1sksquk.fsf@gmx.de> (raw)
In-Reply-To: <0a062d8f1fea73fcead8cafe8f225378@webmail.orcon.net.nz>
Phil Sainty <psainty@orcon.net.nz> writes:
Hi Phil,
> In Emacs 25 `tramp-make-tramp-file-name' takes 4-5 arguments:
> (method user host localname &optional hop)
>
> In Emacs 26.1 it takes 6-7
> (method user domain host port localname &optional hop)
>
> That can then trigger a "wrong-number-of-arguments" error.
>
> This should surely be covered in NEWS under the "Incompatible Lisp
> Changes in Emacs 26.1" section?
`tramp-make-tramp-file-name' has never been documented as public
function, it is intended for internal use. Granted, this should have
been signalled better.
> I have custom code where I am presently using the following construct
> to deal with this.
>
> (if (version< emacs-version "26")
> (tramp-make-tramp-file-name
> method user host localname hop)
> (tramp-make-tramp-file-name
> method user domain host port localname hop))
>
> (With a consequential complaint from the 26.1 byte-compiler about
> the first of those two calls.)
That's the way to go. You could use (funcall 'tramp-make-tramp-file-name ...)
in order to make the byte compiler quiet.
However, I wouldn't check for emacs-version. Tramp exist as separate
package, and the recent Tramp 2.4 runs with all Emacs 24, 25, 26 and
27. You might check for tramp-version.
> Is there a single approach which is backwards-compatible (at least with
> Emacs 25) ?
No.
> For my specific use-case, what I really wanted was a way to modify only
> a specific named component of a tramp file name, but I ended up using
> `tramp-dissect-file-name', extracting the components with the various
> `tramp-file-name-COMPONENT' functions, and using `tramp-make-file-name'
> to put it all back together. I thought there might be a simpler way to
> do this, but I didn't see one.
Well, with Emacs 27 (Tramp 2.4) the function's signature has changed,
again. It is now (&rest ARGS). This is backwards compatible to Tramp 2.3
/ Emacs 26, that means (METHOD USER DOMAIN HOST PORT LOCALNAME &optional
HOP) still works. More interesting is the new signature, (VEC &optional
LOCALNAME HOP). Usually, you retrieve VEC by tramp-dissect-file-name, or
it is already provided as argument (many Tramp functions do so).
Then, most of the cases you want to change only the LOCALNAME, which you
could do directly in the function call. If you want to change another
component of VEC, you could do this via the access functions for the
tramp-file-name structure VEC, like
(setf (tramp-file-name-host vec) "whatever")
(tramp-make-tramp-file-name vec "/remote/dir")
So yes, if you want to support several Tramp versions, you must write
compatibility functions.
> -Phil
Best regards, Michael.
next prev parent reply other threads:[~2018-05-03 15:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 14:23 bug#31357: 26.1; tramp-make-tramp-file-name: incompatible lisp changes in 26.1 ? Phil Sainty
2018-05-03 15:26 ` Michael Albinus [this message]
2018-05-03 21:34 ` Phil Sainty
2018-05-04 7:44 ` 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=87k1sksquk.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=31357@debbugs.gnu.org \
--cc=psainty@orcon.net.nz \
/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.