[patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end

Filipp Gunbin
Current code calls custom-reevaluate-setting (bug#30187), and that
results in wrong value when dired-isearch-filenames was initialized not
with emacs customization facility, but with plain setq in .emacs.  I
think a temporary local variable is a better way to save & restore the
global setting, WDYT?  In my tests what worked well.

TIA.
Filipp

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 4d7abd1ef6..fb1ad6266d 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2876,7 +2876,7 @@ dired-isearch-filenames-end
   (dired-isearch-filenames-mode -1)
   (remove-hook 'isearch-mode-end-hook #'dired-isearch-filenames-end t)
   (unless isearch-suspended
-    (custom-reevaluate-setting 'dired-isearch-filenames)))
+    (kill-local-variable 'dired-isearch-filenames)))
 
 (defun dired-isearch-filter-filenames (beg end)
   "Test whether some part of the current search match is inside a file name.
@@ -2889,14 +2889,14 @@ dired-isearch-filter-filenames
 (defun dired-isearch-filenames ()
   "Search for a string using Isearch only in file names in the Dired buffer."
   (interactive)
-  (setq dired-isearch-filenames t)
+  (set (make-local-variable 'dired-isearch-filenames) t)
   (isearch-forward nil t))
 
 ;;;###autoload
 (defun dired-isearch-filenames-regexp ()
   "Search for a regexp using Isearch only in file names in the Dired buffer."
   (interactive)
-  (setq dired-isearch-filenames t)
+  (set (make-local-variable 'dired-isearch-filenames) t)
   (isearch-forward-regexp nil t))
 
 

Reply | Threaded
Open this post in threaded view
|

Re: [patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end

Stefan Monnier
> Current code calls custom-reevaluate-setting (bug#30187), and that
> results in wrong value when dired-isearch-filenames was initialized not
> with emacs customization facility, but with plain setq in .emacs.  I
> think a temporary local variable is a better way to save & restore the
> global setting, WDYT?  In my tests what worked well.

Using custom-reevaluate-setting seems like a bad idea here, indeed.
It's really only meant to update settings that were evaluated "too
early" (i.e. during the dump).


        Stefan


Reply | Threaded
Open this post in threaded view
|

Re: [patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end

Filipp Gunbin
Thanks for the review, pushed.
Filipp