diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2017-10-03 16:15:08 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2017-10-03 16:15:08 +0200 |
commit | 92045f4546b9708dc9f69954799d211c1f56ff1e (patch) | |
tree | 3da042d305f9a7ef78c1ee9e49463f13db3900ba /src/fileio.c | |
parent | f204e6e1a418073bd1e24a83947f1f3c53581c7f (diff) | |
download | emacs-92045f4546b9708dc9f69954799d211c1f56ff1e.tar.gz |
Add file name handler support for file-system-info
* doc/lispref/files.texi (Magic File Names): Add file-system-info.
* etc/NEWS: Mention get-free-disk-space working on remote systems.
* lisp/files.el (get-free-disk-space): Do not block on remote systems.
* src/w32fns.c (Ffile_system_info):
* src/fileio.c (Ffile_system_info): Call file name handler if exists.
(syms_of_fileio): Add Qfile_system_info.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c index 11370279d1b..d460f123a82 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5789,6 +5789,18 @@ If the underlying system call fails, value is nil. */) (Lisp_Object filename) { Lisp_Object encoded = ENCODE_FILE (Fexpand_file_name (filename, Qnil)); + + /* If the file name has special constructs in it, + call the corresponding file handler. */ + Lisp_Object handler = Ffind_file_name_handler (encoded, Qfile_system_info); + if (!NILP (handler)) + { + Lisp_Object result = call2 (handler, Qfile_system_info, encoded); + if (CONSP (result) || NILP (result)) + return result; + error ("Invalid handler in `file-name-handler-alist'"); + } + struct fs_usage u; if (get_fs_usage (SSDATA (encoded), NULL, &u) != 0) return Qnil; @@ -5870,6 +5882,7 @@ syms_of_fileio (void) DEFSYM (Qwrite_region, "write-region"); DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); + DEFSYM (Qfile_system_info, "file-system-info"); /* The symbol bound to coding-system-for-read when insert-file-contents is called for recovering a file. This is not |