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

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

bug#7308: [patch] locate under windoze


From: Eduard Wiebe
Subject: bug#7308: [patch] locate under windoze
Date: Mon, 01 Nov 2010 15:59:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Ok, here is the improved version of my patch.
Thanks all for the feedback.

PS: Can we commit it to emacs-23 branch too?

-- 
Eduard Wiebe

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fb84bb6..86538cc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-01  Eduard Wiebe <address@hidden>
+
+       * dired.el (dired-get-filename): Replace backslashes with slashes
+       in file path on windows-nt, needed by `locate'. (Bug#7308)
+       * locate.el (locate-default-make-command-line): Simplify
+       `directory-listing-before-filename-regexp'.
+       (locate-post-command-hook, locate-post-command-hook):
+       Defcustomize.
+
 2010-11-01  Kenichi Handa  <address@hidden>
 
        * faces.el (glyphless-char): Inherit underline for tty.
diff --git a/lisp/dired.el b/lisp/dired.el
index f840b60..180d727 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2011,6 +2011,14 @@ Otherwise, an error occurs in these cases."
           ;; with quotation marks in their names.
          (while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file)
            (setq file (replace-match "\\\"" nil t file 1)))
+         
+         (when (eq system-type 'windows-nt)
+           (save-match-data
+             (let ((start 0))
+               (while (string-match "\\\\" file start)
+                 (aset file (match-beginning 0) ?/)
+                 (setq start (match-end 0))))))
+
           (setq file (read (concat "\"" file "\"")))
          ;; The above `read' will return a unibyte string if FILE
          ;; contains eight-bit-control/graphic characters.
diff --git a/lisp/locate.el b/lisp/locate.el
index f1983a3..6e21047 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -145,6 +145,11 @@ the version.)"
   :type 'string
   :group 'locate)
 
+(defcustom locate-post-command-hook nil
+  "List of hook functions run after `locate' (see `run-hooks')."
+  :type  'hook
+  :group 'locate)
+
 (defvar locate-history-list nil
   "The history list used by the \\[locate] command.")
 
@@ -226,6 +231,11 @@ that is, with a prefix arg, you get the default behavior."
   :group 'locate
   :type 'boolean)
 
+(defcustom locate-mode-hook nil
+  "List of hook functions run by `locate-mode' (see `run-mode-hooks')."
+  :type  'hook
+  :group 'locate)
+
 ;; Functions
 
 (defun locate-default-make-command-line (search-string)
@@ -473,9 +483,9 @@ do not work in subdirectories.
   (make-local-variable 'directory-listing-before-filename-regexp)
   ;; This should support both Unix and Windoze style names
   (setq directory-listing-before-filename-regexp
-       (concat "^."
+       (concat "^.\\("
                (make-string (1- locate-filename-indentation) ?\s)
-               "\\(/\\|[A-Za-z]:\\)\\|"
+                "\\)\\|"
                (default-value 'directory-listing-before-filename-regexp)))
   (make-local-variable 'dired-actual-switches)
   (setq dired-actual-switches "")

reply via email to

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