emacs-devel
[Top][All Lists]
Advanced

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

Re: locate-with-filter


From: Luc Teirlinck
Subject: Re: locate-with-filter
Date: Sun, 12 Mar 2006 18:18:05 -0600 (CST)

The following might be better than my previous patch:

===File ~/locate-diff=======================================
*** locate.el   06 Feb 2006 16:01:50 -0600      1.35
--- locate.el   12 Mar 2006 18:20:10 -0600      
***************
*** 190,196 ****
  
  ;;;###autoload
  (defun locate (search-string &optional filter)
!   "Run the program `locate', putting results in `*Locate*' buffer.
  With prefix arg, prompt for the locate command to run."
    (interactive
        (list
--- 190,196 ----
  
  ;;;###autoload
  (defun locate (search-string &optional filter)
!   "Run the locate program, putting results in `*Locate*' buffer.
  With prefix arg, prompt for the locate command to run."
    (interactive
        (list
***************
*** 255,264 ****
  
  ;;;###autoload
  (defun locate-with-filter (search-string filter)
!   "Run the locate command with a filter.
  
! The filter is a regular expression. Only results matching the filter are
! shown; this is often useful to constrain a big search."
    (interactive
     (list (read-from-minibuffer "Locate: " nil nil
                               nil 'locate-history-list)
--- 255,270 ----
  
  ;;;###autoload
  (defun locate-with-filter (search-string filter)
!   "Run the locate program with a filter.
  
! When invoked interactively, this command prompts for both SEARCH-STRING
! and FILTER.  It passes SEARCH-STRING to the locate program.
! It only shows those lines in the output of the locate program
! that contain a match for the regular expression FILTER in the
! `*Locate*' buffer; this is often useful to constrain a big search.
! 
! When called from Lisp, this function is identical with `locate',
! except that FILTER is not optional."
    (interactive
     (list (read-from-minibuffer "Locate: " nil nil
                               nil 'locate-history-list)
***************
*** 269,275 ****
  (defun locate-filter-output (filter)
    "Filter output from the locate command."
    (goto-char (point-min))
!   (delete-non-matching-lines filter))
  
  (defvar locate-mode-map nil
    "Local keymap for Locate mode buffers.")
--- 275,281 ----
  (defun locate-filter-output (filter)
    "Filter output from the locate command."
    (goto-char (point-min))
!   (keep-lines filter))
  
  (defvar locate-mode-map nil
    "Local keymap for Locate mode buffers.")
============================================================




reply via email to

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