all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eduard Wiebe <usenet@pusto.de>
To: bug-gnu-emacs@gnu.org
Subject: bug#7308: [patch] locate under windoze
Date: Mon, 01 Nov 2010 15:59:14 +0100	[thread overview]
Message-ID: <87d3qpytrx.fsf@pusto.de> (raw)
In-Reply-To: <87hbg3piit.fsf@pusto.de>

[-- Attachment #1: Type: text/plain, Size: 141 bytes --]


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: locate_under_windoze2.diff --]
[-- Type: text/x-diff, Size: 2584 bytes --]

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 <usenet@pusto.de>
+
+	* 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  <handa@m17n.org>
 
 	* 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 "")

  parent reply	other threads:[~2010-11-01 14:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-30 19:50 bug#7308: [patch] locate under windoze Eduard Wiebe
2010-10-30 21:21 ` Eli Zaretskii
2010-10-31  9:36   ` Eduard Wiebe
2010-10-31  9:48     ` Thierry Volpiatto
2010-10-31 10:51     ` Eli Zaretskii
2010-10-31 19:54       ` Eduard Wiebe
2010-10-31 20:26         ` Eli Zaretskii
2010-10-31  6:56 ` Thierry Volpiatto
2010-10-31  7:49   ` Eli Zaretskii
2010-10-31  9:41     ` Thierry Volpiatto
2010-10-31 10:47       ` Eli Zaretskii
2010-10-31 11:13         ` Thierry Volpiatto
2010-11-01  6:54 ` Glenn Morris
2010-11-01  7:46   ` Eduard Wiebe
2010-11-01 14:06   ` Stefan Monnier
2010-11-01 14:59 ` Eduard Wiebe [this message]
2010-11-12 20:28   ` Eduard Wiebe
2010-11-13 18:57     ` Chong Yidong
2010-11-13 21:18       ` Eli Zaretskii
2010-11-13 22:33         ` Eduard Wiebe
2010-11-14  3:59           ` Eli Zaretskii
2010-11-14  9:15             ` Eduard Wiebe
2010-11-27  9:59               ` Eli Zaretskii
     [not found]                 ` <87bp5970hs.fsf@pusto.de>
2010-11-28 19:46                   ` bug#5462: " Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3qpytrx.fsf@pusto.de \
    --to=usenet@pusto.de \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.