emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: dired-compare-directories


From: Richard Stallman
Subject: Re: dired-compare-directories
Date: Mon, 11 Apr 2005 14:12:41 -0400

    Silently using the absolute file name is a very error-prone behavior.

It is also very useful, and used frequently.  I don't think I can
change this in read-file-name.

    There was a bug report recently about `copy-file' and other similar
    command assuming a wrong filename.  This was fixed by introducing
    a new interactive specifier "G" (which is not mnemonic).  I think this
    workaround was a mistake.  `read-file-name' (and `read-directory-name')
    with nil DEFAULT should not return a filename not explicitly
    specified by the user in the minibuffer.

Since I don't want to change read-file-name, we do need G.


read-directory-name is a separate issue, and it could be changed.
Would that fix the bug in dired-compare-directories?  If so,
would people please try this modified version?


(defun read-directory-name (prompt &optional dir default-dirname mustmatch 
initial)
  "Read directory name, prompting with PROMPT and completing in directory DIR.
Value is not expanded---you must call `expand-file-name' yourself.
Default name to DEFAULT-DIRNAME if user exits with the same
non-empty string that was inserted by this function.
 (If DEFAULT-DIRNAME is omitted, DIR combined with INITIAL is used,
  or just DIR if INITIAL is nil.)
If the user exits with an empty minibuffer, this function returns
an empty string.  (This can only happen if the user erased the
pre-inserted contents or if `insert-default-directory' is nil.)
Fourth arg MUSTMATCH non-nil means require existing directory's name.
 Non-nil and non-t means also require confirmation after completion.
Fifth arg INITIAL specifies text to start with.
DIR should be an absolute directory name.  It defaults to
the value of `default-directory'."
  (unless dir
    (setq dir default-directory))
  (unless default-dirname
    (setq default-dirname
          (if initial (concat dir initial) default-directory)))
  (read-file-name prompt dir (or default-dirname 
                                 (if initial (expand-file-name initial dir)
                                   dir))
                  mustmatch initial
                  'file-directory-p))




reply via email to

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