From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eduard Wiebe Newsgroups: gmane.emacs.bugs Subject: bug#7308: [patch] locate under windoze Date: Mon, 01 Nov 2010 15:59:14 +0100 Message-ID: <87d3qpytrx.fsf@pusto.de> References: <87hbg3piit.fsf@pusto.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1288628442 29860 80.91.229.12 (1 Nov 2010 16:20:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Nov 2010 16:20:42 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 01 17:20:37 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PCx7b-00066a-N8 for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Nov 2010 17:20:37 +0100 Original-Received: from localhost ([127.0.0.1]:42764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCx7Z-0005jC-LX for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Nov 2010 12:20:33 -0400 Original-Received: from [140.186.70.92] (port=46082 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCw4b-00030u-8i for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 11:13:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCw4V-0002k5-0Y for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 11:13:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCw4U-0002jw-VB for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 11:13:18 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PCvoj-0004g3-PC; Mon, 01 Nov 2010 10:57:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87hbg3piit.fsf@pusto.de> Resent-From: Eduard Wiebe Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Nov 2010 14:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7308 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by submit@debbugs.gnu.org id=B.128862341617973 (code B ref -1); Mon, 01 Nov 2010 14:57:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Nov 2010 14:56:56 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCvod-0004fq-J6 for submit@debbugs.gnu.org; Mon, 01 Nov 2010 10:56:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCvob-0004fj-Ba for submit@debbugs.gnu.org; Mon, 01 Nov 2010 10:56:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCvsm-0000WJ-5N for submit@debbugs.gnu.org; Mon, 01 Nov 2010 11:01:13 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:59925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCvsd-0000Rk-3Y for submit@debbugs.gnu.org; Mon, 01 Nov 2010 11:01:12 -0400 Original-Received: from [140.186.70.92] (port=52325 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCvsX-0003MP-7i for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 11:01:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCvsQ-0000PO-U4 for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 11:00:52 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:38322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCvsQ-0000Om-6U for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 11:00:50 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PCvsM-0003VW-A6 for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 16:00:46 +0100 Original-Received: from g227129215.adsl.alicedsl.de ([92.227.129.215]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 01 Nov 2010 16:00:45 +0100 Original-Received: from usenet by g227129215.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 01 Nov 2010 16:00:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 95 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: g227129215.adsl.alicedsl.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:vmw8Psaq88pklwToy1dCXf63YRc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 01 Nov 2010 10:57:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:41340 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=locate_under_windoze2.diff 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 + + * 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 * 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 "") --=-=-=--