emacs-devel
[Top][All Lists]
Advanced

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

Re: dired-do-touch


From: Juri Linkov
Subject: Re: dired-do-touch
Date: Thu, 25 Mar 2004 23:07:05 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Juri Linkov <address@hidden> writes:
> I am very happy with the following patch.

And I am happy with the following patch as well (it should be applied
with the patch I posted in the previous mail).

This patch adds guessing the default target directory for dired-diff.
If there is no mark in the current dired buffer, then it takes the target
directory name from the next window using `dired-dwim-target-directory'.

Another feature is that if no files are marked in the current dired
buffer (i.e. dired operates on the file under point) then when reading
the target file name it uses the current file name as the initial
input string for C, R and some other dired commands.  This is
especially useful when renaming files: the prompt places the name of
the current file as the basis for file name editing.

Index: emacs/lisp/dired-aux.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.115
diff -c -r1.115 dired-aux.el
*** emacs/lisp/dired-aux.el     23 Mar 2004 07:39:35 -0000      1.115
--- emacs/lisp/dired-aux.el     25 Mar 2004 17:10:33 -0000
***************
*** 64,70 ****
                                   (if default
                                       (concat "(default " default ") ")
                                     ""))
!                          (dired-current-directory) default t)
           (if current-prefix-arg
               (read-string "Options for diff: "
                            (if (stringp diff-switches)
--- 64,72 ----
                                   (if default
                                       (concat "(default " default ") ")
                                     ""))
!                          (if default
!                                (dired-current-directory)
!                              (dired-dwim-target-directory)) default t)
           (if current-prefix-arg
               (read-string "Options for diff: "
                            (if (stringp diff-switches)
***************
*** 1402,1408 ****
    (dired-mark-pop-up
     nil op-symbol files
     (function read-file-name)
!    (format prompt (dired-mark-prompt arg files)) dir default))
  
  (defun dired-dwim-target-directory ()
    ;; Try to guess which target directory the user may want.
--- 1472,1483 ----
    (dired-mark-pop-up
     nil op-symbol files
     (function read-file-name)
!    (format prompt (dired-mark-prompt arg files)) dir default nil
!    (if (and dired-show-initial
!             (and (consp files) (null (cdr files)) (car files))
!             (equal (dired-dwim-target-directory)
!                    (dired-current-directory)))
!        (car files))))
  
  (defun dired-dwim-target-directory ()
    ;; Try to guess which target directory the user may want.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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