emacs-devel
[Top][All Lists]
Advanced

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

Re: insert-directory


From: Luc Teirlinck
Subject: Re: insert-directory
Date: Mon, 24 May 2004 19:11:55 -0500 (CDT)

Below is my latest corrected version of
`dired-move-to-filename-regexp'.  There are actually two regular
expressions.  One for MS Windows and one for Unix style names.  I
believe that the non-MS Windows one one works for all GNU-Unix style
file names, even if they mimic MS style names.  I have tested it quite
a bit on GNU/Linux and it seems to work fine.

Remaining issues with `dired-move-to-filename-regexp':

I do not know anything about VMS, but I believe that the old value
_already_ made no attempt to deal with VMS.

Actually, apart from what I have read in the Elisp manual or learned
from reading emacs-devel, I do not know anything about MS Windows
either.  Based on what Eli told me I _believe_ that the value I chose
should work, even after a bunch of recursive `i' 's.  However, I have
no way to check and maybe my regexp for MS Windows might contain the
most obvious stupidities.  Somebody with access to MS Windows and
interested in using `i' in *Locate* buffers will have to check (and
possibly correct or replace) my regexp.

Other issues:

I propose to replace the first line "Matches for..." with " Matches
for..."  Putting one space at the beginning fixes a bug: with the
current first line, doing *! erases the `M", after which the first
line looks weird.  Using two instead of one space would interfere with
the new value of `dired-move-to-filename-regexp'.

Mouse-2 currently does not work on the part inserted by `i'.
Moreover, anybody used to dired, or find-dired or similar, will expect
mouse-2 to visit the file in another window.  Is there any reason for
doing anything different in locate-mode, especially since the dired
commamd `v' will view the file.  Is there any substantial difference
between `dired-view-file' (`v') and `locate-mouse-view-file'?
The patch below just erases the current mouse-2 binding, thereby making
the dired binding visible again.  But that part of the patch can, of
course, easily be taken out again if there is disagreement.

I do not know what `dired-permission-flags-regexp' is used for in
locate-mode, but I did not detect any problems resulting from leaving
it unchanged after doing `i'.

I will wait a couple of days before committing, to see whether there
are objections to any of the proposed changes, as well as to think
them over myself.

===File ~/locate-diff=======================================
*** locate.el   20 May 2004 17:14:36 -0500      1.22
--- locate.el   24 May 2004 16:36:07 -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,286 ----
***************
*** 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)
--- 344,357 ----
    (make-local-variable 'dired-move-to-filename-regexp)
    ;; This should support both Unix and Windoze style names
    (setq dired-move-to-filename-regexp
!       (if (memq system-type '(ms-dos windows-nt))
!           (concat "^."
!                   (make-string (1- locate-filename-indentation) ?\ )
!                   "\\(/\\|[A-Za-z]:\\)\\|"
!                   (default-value 'dired-move-to-filename-regexp))
!         (concat "^.\\("
!                 (make-string (1- locate-filename-indentation) ?\ )
!                 "/\\| /.*\\| \\)")))
    (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))
--- 390,396 ----
        (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]