[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

possible bug in wdired and patch

From: joakim
Subject: possible bug in wdired and patch
Date: Mon, 12 Feb 2007 12:35:57 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.92 (gnu/linux)

I have been using this patch against wdired 1.9.2 for some time, and
only just remembered. (this is not the version in emacs, but its very

The problem is that when you revert the wdired buffer to dired mode,
the original command line that was used to make the dired buffer isnt
used. This means wdired does the wrong thing when reverting to a dired
buffer made with "find" for instance.

The patch adresses this.

The second part of the patch is for creating parent directories if
there arent any. This is a new feature I suppose, and it isnt
necessary for the bugfix.

--- wdired.el.1 2007-02-12 12:16:30.000000000 +0100
+++ wdired.el   2007-02-12 12:20:15.000000000 +0100
@@ -362,6 +362,10 @@
   (add-hook 'kill-buffer-hook 'wdired-check-kill-buffer nil t)
   (setq major-mode 'wdired-mode)
   (setq mode-name "Edit filenames")
+  ;JAVE
+  (setq wdired-old-revert-buffer-function revert-buffer-function)
   (setq revert-buffer-function 'wdired-revert)
   ;; I temp disable undo for performance: since I'm going to clear the
   ;; undo list, it can save more than a 9% of time with big
@@ -461,7 +465,7 @@
   (setq mode-name "Dired")
   (remove-hook 'kill-buffer-hook 'wdired-check-kill-buffer t)
-  (setq revert-buffer-function 'dired-revert))
+  (setq revert-buffer-function   wdired-old-revert-buffer-function ))
 (defun wdired-abort-changes ()
@@ -518,6 +522,7 @@
                      (wdired-search-and-rename file-ori file-new)
                    (condition-case err
                        (let ((dired-backup-overwrite nil))
+                         (wdired-create-parentdirs file-new)
                          (dired-rename-file file-ori file-new
@@ -545,6 +550,13 @@
   (set-buffer-modified-p nil)
   (setq buffer-undo-list nil))
+;;JAVE create parent directories of filename if the parents doesnt exist
+(defun wdired-create-parentdirs (file-new)
+  (message "create dir for file %s" file-new)
+  (make-directory (file-name-directory file-new) t)
 ;; Renames a file, searching it in a modified dired buffer, in order
 ;; to be able to use `dired-do-create-files-regexp' and get its
 ;; "benefits"

Joakim Verona

reply via email to

[Prev in Thread] Current Thread [Next in Thread]