From 4489531b1ed87111f0848c81c93a7e2c6bcc1323 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 9 Dec 2020 09:18:04 +0100 Subject: [PATCH] Prefer setq-local in dired extensions * lisp/dired-aux.el (dired-diff, dired-compare-directories) (dired-do-create-files, dired-isearch-filenames): * lisp/dired-x.el (dired-virtual, dired-vm): * lisp/wdired.el (wdired-change-to-wdired-mode) (wdired-change-to-dired-mode, wdired-preprocess-perms): --- lisp/dired-aux.el | 10 +++++----- lisp/dired-x.el | 4 ++-- lisp/wdired.el | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 26155190d47..0f68b470733 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -259,7 +259,7 @@ the string of command switches used as the third argument of `diff'." (list (minibuffer-with-setup-hook (lambda () - (set (make-local-variable 'minibuffer-default-add-function) nil) + (setq-local minibuffer-default-add-function nil) (setq minibuffer-default defaults)) (read-file-name (format-prompt "Diff %s with" default current) target-dir default t)) @@ -334,7 +334,7 @@ only in the active region if `dired-mark-region' is non-nil." (defaults (dired-dwim-target-defaults nil target-dir))) (minibuffer-with-setup-hook (lambda () - (set (make-local-variable 'minibuffer-default-add-function) nil) + (setq-local minibuffer-default-add-function nil) (setq minibuffer-default defaults)) (read-directory-name (format "Compare %s with: " (dired-current-directory)) @@ -2049,7 +2049,7 @@ Optional arg HOW-TO determines how to treat the target. (target (expand-file-name ; fluid variable inside dired-create-files (minibuffer-with-setup-hook (lambda () - (set (make-local-variable 'minibuffer-default-add-function) nil) + (setq-local minibuffer-default-add-function nil) (setq minibuffer-default defaults)) (dired-mark-read-file-name (format "%s %%s %s: " @@ -3013,14 +3013,14 @@ is part of a file name (i.e., has the text property `dired-filename')." (defun dired-isearch-filenames () "Search for a string using Isearch only in file names in the Dired buffer." (interactive) - (set (make-local-variable 'dired-isearch-filenames) t) + (setq-local 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) - (set (make-local-variable 'dired-isearch-filenames) t) + (setq-local dired-isearch-filenames t) (isearch-forward-regexp nil t)) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 55077e71882..75e4f466246 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -636,7 +636,7 @@ you can relist single subdirs using \\[dired-do-redisplay]." (dired-mode dirname (or switches dired-listing-switches)) (setq mode-name "Virtual Dired" revert-buffer-function 'dired-virtual-revert) - (set (make-local-variable 'dired-subdir-alist) nil) + (setq-local dired-subdir-alist nil) (dired-build-subdir-alist) (goto-char (point-min)) (dired-initial-position dirname)) @@ -1226,7 +1226,7 @@ Otherwise obeys the value of `dired-vm-read-only-folders'." (and dired-vm-read-only-folders (not (file-writable-p fil))))) ;; So that pressing `v' inside VM does prompt within current directory: - (set (make-local-variable 'vm-folder-directory) dir))) + (setq-local vm-folder-directory dir))) (defun dired-rmail () "Run RMAIL on this file." diff --git a/lisp/wdired.el b/lisp/wdired.el index ebe19613943..b7dd4ee9496 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -242,12 +242,12 @@ See `wdired-mode'." (interactive) (unless (derived-mode-p 'dired-mode) (error "Not a Dired buffer")) - (set (make-local-variable 'wdired-old-content) - (buffer-substring (point-min) (point-max))) - (set (make-local-variable 'wdired-old-marks) - (dired-remember-marks (point-min) (point-max))) - (set (make-local-variable 'wdired-old-point) (point)) - (set (make-local-variable 'query-replace-skip-read-only) t) + (setq-local wdired-old-content + (buffer-substring (point-min) (point-max))) + (setq-local wdired-old-marks + (dired-remember-marks (point-min) (point-max))) + (setq-local wdired-old-point (point)) + (setq-local query-replace-skip-read-only t) (add-function :after-while (local 'isearch-filter-predicate) #'wdired-isearch-filter-read-only) (use-local-map wdired-mode-map) @@ -390,7 +390,7 @@ non-nil means return old filename." (dired-advertise) (remove-hook 'kill-buffer-hook 'wdired-check-kill-buffer t) (remove-hook 'after-change-functions 'wdired--restore-properties t) - (set (make-local-variable 'revert-buffer-function) 'dired-revert)) + (setq-local revert-buffer-function 'dired-revert)) (defun wdired-abort-changes () @@ -834,7 +834,7 @@ Like original function but it skips read-only words." ;; original name and permissions as a property (defun wdired-preprocess-perms () (let ((inhibit-read-only t)) - (set (make-local-variable 'wdired-col-perm) nil) + (setq-local wdired-col-perm nil) (save-excursion (goto-char (point-min)) (while (not (eobp)) -- 2.39.2