From: Paul Eggert <eggert@cs.ucla.edu>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: thievol@posteo.net, 58919@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#58919: 28.2; dired-copy-file-recursive fails to overwrite directory
Date: Sat, 24 Dec 2022 01:11:39 -0800 [thread overview]
Message-ID: <4b7ecd91-279f-e9be-3f62-7151ed7be174@cs.ucla.edu> (raw)
In-Reply-To: <87h6xmifft.fsf@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 131 bytes --]
On 12/23/22 02:26, Michael Albinus wrote:
> Do you want to simplify
> make-directory accordingly?
Sure, I installed the attached.
[-- Attachment #2: 0001-Assume-make-directory-handler-follows-new-API.patch --]
[-- Type: text/x-patch, Size: 3710 bytes --]
From cc2cc0c2971bf867283d1478bd0d99c2f420f982 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 24 Dec 2022 01:08:21 -0800
Subject: [PATCH] Assume make-directory handler follows new API
Suggested by Michael Albinus (Bug#58919#56).
* lisp/files.el (files--ensure-directory): Omit recently-added arg
MKDIR, since it is now always make-directory again. All uses
changed.
(make-directory): Assume the make-directory handler follows the
new API where it yields non-nil if DIR already exists. This
reverts some of the recent changes in this area, and simplifies
this funciton.
---
lisp/files.el | 53 +++++++++++++++++++++++----------------------------
1 file changed, 24 insertions(+), 29 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index f352d3a9a7..0fb080b53c 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6193,11 +6193,11 @@ rename-uniquely
(rename-buffer (generate-new-buffer-name base-name))
(force-mode-line-update))))
-(defun files--ensure-directory (mkdir dir)
- "Use function MKDIR to make directory DIR if it is not already a directory.
+(defun files--ensure-directory (dir)
+ "Make directory DIR if it is not already a directory.
Return non-nil if DIR is already a directory."
(condition-case err
- (funcall mkdir dir)
+ (make-directory-internal dir)
(error
(or (file-directory-p dir)
(signal (car err) (cdr err))))))
@@ -6223,32 +6223,27 @@ make-directory
;; If default-directory is a remote directory,
;; make sure we find its make-directory handler.
(setq dir (expand-file-name dir))
- (let ((mkdir (if-let ((handler (find-file-name-handler dir 'make-directory)))
- #'(lambda (dir)
- ;; Use 'ignore' since the handler might be designed for
- ;; Emacs 28-, so it might return an (undocumented)
- ;; non-nil value, whereas the Emacs 29+ convention is
- ;; to return nil here.
- (ignore (funcall handler 'make-directory dir)))
- #'make-directory-internal)))
- (if (not parents)
- (funcall mkdir dir)
- (let ((dir (directory-file-name (expand-file-name dir)))
- already-dir create-list parent)
- (while (progn
- (setq parent (directory-file-name
- (file-name-directory dir)))
- (condition-case ()
- (ignore (setq already-dir
- (files--ensure-directory mkdir dir)))
- (error
- ;; Do not loop if root does not exist (Bug#2309).
- (not (string= dir parent)))))
- (setq create-list (cons dir create-list)
- dir parent))
- (dolist (dir create-list)
- (setq already-dir (files--ensure-directory mkdir dir)))
- already-dir))))
+ (let ((handler (find-file-name-handler dir 'make-directory)))
+ (if handler
+ (funcall handler 'make-directory dir parents)
+ (if (not parents)
+ (make-directory-internal dir)
+ (let ((dir (directory-file-name (expand-file-name dir)))
+ already-dir create-list parent)
+ (while (progn
+ (setq parent (directory-file-name
+ (file-name-directory dir)))
+ (condition-case ()
+ (ignore (setq already-dir
+ (files--ensure-directory dir)))
+ (error
+ ;; Do not loop if root does not exist (Bug#2309).
+ (not (string= dir parent)))))
+ (setq create-list (cons dir create-list)
+ dir parent))
+ (dolist (dir create-list)
+ (setq already-dir (files--ensure-directory dir)))
+ already-dir)))))
(defun make-empty-file (filename &optional parents)
"Create an empty file FILENAME.
--
2.38.1
next prev parent reply other threads:[~2022-12-24 9:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 8:54 bug#58919: 28.2; dired-copy-file-recursive fails to overwrite directory Thierry Volpiatto
2022-10-31 13:01 ` Eli Zaretskii
2022-11-01 17:34 ` Thierry Volpiatto
2022-11-01 18:04 ` Paul Eggert
2022-11-01 18:09 ` Eli Zaretskii
2022-11-01 19:21 ` Michael Albinus
2022-12-11 10:46 ` Eli Zaretskii
2022-12-16 23:22 ` Paul Eggert
2022-12-17 8:04 ` Eli Zaretskii
2022-12-17 9:52 ` Michael Albinus
2022-12-17 10:40 ` Eli Zaretskii
2022-12-17 22:40 ` Paul Eggert
2022-12-18 19:35 ` Michael Albinus
2022-12-18 20:54 ` Paul Eggert
2022-12-23 10:26 ` Michael Albinus
2022-12-24 9:11 ` Paul Eggert [this message]
2022-12-24 10:13 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4b7ecd91-279f-e9be-3f62-7151ed7be174@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=58919@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=michael.albinus@gmx.de \
--cc=thievol@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).