bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: convince NTemacs it _can_ symlink


From: Andrew Innes
Subject: Re: convince NTemacs it _can_ symlink
Date: 18 Mar 2001 15:30:12 +0000
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

On Mon, 05 Mar 2001 12:10:56 -0500, Tom_Roche@ncsu.edu said:
>I now have TRAMP
>
>http://ls6-www.informatik.uni-dortmund.de/~grossjoh/emacs/tramp.html
>
>working on a vanilla 20.7.1 on w2k using plink
>
>http://www.chiark.greenend.org.uk/~sgtatham/putty/
>
><Key the brass band. Allow a moment to savor./> Among the thrills I
>now experience is running dired on my ssh-connected boxen. However,
>when I try to symlink, NTemacs becomes confused:
>
>>Symbol's function definition is void: make-symbolic-link
>
>presumably because it knows it can't do this ... on _its_ filesystem.
>So how do I make dired believe it can, when it's tramping about?

The problem is that `make-symbolic-link' is only compiled into Emacs if
the OS supports symlinks, which NT doesn't.  Unfortunately, that means
that tramp isn't able to install a handler for the operation, or rather
that handler won't ever be called.

It probably makes sense for all file functions that can invoke handlers
to always be defined, even if they have to throw an error on platforms
where the functionality cannot be supported natively, so that remote
file system packages like tramp and ange-ftp can still work.

As a work-around, you can define `make-symbolic-link' like so (untested):

(if (not (fboundp 'make-symbolic-link))
    (defun make-symbolic-link (filename linkname &optional ok-if-already-exists)
       "Make a symbolic link to FILENAME, named LINKNAME.  Both args strings.
Signals a `file-already-exists' error if a file LINKNAME already exists
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
A number as third arg means request confirmation if LINKNAME already exists.
This happens for interactive use with M-x."
        (interactive "FMake symbolic link to file: \nFMake symbolic link to 
file %s: \np")
        (let ((handler (find-file-name-handler filename 'make-symbolic-link)))
           (if handler
               (funcall handler 'make-symbolic-link
                        filename linkname ok-if-already-exists)
              (error "Cannot make symbolic link")))))

AndrewI




reply via email to

[Prev in Thread] Current Thread [Next in Thread]