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: Fri, 20 Apr 2007 20:58:31 -0500 (CDT)

   After studying the patch that introduced this, it seems to me that the
   one line

     (buffer-disable-undo)

   in locate.el:472 was sneaked in without further justification.

As was other stuff that causes bugs too.

   Luc, could you test if removing this line solves your problem?  Also,
   could you see if the original problem addressed by this patch, i.e.

It solves one of the two bugs I reported but not the other.  It leaves
very strange looking code in locate.el, which I suspect to have other
problems than the ones we yet know about.

   Also,
   could you see if the original problem addressed by this patch, i.e.

     Reverting Locate mode buffers (via locate-update) currently ignores
     filters from locate-with-filter.  It also doesn't work with uniquely
     renamed buffers, or when locate has been called non-interactively
     (e.g., from eshell/locate) and locate-history-list and
     locate-grep-history-list aren't modified.

   remains solved after removing that line?

What I did test was that reverting the changes in revisions 1.38 and
1.40 (the one from today) and then applying the patch below, not only
solves the three bugs reported today, but also solves the three
problems described in the above paragraph.  The first two, I checked.
The third one I could not actually check, because I do not use eshell,
but it _should_ be fixed, as my patch eliminates dependence from these
history lists.

Note that my patch below only changes six lines (4 trivial and 2 very
simple) compared to 1.37, whereas 1.38 changes 40 lines in a complex
way.  All problems which 1.38 tried to solve concerned only the
function locate-update.  My patch affects only that function.
Rev 1.38 affected all of locate, causing various bugs.

Patch to be applied _after_ reverting revisions 1.37 and 1.40:

===File ~/locate-diff-2=====================================
*** locate.el   20 Apr 2007 18:51:04 -0500      1.37
--- locate.el   20 Apr 2007 20:37:21 -0500      
***************
*** 115,120 ****
--- 115,122 ----
  ;; Variables
  
  (defvar locate-current-filter nil)
+ (defvar locate-local-filter nil)
+ (defvar locate-local-search nil)
  
  (defgroup locate nil
    "Interface to the locate command."
***************
*** 300,305 ****
--- 302,309 ----
        (erase-buffer)
  
        (setq locate-current-filter filter)
+       (set (make-local-variable 'locate-local-search) search-string)
+       (set (make-local-variable 'locate-local-filter) filter)
  
        (if run-locate-command
            (shell-command search-string locate-buffer-name)
***************
*** 580,586 ****
    "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 ((str (car locate-history-list)))
      (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
--- 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
***************
*** 588,594 ****
         ;; is remote.
         (let ((default-directory (expand-file-name locate-update-path)))
           (shell-command locate-update-command)))
!     (locate str)))
  
  ;;; Modified three functions from `dired.el':
  ;;;   dired-find-directory,
--- 592,598 ----
         ;; is remote.
         (let ((default-directory (expand-file-name locate-update-path)))
           (shell-command locate-update-command)))
!     (locate locate-local-search locate-local-filter)))
  
  ;;; Modified three functions from `dired.el':
  ;;;   dired-find-directory,
============================================================





reply via email to

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