Use make-directory handlers uniformly
Formerly, the code supported both make-directory and make-directory-internal handlers. This led to confusion and meant than in a few cases (nnmaildir, ido) remote directories could not be used in some cases. Fix this by using only make-directory handlers. Perhaps there used to be a reason for why there were both make-directory and make-directory-internal handlers, but whatever that reason was, it seems to have vanished even before now. There is no longer any need for make-directory-internal handlers, as the few remaining callers that use make-directory-internal do so only when there are no handlers. However, this change keeps the existing make-directory-internal handlers for now, in case this code is ever used in older Emacs versions that still call those handlers. * lisp/gnus/nnmaildir.el (nnmaildir--mkdir): * lisp/ido.el (ido-file-internal): * lisp/net/tramp-smb.el (tramp-smb-handle-make-directory): Use make-directory, not make-directory-internal. * lisp/net/tramp-smb.el (tramp-smb-handle-make-directory-internal): Now obsolete. * src/fileio.c (Fmake_directory_internal): Do not look for or use a make-directory-internal handler. * test/lisp/files-tests.el: (files-tests-file-name-non-special-make-directory-internal): Remove, as this test incorrectly assumes that make-directory-internal must support handlers.
This commit is contained in:
parent
627e7e0243
commit
8a9579ca29
7 changed files with 8 additions and 21 deletions
|
@ -3382,7 +3382,6 @@ first, before handlers for jobs such as remote file access.
|
|||
@code{load}, @code{lock-file},
|
||||
@code{make-auto-save-file-name},
|
||||
@code{make-directory},
|
||||
@code{make-directory-internal},
|
||||
@code{make-lock-file-name},
|
||||
@code{make-nearby-temp-file},
|
||||
@code{make-process},
|
||||
|
@ -3444,7 +3443,6 @@ first, before handlers for jobs such as remote file access.
|
|||
@code{load}, @code{lock-file},
|
||||
@code{make-auto-save-file-name},
|
||||
@code{make-direc@discretionary{}{}{}tory},
|
||||
@code{make-direc@discretionary{}{}{}tory-internal},
|
||||
@code{make-lock-file-name},
|
||||
@code{make-nearby-temp-file},
|
||||
@code{make-process},
|
||||
|
|
4
etc/NEWS
4
etc/NEWS
|
@ -4482,6 +4482,10 @@ set is too big to transfer to Emacs every time a completion is
|
|||
needed. The table uses new 'external' completion style exclusively
|
||||
and cannot work with regular styles such as 'basic' or 'flex'.
|
||||
|
||||
+++
|
||||
** Magic file handlers for make-directory-internal are no longer needed.
|
||||
Instead, Emacs uses the already-existing make-directory handlers.
|
||||
|
||||
|
||||
* Changes in Emacs 29.1 on Non-Free Operating Systems
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ This variable is set by `nnmaildir-request-article'.")
|
|||
(if (file-attributes file) (delete-file file))))
|
||||
(defun nnmaildir--mkdir (dir)
|
||||
(or (file-exists-p (file-name-as-directory dir))
|
||||
(make-directory-internal (directory-file-name dir))))
|
||||
(make-directory (directory-file-name dir))))
|
||||
(defun nnmaildir--mkfile (file)
|
||||
(write-region "" nil file nil 'no-message))
|
||||
(defun nnmaildir--delete-dir-files (dir ls)
|
||||
|
|
|
@ -2435,7 +2435,7 @@ If cursor is not at the end of the user input, move to end of input."
|
|||
filename))
|
||||
(ido-record-command method dirname)
|
||||
(ido-record-work-directory dirname)
|
||||
(make-directory-internal dirname)
|
||||
(make-directory dirname)
|
||||
(funcall method dirname))
|
||||
(t
|
||||
;; put make-directory command on history
|
||||
|
|
|
@ -1186,12 +1186,13 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
(make-directory ldir parents))
|
||||
;; Just do it.
|
||||
(when (file-directory-p ldir)
|
||||
(make-directory-internal dir))
|
||||
(make-directory dir))
|
||||
(unless (file-directory-p dir)
|
||||
(tramp-error v 'file-error "Couldn't make directory %s" dir)))))
|
||||
|
||||
(defun tramp-smb-handle-make-directory-internal (directory)
|
||||
"Like `make-directory-internal' for Tramp files."
|
||||
(declare (obsolete nil "29.1"))
|
||||
(setq directory (directory-file-name (expand-file-name directory)))
|
||||
(unless (file-name-absolute-p directory)
|
||||
(setq directory (expand-file-name directory default-directory)))
|
||||
|
|
|
@ -2427,16 +2427,11 @@ DEFUN ("make-directory-internal", Fmake_directory_internal,
|
|||
(Lisp_Object directory)
|
||||
{
|
||||
const char *dir;
|
||||
Lisp_Object handler;
|
||||
Lisp_Object encoded_dir;
|
||||
|
||||
CHECK_STRING (directory);
|
||||
directory = Fexpand_file_name (directory, Qnil);
|
||||
|
||||
handler = Ffind_file_name_handler (directory, Qmake_directory_internal);
|
||||
if (!NILP (handler))
|
||||
return call2 (handler, Qmake_directory_internal, directory);
|
||||
|
||||
encoded_dir = ENCODE_FILE (directory);
|
||||
|
||||
dir = SSDATA (encoded_dir);
|
||||
|
|
|
@ -1038,17 +1038,6 @@ unquoted file names."
|
|||
(let ((default-directory nospecial-dir))
|
||||
(should-error (make-directory "dir")))))
|
||||
|
||||
(ert-deftest files-tests-file-name-non-special-make-directory-internal ()
|
||||
(files-tests--with-temp-non-special (tmpdir nospecial-dir t)
|
||||
(let ((default-directory nospecial-dir))
|
||||
(make-directory-internal "dir")
|
||||
(should (file-directory-p "dir"))
|
||||
(delete-directory "dir")))
|
||||
(files-tests--with-temp-non-special-and-file-name-handler
|
||||
(tmpdir nospecial-dir t)
|
||||
(let ((default-directory nospecial-dir))
|
||||
(should-error (make-directory-internal "dir")))))
|
||||
|
||||
(ert-deftest files-tests-file-name-non-special-make-nearby-temp-file ()
|
||||
(let* ((default-directory (file-name-quote temporary-file-directory))
|
||||
(near-tmpfile (make-nearby-temp-file "file")))
|
||||
|
|
Loading…
Add table
Reference in a new issue