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: Peter Lee
Subject: Re: find-directory-p always returns nil in locate-mode on windows xp
Date: Wed, 26 May 2004 13:10:57 -0500
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (windows-nt)

>>>> Luc Teirlinck writes:

    Luc> Eli Zaretskii wrote (in response to Peter Lee):
    >> It works on a line that contains only a directory.

    Luc>    Thanks for testing this.

    Luc> What do you mean with "work"?  You can insert the
    Luc> subdirectory, but, unless you have applied one of the patches
    Luc> I sent to emacs-devel, can you, for instance, visit a file
    Luc> using RET in the subdirectory?

I can insert the directory and I can visit files in that directory.
I had already applied your locate patch though, so I don't know if
that was broken before.

*** locate.el   20 May 2004 17:14:36 -0500      1.22
--- locate.el   24 May 2004 20:53:29 -0500      
***************
*** 281,287 ****
     (define-key locate-mode-map [menu-bar mark directories] 'undefined)
     (define-key locate-mode-map [menu-bar mark symlinks]    'undefined)
  
!    (define-key locate-mode-map [mouse-2]   'locate-mouse-view-file)
     (define-key locate-mode-map "\C-c\C-t"  'locate-tags)
  
     (define-key locate-mode-map "U"       'dired-unmark-all-files)
--- 281,287 ----
     (define-key locate-mode-map [menu-bar mark directories] 'undefined)
     (define-key locate-mode-map [menu-bar mark symlinks]    'undefined)
  
!    (define-key locate-mode-map "i"         'locate-maybe-insert-subdir)
     (define-key locate-mode-map "\C-c\C-t"  'locate-tags)
  
     (define-key locate-mode-map "U"       'dired-unmark-all-files)
***************
*** 325,330 ****
--- 325,346 ----
      (goto-char (posn-point (event-start event)))
      (view-file (locate-get-filename))))
  
+ (defun locate-maybe-insert-subdir (dirname &optional
+                                          switches no-error-if-not-dir-p)
+   "Like `dired-maybe-insert-subdir', but works in `locate-mode'.
+ `locate-mode' needs a special command for this to replace its own
+ binding of `dired-actual-switches' with \"-al\", when called
+ interactively.  As with `dired-maybe-insert-subdir', you can
+ specify your own switches by providing a numeric prefix argument,
+ but you can not specify the \"-F\" switch.  For proper
+ functioning, you should specify the \"-l\" switch."
+   (interactive
+    (list (dired-get-filename)
+        (if current-prefix-arg
+            (read-string "Switches for listing: " "-al")
+          "-al")))
+   (dired-maybe-insert-subdir dirname switches no-error-if-not-dir-p))
+ 
  ;; Define a mode for locate
  ;; Default directory is set to "/" so that dired commands, which
  ;; expect to be in a tree, will work properly
***************
*** 345,353 ****
    (make-local-variable 'dired-move-to-filename-regexp)
    ;; This should support both Unix and Windoze style names
    (setq dired-move-to-filename-regexp
!       (concat "."
                (make-string (1- locate-filename-indentation) ?\ )
!               "\\(/\\|[A-Za-z]:\\)"))
    (make-local-variable 'dired-actual-switches)
    (setq dired-actual-switches "")
    (make-local-variable 'dired-permission-flags-regexp)
--- 361,370 ----
    (make-local-variable 'dired-move-to-filename-regexp)
    ;; This should support both Unix and Windoze style names
    (setq dired-move-to-filename-regexp
!       (concat "^."
                (make-string (1- locate-filename-indentation) ?\ )
!               "\\(/\\|[A-Za-z]:\\)\\|"
!               (default-value 'dired-move-to-filename-regexp)))
    (make-local-variable 'dired-actual-switches)
    (setq dired-actual-switches "")
    (make-local-variable 'dired-permission-flags-regexp)
***************
*** 386,392 ****
        (dired-insert-set-properties (elt pos 0) (elt pos 1)))))
  
  (defun locate-insert-header (search-string)
!   (let ((locate-format-string "Matches for %s")
        (locate-regexp-match
         (concat " *Matches for \\(" (regexp-quote search-string) "\\)"))
        (locate-format-args (list search-string))
--- 403,409 ----
        (dired-insert-set-properties (elt pos 0) (elt pos 1)))))
  
  (defun locate-insert-header (search-string)
!   (let ((locate-format-string " Matches for %s")
        (locate-regexp-match
         (concat " *Matches for \\(" (regexp-quote search-string) "\\)"))
        (locate-format-args (list search-string))

reply via email to

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