Re: Suggestion for efs
Denis Howe (dbh@doc.ic.ac.uk)
Wed, 10 Aug 94 12:39:36 BST
Jost Krieger asked:
> Would it be possible to support cross-machine symbolic links?
> What I have in mind is a directory like the following:
>
> /home/x920031/efstars:
> total 24
> drwxr-xr-x 2 x920031 AB2 512 Aug 10 12:19 .
> drwxr-xr-x 185 x920031 other 22528 Aug 10 12:18 ..
> lrwxrwxrwx 1 x920031 AB2 49 Aug 10 12:19 aria-drivers -> /ftp@ftp.wi.leidenuniv.nl:/pub/audio/aria/drivers
You can almost achieve this with my function find-file-at-point:
(defun find-file-at-point (arg)
"Find the file named around or before point.
Pass the name it to find-file as initial input. A file name is
assumed to consist of alphanumerics and [/.-:@].
With a prefix argument, look for a hostname at point, consisting of
alphanumerics and [.-@]. Add '/' before and ':' after to form an efs
remote file name for that host's top directory."
(interactive "P")
(find-file-read (if arg (concat "/" (hostname-at-point) ":")
(word-at-point "-._/:~@"))))
(defun word-at-point (&optional chars)
"Return the word the point is on or after. If there is no word at or
before point, the empty string is returned. Optional argument CHARS
is a string of characters to consider as part of a word in addition to
those in the syntax class 'w'."
(let ((wordre "\\<\\w+"))
(save-syntax-excursion
(mapcar (function (lambda (char) (modify-syntax-entry char "w"))) chars)
(looking-at "") ; Empty match data
(save-excursion
(or (looking-at wordre)
(and (not (bobp))
(re-search-backward wordre nil t)
(looking-at wordre)))))) ; Look again to set match-end
(buffer-substring (match-beginning 0) (match-end 0)))
(defun hostname-at-point ()
"Return the Internet host name at or before point."
(let ((host (word-at-point ".-")))
(if (equal (last host) ?.) (init-string host) host)))
(defun find-file-read (file)
"Prompt for the name of a file to load with FILE as the initial
minibuffer contents."
(find-file-other-window (read-file-name "Find file: " file file)))
I believe "hyperbole"(?) does something similar and much more but I've
never investigated.
--
Denis Howe <dbh@doc.ic.ac.uk>
Free On-Line Dictionary of Computing
WWW URL http://wombat.doc.ic.ac.uk/