unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* possible bug in wdired and patch
@ 2007-02-12 11:35 joakim
  0 siblings, 0 replies; only message in thread
From: joakim @ 2007-02-12 11:35 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

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
similar)

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: wdired.diff --]
[-- Type: text/x-patch, Size: 1532 bytes --]

--- 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")
   (dired-advertise)
   (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
 					     overwrite))
 		      (error
@@ -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"

[-- Attachment #3: Type: text/plain, Size: 20 bytes --]



-- 
Joakim Verona

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-12 11:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-12 11:35 possible bug in wdired and patch joakim

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).