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

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

Re: patch for locate.el when called with prefix arg


From: Luc Teirlinck
Subject: Re: patch for locate.el when called with prefix arg
Date: Mon, 23 Apr 2007 12:45:11 -0500 (CDT)

Richard Stallman wrote:

   I think BOTH of these functions should pass the arg along.
   Then behavior will be unchanged.  After the release we could
   document this feature and then get any bugs fixed.

`locate-with-filter' now passes the arg along, all bugs and
misfeatures I was referring to have been fixed and I believe the doc
is clear too.  So for this function things are completely solved.

In as far as `locate-in-alternate-database' is concerned, I can not
test this function since it only works for GNU locate and I have
slocate installed.  Since the docstring does not mention a prefix arg,
I am not even sure that this function can handle one at all.

So the currently committed patch does not pass the arg along.

IF somebody would be able to check that the following patch works OK
in the four combinatorial cases (prefix arg vs no prefix arg,
`locate-prompt-for-command' nil vs t), one could commit the patch
below.  Even so, updating with `g' would probably not work correctly
in the resulting buffer, because it would use the wrong database.
Since I can not check anything and it is not a regression, I will not
try to fix this.

Patch IF somebody can check it as specified above and ONLY in that
case (DANGER otherwise.  Without anybody checking it, I would rather
leave things exactly as they are now.  I do not believe that this is a
widely used command.):

===File ~/locate-diff-new===================================
*** locate.el   23 Apr 2007 11:17:12 -0500      1.43
--- locate.el   23 Apr 2007 12:16:53 -0500      
***************
*** 245,250 ****
--- 245,251 ----
         (skip-chars-backward "." pt)
         (point)))))
  
+ ;; Function for use in interactive declarations.
  (defun locate-prompt-for-search-string ()
    (if (or (and current-prefix-arg
               (not locate-prompt-for-command))
***************
*** 667,682 ****
      file))
  
  ;; Only for GNU locate
! (defun locate-in-alternate-database  (search-string database)
    "Run the GNU locate command, using an alternate database."
    (interactive
!       (list
!        (progn
!        ;; (require 'locate)
!        (read-from-minibuffer "Locate: " nil nil
!                              nil 'locate-history-list))
!        (read-file-name "Locate using Database: " )
!        ))
    (or (file-exists-p database)
        (error "Database file %s does not exist" database))
    (let ((locate-make-command-line
--- 668,680 ----
      file))
  
  ;; Only for GNU locate
! (defun locate-in-alternate-database (search-string database arg)
    "Run the GNU locate command, using an alternate database."
    (interactive
!    (list
!     (locate-prompt-for-search-string)
!     (read-file-name "Locate using Database: " )
!     current-prefix-arg))
    (or (file-exists-p database)
        (error "Database file %s does not exist" database))
    (let ((locate-make-command-line
***************
*** 685,691 ****
                           (list (concat "--database="
                                         (expand-file-name database))
                                 string))))))
!     (locate search-string)))
  
  (defun locate-do-redisplay (&optional arg test-for-subdir)
    "Like `dired-do-redisplay', but adapted for `*Locate*' buffers."
--- 683,689 ----
                           (list (concat "--database="
                                         (expand-file-name database))
                                 string))))))
!     (locate search-string nil arg)))
  
  (defun locate-do-redisplay (&optional arg test-for-subdir)
    "Like `dired-do-redisplay', but adapted for `*Locate*' buffers."
============================================================




reply via email to

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