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

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

Re: find-directory-p always returns nil in locate-mode on windows xp


From: Luc Teirlinck
Subject: Re: find-directory-p always returns nil in locate-mode on windows xp
Date: Fri, 21 May 2004 13:29:19 -0500 (CDT)

Eli Zaretskii wrote:

   convert-standard-filename will leave "/" unaltered, since it's a
   valid file name on MS-Windows filesystems.

   My guess is that the problem is that locate.el uses "/" without a
   drive letter.  I vaguely remember that it was hard to find a correct
   behavior for expand-file-name when its second argument is "/", so
   perhaps this bug is some side effect of what was decided long ago to
   do in such cases.

Jason suggested (expand-file-name "/").  I _guess_ from your comments
above that this does not work either.  I do not have access to a
computer running anything else but GNU/Linux or Solaris, so I can not
check.  I guess that "what was decided long ago" refers to:

  if (! STRINGP (default_directory))
    {
#ifdef DOS_NT
      /* "/" is not considered a root directory on DOS_NT, so using "/"
       here causes an infinite recursion in, e.g., the following:

            (let (default-directory)
                  (expand-file-name "a"))

                   To avoid this, we set default_directory to the root of the
                    current drive.  */
      extern char *emacs_root_dir (void);

      default_directory = build_string (emacs_root_dir ());
#else
      default_directory = build_string ("/");
#endif
    }

   Again, I don't think Emacs on Windows should have any buffer whose
   default-directory is "/".

Yes, but I suppose you read the comment below, which Jason already
referred to.  I am cc-ing Peter Breton, the author of locate.el.

;; Define a mode for locate
;; Default directory is set to "/" so that dired commands, which
;; expect to be in a tree, will work properly
(defun locate-mode ()
  "Major mode for the `*Locate*' buffer made by \\[locate].
In that buffer, you can use almost all the usual dired bindings.
\\[locate-find-directory] visits the directory of the file on the current line.

\\{locate-mode-map}"
  (kill-all-local-variables)
  ;; Avoid clobbering this variables
  (make-local-variable 'dired-subdir-alist)
  (use-local-map             locate-mode-map)
  (setq major-mode          'locate-mode
        mode-name           "Locate"
        default-directory   "/")
  




reply via email to

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