unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31357: 26.1; tramp-make-tramp-file-name: incompatible lisp changes in 26.1 ?
@ 2018-05-03 14:23 Phil Sainty
  2018-05-03 15:26 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Sainty @ 2018-05-03 14:23 UTC (permalink / raw)
  To: 31357

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?

I rather suspect there were also many other functions affected by
these changes, but I've not attempted to audit that.

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.)

Is there a single approach which is backwards-compatible (at least with
Emacs 25) ?

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.


-Phil




In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll 
bars)
  of 2018-04-15 built on shodan
Windowing system distributor 'The X.Org Foundation', version 
11.0.11804000
System Description:	Ubuntu 16.04.4 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark activated

Configured using:
  'configure --prefix=/home/phil/emacs/26.1rc1/usr/local
  --with-x-toolkit=lucid --without-sound'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK DBUS GSETTINGS NOTIFY
GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 THREADS
LCMS2

Important settings:
   value of $LANG: en_NZ.UTF-8
   locale-coding-system: utf-8

Major mode: Dired by name

Minor modes in effect:
   show-paren-mode: t
   minibuffer-depth-indicate-mode: t
   winner-mode: t
   global-hl-line-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   buffer-read-only: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils dired-x easymenu paren mb-depth winner
ring hl-line dired dired-loaddefs advice elec-pair time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 100308 9804)
  (symbols 48 20761 2)
  (miscs 40 101 271)
  (strings 32 30242 1161)
  (string-bytes 1 789994)
  (vectors 16 14561)
  (vector-slots 8 496928 9732)
  (floats 8 58 59)
  (intervals 56 269 7)
  (buffers 992 13)
  (heap 1024 44332 1473))






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31357: 26.1; tramp-make-tramp-file-name: incompatible lisp changes in 26.1 ?
  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
  2018-05-03 21:34   ` Phil Sainty
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2018-05-03 15:26 UTC (permalink / raw)
  To: Phil Sainty; +Cc: 31357

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31357: 26.1; tramp-make-tramp-file-name: incompatible lisp changes in 26.1 ?
  2018-05-03 15:26 ` Michael Albinus
@ 2018-05-03 21:34   ` Phil Sainty
  2018-05-04  7:44     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Sainty @ 2018-05-03 21:34 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 31357, bug-gnu-emacs

On 2018-05-04 03:26, Michael Albinus wrote:
> Phil Sainty <psainty@orcon.net.nz> writes:
>> 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.

Given the function naming, a NEWS entry seems warranted to me.

I do think that there *should* be a public interface for manipulating
tramp file names.  If these were never intended as such then perhaps
such functionality could be introduced...


> That's the way to go. You could use (funcall 
> 'tramp-make-tramp-file-name ...)
> in order to make the byte compiler quiet.

Perfect.

> 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.

Thanks; I've gone with this:

(apply
  #'tramp-make-tramp-file-name
  (if (version< tramp-version "2.3")
      (list method user host temp hop)
    (list method user domain host port temp hop)))

The changes in 2.4 sound good too.


> (setf (tramp-file-name-host vec) "whatever")

Ah, I'd actually tried that in 25.2 but those are not generalized
variables in that version.  I see that it works in 26.1 though,
so that's an excellent enhancement.


cheers,
-Phil







^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31357: 26.1; tramp-make-tramp-file-name: incompatible lisp changes in 26.1 ?
  2018-05-03 21:34   ` Phil Sainty
@ 2018-05-04  7:44     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2018-05-04  7:44 UTC (permalink / raw)
  To: Phil Sainty; +Cc: 31357, bug-gnu-emacs

Phil Sainty <psainty@orcon.net.nz> writes:

Hi Phil,

>> `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.
>
> Given the function naming, a NEWS entry seems warranted to me.

Well, this is a historical accident. None of the Tramp functions has
been indicated as internal (as a double slash in the function name would
do). This was already the case when I've entered the Tramp team back in
2002. And later on I resisted to perform a big renaming just for this.

> I do think that there *should* be a public interface for manipulating
> tramp file names.  If these were never intended as such then perhaps
> such functionality could be introduced...

Perhaps. These days, people dissect a remote file name by the different
calls of `file-remote-p', and reconstruct the file name by `concat' or
`format'. An public interface might help. But this won't be
`tramp-make-tramp-file-name', because this is the internal working
horse, which will always be adapted to whatever need arrives in Tramp.

Maybe you could propose such a public interface? It shouldn't be Tramp
specific, other file name handlers shall profit from this as well. And
local file names as arguments shall also be possible, so that you could
change a local file name into a remote file name by a simple call (think
about the common case changing a local file name into a sudo'ed one).

See also function `file-local-name' (introduced in Emacs 26.1), which
could be part of such broader interface.

>> (setf (tramp-file-name-host vec) "whatever")
>
> Ah, I'd actually tried that in 25.2 but those are not generalized
> variables in that version.  I see that it works in 26.1 though,
> so that's an excellent enhancement.

Well, `tramp-file-name' has been introduced as defstruct in Tramp
2.3. Before, there was no dedicated type, and VEC was always a, hmm,
simple vector.

> cheers,
> -Phil

Best regards, Michael.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-04  7:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-05-03 21:34   ` Phil Sainty
2018-05-04  7:44     ` 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).