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

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

bug#5462: 23.1; [patch] locate.el: defcustomizing *-hooks


From: Eduard Wiebe
Subject: bug#5462: 23.1; [patch] locate.el: defcustomizing *-hooks
Date: Sun, 24 Jan 2010 13:38:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (berkeley-unix)

 Hello,

How about this patch?

Attachment: locate.chlog
Description: Changelog entry

My rational: Hook variables were't documented and uncustomizable.  Dired
regexps are to complex for plain locate output, this results in patial
highlighting of file names in *Locate* buffer (e.g. first char is not
highlighted under mouse).

diff --git a/lisp/locate.el b/lisp/locate.el
index d0021df..f461db4 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -226,6 +226,16 @@ that is, with a prefix arg, you get the default behavior."
   :group 'locate
   :type 'boolean)
 
+(defcustom locate-mode-hook nil
+  "Run at the end of `locate-mode'."
+  :group 'locate
+  :type  'hook)
+
+(defcustom locate-post-command-hook nil
+  "Hook run after each locate command is executed."
+  :group 'locate
+  :type  'hook)
+
 ;; Functions
 
 (defun locate-default-make-command-line (search-string)
@@ -300,8 +310,7 @@ ARG is the interactive prefix arg."
         (locate-cmd-args (cdr locate-cmd-list))
         (run-locate-command
          (or (and arg (not locate-prompt-for-command))
-             (and (not arg) locate-prompt-for-command)))
-        )
+             (and (not arg) locate-prompt-for-command))))
 
     ;; Find the Locate buffer
     (save-window-excursion
@@ -310,7 +319,6 @@ ARG is the interactive prefix arg."
       (let ((inhibit-read-only t)
            (buffer-undo-list t))
        (erase-buffer)
-
        (setq locate-current-filter filter)
        (set (make-local-variable 'locate-local-search) search-string)
        (set (make-local-variable 'locate-local-filter) filter)
@@ -320,19 +328,15 @@ ARG is the interactive prefix arg."
            (shell-command search-string locate-buffer-name)
          (apply 'call-process locate-cmd nil t nil locate-cmd-args))
 
-       (and filter
-            (locate-filter-output filter))
-
-       (locate-do-setup search-string)
-       ))
+       (and filter (locate-filter-output filter))
+       (locate-do-setup search-string)))
+    
     (and (not (string-equal (buffer-name) locate-buffer-name))
-       (switch-to-buffer-other-window locate-buffer-name))
+        (switch-to-buffer-other-window locate-buffer-name))
 
     (run-hooks 'dired-mode-hook)
     (dired-next-line 3)                        ;move to first matching file.
-    (run-hooks 'locate-post-command-hook)
-    )
-  )
+    (run-hooks 'locate-post-command-hook)))
 
 ;;;###autoload
 (defun locate-with-filter (search-string filter &optional arg)
@@ -464,8 +468,7 @@ do not work in subdirectories.
   (setq major-mode          'locate-mode
         mode-name           "Locate"
         default-directory   "/"
-       buffer-read-only    t
-       selective-display   t)
+       buffer-read-only    t)
   (dired-alist-add-1 default-directory (point-min-marker))
   (set (make-local-variable 'dired-directory) "/")
   (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches)
@@ -473,18 +476,16 @@ 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 "")
   (make-local-variable 'dired-permission-flags-regexp)
   (setq dired-permission-flags-regexp
        (concat "^.\\("
                (make-string (1- locate-filename-indentation) ?\s)
-               "\\)\\|"
-               (default-value 'dired-permission-flags-regexp)))
+               "\\)"))
   (make-local-variable 'revert-buffer-function)
   (setq revert-buffer-function 'locate-update)
   (set (make-local-variable 'page-delimiter) "\n\n")
@@ -523,9 +524,7 @@ do not work in subdirectories.
   (let ((locate-format-string "  /:\n Matches for %s")
        (locate-regexp-match
         (concat " *Matches for \\(" (regexp-quote search-string) "\\)"))
-       (locate-format-args (list search-string))
-       )
-
+       (locate-format-args (list search-string)))
     (and locate-fcodes-file
        (setq locate-format-string
              (concat locate-format-string " in %s")
-- 
Booting /vmemacs.el...

reply via email to

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