From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: dired-do-touch Date: Thu, 25 Mar 2004 23:07:05 +0200 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87ptb0bzqe.fsf@mail.jurta.org> References: <8765czqqyj.fsf@sno.mundell.ukfsn.org> <8765ctkmdo.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1080249335 26147 80.91.224.253 (25 Mar 2004 21:15:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Mar 2004 21:15:35 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Mar 25 22:15:24 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B6cCB-00064d-00 for ; Thu, 25 Mar 2004 22:15:23 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B6cCB-0003zc-00 for ; Thu, 25 Mar 2004 22:15:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6c86-0002i1-Q9 for emacs-devel@quimby.gnus.org; Thu, 25 Mar 2004 16:11:10 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B6c74-0002TI-3z for emacs-devel@gnu.org; Thu, 25 Mar 2004 16:10:06 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B6c6R-0002F6-7q for emacs-devel@gnu.org; Thu, 25 Mar 2004 16:09:58 -0500 Original-Received: from [66.33.219.4] (helo=spork.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6c6Q-0002EQ-Cb for emacs-devel@gnu.org; Thu, 25 Mar 2004 16:09:26 -0500 Original-Received: from mail.jurta.org (80-235-37-18-dsl.mus.estpak.ee [80.235.37.18]) by spork.dreamhost.com (Postfix) with ESMTP id E30DC11DC0D for ; Thu, 25 Mar 2004 13:09:19 -0800 (PST) Original-To: emacs-devel@gnu.org In-Reply-To: <8765ctkmdo.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 25 Mar 2004 16:54:43 +0200") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20932 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20932 Juri Linkov 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/