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: Sat, 30 Oct 2010 21:50:18 +0200 Message-ID: <87hbg3piit.fsf@pusto.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1288469609 26699 80.91.229.12 (30 Oct 2010 20:13:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Oct 2010 20:13:29 +0000 (UTC) To: 7308@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 30 22:13:24 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 1PCHnl-0008Ul-0E for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Oct 2010 22:13:21 +0200 Original-Received: from localhost ([127.0.0.1]:58887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCHnk-0006rv-4h for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Oct 2010 16:13:20 -0400 Original-Received: from [140.186.70.92] (port=56987 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCHne-0006ri-Aw for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 16:13:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCHnc-0004FX-WE for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 16:13:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCHnc-0004E5-T9 for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 16:13:12 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PCHPF-0007t3-QK; Sat, 30 Oct 2010 15:48:01 -0400 X-Loop: help-debbugs@gnu.org 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: Sat, 30 Oct 2010 19:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7308 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.128846805530305 (code B ref -1); Sat, 30 Oct 2010 19:48:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Oct 2010 19:47:35 +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 1PCHOo-0007sk-Bd for submit@debbugs.gnu.org; Sat, 30 Oct 2010 15:47:35 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCHOm-0007sf-Tm for submit@debbugs.gnu.org; Sat, 30 Oct 2010 15:47:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCHSt-0001Dn-AP for submit@debbugs.gnu.org; Sat, 30 Oct 2010 15:51:48 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:55554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCHSt-0001Dj-7v for submit@debbugs.gnu.org; Sat, 30 Oct 2010 15:51:47 -0400 Original-Received: from [140.186.70.92] (port=47817 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCHSs-0002Y5-3f for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 15:51:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCHSq-0001DN-LM for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 15:51:45 -0400 Original-Received: from wp093.webpack.hosteurope.de ([80.237.132.100]:48107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCHSq-0001DA-8W for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 15:51:44 -0400 Original-Received: from g227003066.adsl.alicedsl.de ([92.227.3.66] helo=nirvana); authenticated by wp093.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) id 1PCHSm-0003PT-Je; Sat, 30 Oct 2010 21:51:40 +0200 Original-Received: from ew by nirvana with local (Exim 4.69) (envelope-from ) id 1PCHRT-0001dm-17 for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 21:50:19 +0200 X-bounce-key: webpack.hosteurope.de;ew@pusto.de;1288468304;832fc5a1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) 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: Sat, 30 Oct 2010 15:48: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:41283 Archived-At: --=-=-= Content-Type: text/plain Hello, i want to use `locate' under windoze system. Unfortunately locate (in interaction with dired) doesn't work proper in such a case. The problem is the unquoted backslash in a located file path. So i fix this issue by following patch. BTW i customized hook variables and added autoloads. -- Eduard Wiebe --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=locate_under_windoze.diff diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d7a6399..37f09e7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2010-10-23 Eduard Wiebe + + * dired.el (dired-get-filename): Quote path delimiter under + windows-nt and ms-dos systems, needed for `locate' under this + systems. + * locate.el (locate-default-make-command-line): Simplify + `directory-listing-before-filename-regexp'. + (locate-post-command-hook, locate-post-command-hook): Customized + and add autoload. + 2010-10-30 Alan Mackenzie * progmodes/cc-fonts.el (c-font-lock-enum-tail): New function diff --git a/lisp/dired.el b/lisp/dired.el index f840b60..d1c2ccb 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2011,6 +2011,10 @@ 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 (member system-type '(ms-dos windows-nt)) + (setq file (replace-regexp-in-string "\\\\" "\\\\\\\\" file))) + (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..e07acde 100644 --- a/lisp/locate.el +++ b/lisp/locate.el @@ -145,6 +145,12 @@ the version.)" :type 'string :group 'locate) +;;;###autoload +(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 +232,12 @@ that is, with a prefix arg, you get the default behavior." :group 'locate :type 'boolean) +;;;###autoload +(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 +485,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 "") --=-=-=--