From: Dmitry Gutov Date: Thu, 29 Oct 2015 01:00:50 +0000 (+0200) Subject: Don't require default-directory to end with a slash X-Git-Tag: emacs-25.0.90~985 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ffa41ad2a02dbd1202d71a08bac34831f25662d0;p=emacs.git 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). --- diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 65a97a46699..60834338423 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -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 diff --git a/etc/NEWS b/etc/NEWS index 47a4bae17c2..512b491b5f8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index 845195e7d4c..a5d9f37b5ee 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -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))) diff --git a/src/buffer.c b/src/buffer.c index 380a7af33c1..91e42dca2bf 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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), diff --git a/src/fileio.c b/src/fileio.c index 428093bdc4b..6cda1e39eed 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -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