]> git.eshelyaron.com Git - emacs.git/commitdiff
Use make-directory handlers uniformly
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 17 Dec 2022 20:15:30 +0000 (12:15 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 17 Dec 2022 22:24:16 +0000 (14:24 -0800)
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.

doc/lispref/files.texi
etc/NEWS
lisp/gnus/nnmaildir.el
lisp/ido.el
lisp/net/tramp-smb.el
src/fileio.c
test/lisp/files-tests.el

index e2c3eb3341864d4a22fb1683f3e1fd2d5ff2d134..b3f63b8f32a6d4c26a91be72a3db25150d5cd70d 100644 (file)
@@ -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},
index 6d28bef409dd2c151a4159af7402e7b3fff4aea3..72421b03191285a58a4d7c3d3a7f7041c129c9fe 100644 (file)
--- a/etc/NEWS
+++ b/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.
+
 \f
 * Changes in Emacs 29.1 on Non-Free Operating Systems
 
index faa288934d14edc540b050398caeb04376e0b421..3fb87f3a712418177cddfc7dde1f89b867ce17bb 100644 (file)
@@ -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)
index 77e4dd447d803dee1e3e1e3a6178305ab655c664..92b4370cb452a4833eed259252dab4f72ae7d0b0 100644 (file)
@@ -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
index c720b33b5f2700302ca07470bdebe2fda497d487..24fff9bb495aab38da71b1a29a83f2c72b405f5b 100644 (file)
@@ -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)))
index 92335b639cdea60a28ff6b0a76c707e2b5d3b357..835c42cc0a4368ba366faf93501e2f3a9526432f 100644 (file)
@@ -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);
index 682b5cdb4495cf99466f32f48000fa7989cbbcec..efafb5583ac547277c4770bb91f7318569c15311 100644 (file)
@@ -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")))