unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: joakim@verona.se
To: emacs-devel <emacs-devel@gnu.org>
Subject: possible bug in wdired and patch
Date: Mon, 12 Feb 2007 12:35:57 +0100	[thread overview]
Message-ID: <m3ire78v6q.fsf@kurono.home> (raw)

[-- 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

                 reply	other threads:[~2007-02-12 11:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=m3ire78v6q.fsf@kurono.home \
    --to=joakim@verona.se \
    --cc=emacs-devel@gnu.org \
    /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).