>From my previous message:

   The three choices are: no longer pass the arg on, pass the arg on and
   leave it undocumented, sticking with the current state of affairs (no
   visible difference to the user), pass on and properly document.
   Problem with the last two: I do not know how well tested the
   unintentional "feature" is.

In the absence of suggestions, I opted for the first possibility, since
it involves the fewest changes.  This leaves some misfeatures if
`locate-prompt-for-command' is t (this is not the default value).

Below is my suggested patch.  It includes the bugfix patch I suggested
earlier, but did not commit.  I do not know the procedures to follow in
this pretest stage.  Do I commit or let Chong commit it?

===File ~/locate-diff-5=====================================
*** locate.el   21 Apr 2007 00:00:52 -0500      1.42
--- locate.el   22 Apr 2007 14:05:55 -0500      
***************
*** 117,122 ****
--- 117,123 ----
  (defvar locate-current-filter nil)
  (defvar locate-local-filter nil)
  (defvar locate-local-search nil)
+ (defvar locate-local-prompt nil)
  
  (defgroup locate nil
    "Interface to the locate command."
***************
*** 221,227 ****
  
  (defcustom locate-prompt-for-command nil
    "If non-nil, the `locate' command prompts for a command to run.
! Otherwise, that behavior is invoked via a prefix argument."
    :group 'locate
    :type 'boolean)
  
--- 222,231 ----
  
  (defcustom locate-prompt-for-command nil
    "If non-nil, the `locate' command prompts for a command to run.
! Otherwise, that behavior is invoked via a prefix argument.
! 
! Setting this option non-nil actually inverts the meaning of a prefix arg;
! that is, with a prefix arg, you get the default behavior."
    :group 'locate
    :type 'boolean)
  
***************
*** 242,248 ****
         (point)))))
  
  ;;;###autoload
! (defun locate (search-string &optional filter)
    "Run the program `locate', putting results in `*Locate*' buffer.
  Pass it SEARCH-STRING as argument.  Interactively, prompt for SEARCH-STRING.
  With prefix arg, prompt for the exact shell command to run instead.
--- 246,252 ----
         (point)))))
  
  ;;;###autoload
! (defun locate (search-string &optional filter arg)
    "Run the program `locate', putting results in `*Locate*' buffer.
  Pass it SEARCH-STRING as argument.  Interactively, prompt for SEARCH-STRING.
  With prefix arg, prompt for the exact shell command to run instead.
***************
*** 259,265 ****
  the variables `locate-command' or `locate-make-command-line'.
  
  The main use of FILTER is to implement `locate-with-filter'.  See
! the docstring of that function for its meaning."
    (interactive
        (list
         (if (or (and current-prefix-arg
--- 263,271 ----
  the variables `locate-command' or `locate-make-command-line'.
  
  The main use of FILTER is to implement `locate-with-filter'.  See
! the docstring of that function for its meaning.
! 
! ARG is the interactive prefix arg."
    (interactive
        (list
         (if (or (and current-prefix-arg
***************
*** 282,296 ****
                 nil nil nil 'locate-history-list default t)))
               (and (equal input "") default
                    (setq input default))
!              input))))
    (if (equal search-string "")
        (error "Please specify a filename to search for"))
    (let* ((locate-cmd-list (funcall locate-make-command-line search-string))
         (locate-cmd (car locate-cmd-list))
         (locate-cmd-args (cdr locate-cmd-list))
         (run-locate-command
!         (or (and current-prefix-arg (not locate-prompt-for-command))
!             (and (not current-prefix-arg) locate-prompt-for-command)))
         )
  
      ;; Find the Locate buffer
--- 288,305 ----
                 nil nil nil 'locate-history-list default t)))
               (and (equal input "") default
                    (setq input default))
!              input))
!        nil
!        current-prefix-arg))
! 
    (if (equal search-string "")
        (error "Please specify a filename to search for"))
    (let* ((locate-cmd-list (funcall locate-make-command-line search-string))
         (locate-cmd (car locate-cmd-list))
         (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)))
         )
  
      ;; Find the Locate buffer
***************
*** 304,309 ****
--- 313,319 ----
        (setq locate-current-filter filter)
        (set (make-local-variable 'locate-local-search) search-string)
        (set (make-local-variable 'locate-local-filter) filter)
+       (set (make-local-variable 'locate-local-prompt) run-locate-command)
  
        (if run-locate-command
            (shell-command search-string locate-buffer-name)
***************
*** 584,590 ****
    "Revert the *Locate* buffer.
  If `locate-update-when-revert' is non-nil, offer to update the
  locate database using the shell command in `locate-update-command'."
!   (let ((locate-buffer-name (buffer-name)))
      (and locate-update-when-revert
         (yes-or-no-p "Update locate database (may take a few seconds)? ")
         ;; `expand-file-name' is used in order to autoload Tramp if
--- 594,601 ----
    "Revert the *Locate* buffer.
  If `locate-update-when-revert' is non-nil, offer to update the
  locate database using the shell command in `locate-update-command'."
!   (let ((locate-buffer-name (buffer-name))
!       (locate-prompt-for-command locate-local-prompt))
      (and locate-update-when-revert
         (yes-or-no-p "Update locate database (may take a few seconds)? ")
         ;; `expand-file-name' is used in order to autoload Tramp if
============================================================


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to