aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS14
-rw-r--r--lisp/dired-aux.el23
2 files changed, 35 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 2a19e1457a6..1baa82be31d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1423,6 +1423,20 @@ a control panel window.
1423 1423
1424** Dired 1424** Dired
1425 1425
1426---
1427*** New user option 'dired-create-empty-file-in-current-directory'.
1428When non-nil, 'dired-create-empty-file' creates a new empty file and
1429adds an entry for it (or its topmost new parent directory if created)
1430under the current subdirectory in the Dired buffer by default
1431(otherwise, it adds adds the new file (and new subdirectories if
1432provided) to whichever directory the user enters at the prompt). When
1433nil, `dired-create-empty-file' acts on the default directory by default.
1434
1435Note that setting this user option to non-nil makes invoking
1436'dired-create-empty-file' outside of a Dired buffer raise an error (like
1437other Dired commands that always prompt with the current subdirectory,
1438such as 'dired-create-directory').
1439
1426+++ 1440+++
1427*** New user option 'dired-check-symlinks' allows disabling validity checks. 1441*** New user option 'dired-check-symlinks' allows disabling validity checks.
1428Dired uses 'file-truename' to check symbolic link validity when 1442Dired uses 'file-truename' to check symbolic link validity when
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 2e8d5c1a379..100f203b3f6 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2872,13 +2872,32 @@ If DIRECTORY already exists, signal an error."
2872 (dired-add-file new) 2872 (dired-add-file new)
2873 (dired-move-to-filename)))) 2873 (dired-move-to-filename))))
2874 2874
2875(defcustom dired-create-empty-file-in-current-directory nil
2876 "Whether `dired-create-empty-file' acts on the current directory.
2877If non-nil, `dired-create-empty-file' creates a new empty file and adds
2878an entry for it (or its topmost new parent directory if created) under
2879the current subdirectory in the Dired buffer by default (otherwise, it
2880adds the new file (and new subdirectories if provided) to whichever
2881directory the user enters at the prompt). If nil,
2882`dired-create-empty-file' acts on the default directory by default."
2883 :type 'boolean
2884 :version "31.1")
2885
2875;;;###autoload 2886;;;###autoload
2876(defun dired-create-empty-file (file) 2887(defun dired-create-empty-file (file)
2877 "Create an empty file called FILE. 2888 "Create an empty file called FILE.
2878Add a new entry for the new file in the Dired buffer.
2879Parent directories of FILE are created as needed. 2889Parent directories of FILE are created as needed.
2890Add an entry in the Dired buffer for the topmost new parent
2891directory of FILE, if created, otherwise for the new file.
2892If user option `dired-create-empty-file-in-current-directory' is
2893non-nil, act on the current subdirectory by default, otherwise act on
2894the default directory by default.
2880If FILE already exists, signal an error." 2895If FILE already exists, signal an error."
2881 (interactive (list (read-file-name "Create empty file: ")) dired-mode) 2896 (interactive
2897 (list (read-file-name "Create empty file: "
2898 (and dired-create-empty-file-in-current-directory
2899 (dired-current-directory))))
2900 dired-mode)
2882 (let* ((expanded (expand-file-name file)) 2901 (let* ((expanded (expand-file-name file))
2883 new) 2902 new)
2884 (if (file-exists-p expanded) 2903 (if (file-exists-p expanded)