unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end
@ 2019-11-28 14:13 Filipp Gunbin
  2019-11-28 16:07 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Filipp Gunbin @ 2019-11-28 14:13 UTC (permalink / raw)
  To: emacs-devel; +Cc: juri

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))
 
 \f



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end
  2019-11-28 14:13 [patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end Filipp Gunbin
@ 2019-11-28 16:07 ` Stefan Monnier
  2019-11-28 22:00   ` Filipp Gunbin
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2019-11-28 16:07 UTC (permalink / raw)
  To: emacs-devel; +Cc: juri

> 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end
  2019-11-28 16:07 ` Stefan Monnier
@ 2019-11-28 22:00   ` Filipp Gunbin
  0 siblings, 0 replies; 3+ messages in thread
From: Filipp Gunbin @ 2019-11-28 22:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: juri, emacs-devel

Thanks for the review, pushed.
Filipp



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-28 22:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-28 14:13 [patch, review request] better dired-isearch-filenames reset in dired-isearch-filenames-end Filipp Gunbin
2019-11-28 16:07 ` Stefan Monnier
2019-11-28 22:00   ` Filipp Gunbin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).