diff options
| author | Michael Albinus | 2017-10-03 16:15:08 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-10-03 16:15:08 +0200 |
| commit | 92045f4546b9708dc9f69954799d211c1f56ff1e (patch) | |
| tree | 3da042d305f9a7ef78c1ee9e49463f13db3900ba /src | |
| parent | f204e6e1a418073bd1e24a83947f1f3c53581c7f (diff) | |
| download | emacs-92045f4546b9708dc9f69954799d211c1f56ff1e.tar.gz emacs-92045f4546b9708dc9f69954799d211c1f56ff1e.zip | |
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')
| -rw-r--r-- | src/fileio.c | 13 | ||||
| -rw-r--r-- | src/w32fns.c | 11 |
2 files changed, 24 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. */) | |||
| 5789 | (Lisp_Object filename) | 5789 | (Lisp_Object filename) |
| 5790 | { | 5790 | { |
| 5791 | Lisp_Object encoded = ENCODE_FILE (Fexpand_file_name (filename, Qnil)); | 5791 | Lisp_Object encoded = ENCODE_FILE (Fexpand_file_name (filename, Qnil)); |
| 5792 | |||
| 5793 | /* If the file name has special constructs in it, | ||
| 5794 | call the corresponding file handler. */ | ||
| 5795 | Lisp_Object handler = Ffind_file_name_handler (encoded, Qfile_system_info); | ||
| 5796 | if (!NILP (handler)) | ||
| 5797 | { | ||
| 5798 | Lisp_Object result = call2 (handler, Qfile_system_info, encoded); | ||
| 5799 | if (CONSP (result) || NILP (result)) | ||
| 5800 | return result; | ||
| 5801 | error ("Invalid handler in `file-name-handler-alist'"); | ||
| 5802 | } | ||
| 5803 | |||
| 5792 | struct fs_usage u; | 5804 | struct fs_usage u; |
| 5793 | if (get_fs_usage (SSDATA (encoded), NULL, &u) != 0) | 5805 | if (get_fs_usage (SSDATA (encoded), NULL, &u) != 0) |
| 5794 | return Qnil; | 5806 | return Qnil; |
| @@ -5870,6 +5882,7 @@ syms_of_fileio (void) | |||
| 5870 | DEFSYM (Qwrite_region, "write-region"); | 5882 | DEFSYM (Qwrite_region, "write-region"); |
| 5871 | DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); | 5883 | DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); |
| 5872 | DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); | 5884 | DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); |
| 5885 | DEFSYM (Qfile_system_info, "file-system-info"); | ||
| 5873 | 5886 | ||
| 5874 | /* The symbol bound to coding-system-for-read when | 5887 | /* The symbol bound to coding-system-for-read when |
| 5875 | insert-file-contents is called for recovering a file. This is not | 5888 | insert-file-contents is called for recovering a file. This is not |
diff --git a/src/w32fns.c b/src/w32fns.c index efbd81b22d9..e3de22d68ab 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -9336,6 +9336,17 @@ If the underlying system call fails, value is nil. */) | |||
| 9336 | filename = Fexpand_file_name (filename, Qnil); | 9336 | filename = Fexpand_file_name (filename, Qnil); |
| 9337 | encoded = ENCODE_FILE (filename); | 9337 | encoded = ENCODE_FILE (filename); |
| 9338 | 9338 | ||
| 9339 | /* If the file name has special constructs in it, | ||
| 9340 | call the corresponding file handler. */ | ||
| 9341 | Lisp_Object handler = Ffind_file_name_handler (encoded, Qfile_system_info); | ||
| 9342 | if (!NILP (handler)) | ||
| 9343 | { | ||
| 9344 | value = call2 (handler, Qfile_system_info, encoded); | ||
| 9345 | if (CONSP (value) || NILP (value)) | ||
| 9346 | return value; | ||
| 9347 | error ("Invalid handler in `file-name-handler-alist'"); | ||
| 9348 | } | ||
| 9349 | |||
| 9339 | value = Qnil; | 9350 | value = Qnil; |
| 9340 | 9351 | ||
| 9341 | /* Determining the required information on Windows turns out, sadly, | 9352 | /* Determining the required information on Windows turns out, sadly, |