Don't require default-directory to end with a slash

* doc/lispref/files.texi (Magic File Names): Document the change
in unhandled-file-name-directory.

* lisp/url/url-handlers.el
(url-handler-unhandled-file-name-directory): Update accordingly.

* src/buffer.c (default-directory): Update the docsting.

* src/fileio.c (unhandled-file-name-directory): Default to calling
`file-name-as-directory'
(http://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02294.html).
This commit is contained in:
Dmitry Gutov 2015-10-29 03:00:50 +02:00
parent 42eb249ebd
commit ffa41ad2a0
5 changed files with 10 additions and 5 deletions

View file

@ -3082,7 +3082,7 @@ making connections when they don't exist.
@defun unhandled-file-name-directory filename
This function returns the name of a directory that is not magic. It
uses the directory part of @var{filename} if that is not magic. For a
turns @var{filename} into a directory name if that is not magic. For a
magic file name, it invokes the file name handler, which therefore
decides what value to return. If @var{filename} is not accessible
from a local process, then the file name handler should indicate it by

View file

@ -1034,6 +1034,11 @@ The new behavior is compatible with Common Lisp and with XEmacs.
This change does not affect Lisp code intended to be portable to
Emacs 24.2 and earlier, which did not support unary /.
+++
** The `default-directory' value doesn't have to end slash. To make
that happen, `unhandled-file-name-directory' now defaults to calling
`file-name-as-directory'.
* Lisp Changes in Emacs 25.1

View file

@ -223,7 +223,7 @@ the arguments that would have been passed to OPERATION."
;; which really stands for "/".
;; FIXME: maybe we should check that the host part is "" or "localhost"
;; or some name that represents the local host?
(or (file-name-directory (url-filename url)) "/")
(or (file-name-as-directory (url-filename url)) "/")
;; All other URLs are not expected to be directly accessible from
;; a local process.
nil)))

View file

@ -5739,7 +5739,7 @@ visual lines rather than logical lines. See the documentation of
DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
Qstringp,
doc: /* Name of default directory of current buffer. Should end with slash.
doc: /* Name of default directory of current buffer.
To interactively change the default directory, use command `cd'. */);
DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function),

View file

@ -450,7 +450,7 @@ DEFUN ("unhandled-file-name-directory", Funhandled_file_name_directory,
A `directly usable' directory name is one that may be used without the
intervention of any file handler.
If FILENAME is a directly usable file itself, return
(file-name-directory FILENAME).
(file-name-as-directory FILENAME).
If FILENAME refers to a file which is not accessible from a local process,
then this should return nil.
The `call-process' and `start-process' functions use this function to
@ -469,7 +469,7 @@ get a current directory to run processes in. */)
return STRINGP (handled_name) ? handled_name : Qnil;
}
return Ffile_name_directory (filename);
return Ffile_name_as_directory (filename);
}
/* Maximum number of bytes that DST will be longer than SRC