summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduard Wiebe <usenet@pusto.de>2010-11-27 11:56:49 +0200
committerEli Zaretskii <eliz@gnu.org>2010-11-27 11:56:49 +0200
commitd1882ac7c91cbaa51aeea68433f1867e73a431c2 (patch)
tree16483fbbb771b967bca9ebfaa30bf5bde90e4afc
parentda2b5401e8747adb28558684b48328806bf43e1e (diff)
downloademacs-d1882ac7c91cbaa51aeea68433f1867e73a431c2.tar.gz
Fix bug #7308 with `locate' on MS-Windows.
dired.el (dired-get-filename): Replace backslashes with slashes in file names on MS-Windows, needed by `locate'. locate.el (locate-default-make-command-line): Don't consider drive letter and root directory part of `directory-listing-before-filename-regexp'. (locate-post-command-hook, locate-post-command-hook): New defcustoms.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/dired.el8
-rw-r--r--lisp/locate.el14
3 files changed, 29 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3ac8fd7a270..e8dda581208 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-27 Eduard Wiebe <usenet@pusto.de>
+
+ * dired.el (dired-get-filename): Replace backslashes with slashes
+ in file names on MS-Windows, needed by `locate'. (Bug#7308)
+ * locate.el (locate-default-make-command-line): Don't consider
+ drive letter and root directory part of
+ `directory-listing-before-filename-regexp'. (Bug#7308)
+ (locate-post-command-hook, locate-post-command-hook): New defcustoms.
+
2010-11-26 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/smie.el (smie-prec2->grammar): Simplify handling
diff --git a/lisp/dired.el b/lisp/dired.el
index bb0cc223281..b2bd082b1a6 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2012,6 +2012,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 ce1154c9739..d5caf8615cd 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)
@@ -471,9 +481,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 "")