diff options
| author | Stefan Kangas | 2020-12-08 08:18:59 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2020-12-08 08:52:42 +0100 |
| commit | 478368ad4fe43b02b8a7e91c7dbec1ac1afc4d68 (patch) | |
| tree | 3262ddbb0fec57bcb1fb55c67625da037cdd6d71 | |
| parent | 0155bd0fdb166c97a2ce76cc5bc64fd195a676d3 (diff) | |
| download | emacs-478368ad4fe43b02b8a7e91c7dbec1ac1afc4d68.tar.gz emacs-478368ad4fe43b02b8a7e91c7dbec1ac1afc4d68.zip | |
Prefer setq-local in simple.el
* lisp/simple.el (read-extended-command, goto-history-element)
(minibuffer-history-isearch-setup, read-shell-command)
(visual-line-mode, completion-setup-function, read-only-mode)
(visible-mode): Prefer setq-local.
| -rw-r--r-- | lisp/simple.el | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 3c4f7562308..dd271b0b5dd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1922,7 +1922,7 @@ to get different commands to edit and resubmit." | |||
| 1922 | (setq execute-extended-command--last-typed | 1922 | (setq execute-extended-command--last-typed |
| 1923 | (minibuffer-contents))) | 1923 | (minibuffer-contents))) |
| 1924 | nil 'local) | 1924 | nil 'local) |
| 1925 | (set (make-local-variable 'minibuffer-default-add-function) | 1925 | (setq-local minibuffer-default-add-function |
| 1926 | (lambda () | 1926 | (lambda () |
| 1927 | ;; Get a command name at point in the original buffer | 1927 | ;; Get a command name at point in the original buffer |
| 1928 | ;; to propose it after M-n. | 1928 | ;; to propose it after M-n. |
| @@ -2372,10 +2372,10 @@ negative number -N means the Nth entry of \"future history.\"" | |||
| 2372 | (unless (memq last-command '(next-history-element | 2372 | (unless (memq last-command '(next-history-element |
| 2373 | previous-history-element)) | 2373 | previous-history-element)) |
| 2374 | (let ((prompt-end (minibuffer-prompt-end))) | 2374 | (let ((prompt-end (minibuffer-prompt-end))) |
| 2375 | (set (make-local-variable 'minibuffer-temporary-goal-position) | 2375 | (setq-local minibuffer-temporary-goal-position |
| 2376 | (cond ((<= (point) prompt-end) prompt-end) | 2376 | (cond ((<= (point) prompt-end) prompt-end) |
| 2377 | ((eobp) nil) | 2377 | ((eobp) nil) |
| 2378 | (t (point)))))) | 2378 | (t (point)))))) |
| 2379 | (goto-char (point-max)) | 2379 | (goto-char (point-max)) |
| 2380 | (delete-minibuffer-contents) | 2380 | (delete-minibuffer-contents) |
| 2381 | (setq minibuffer-history-position nabs) | 2381 | (setq minibuffer-history-position nabs) |
| @@ -2548,14 +2548,14 @@ Return 0 if current buffer is not a minibuffer." | |||
| 2548 | (defun minibuffer-history-isearch-setup () | 2548 | (defun minibuffer-history-isearch-setup () |
| 2549 | "Set up a minibuffer for using isearch to search the minibuffer history. | 2549 | "Set up a minibuffer for using isearch to search the minibuffer history. |
| 2550 | Intended to be added to `minibuffer-setup-hook'." | 2550 | Intended to be added to `minibuffer-setup-hook'." |
| 2551 | (set (make-local-variable 'isearch-search-fun-function) | 2551 | (setq-local isearch-search-fun-function |
| 2552 | 'minibuffer-history-isearch-search) | 2552 | #'minibuffer-history-isearch-search) |
| 2553 | (set (make-local-variable 'isearch-message-function) | 2553 | (setq-local isearch-message-function |
| 2554 | 'minibuffer-history-isearch-message) | 2554 | #'minibuffer-history-isearch-message) |
| 2555 | (set (make-local-variable 'isearch-wrap-function) | 2555 | (setq-local isearch-wrap-function |
| 2556 | 'minibuffer-history-isearch-wrap) | 2556 | #'minibuffer-history-isearch-wrap) |
| 2557 | (set (make-local-variable 'isearch-push-state-function) | 2557 | (setq-local isearch-push-state-function |
| 2558 | 'minibuffer-history-isearch-push-state) | 2558 | #'minibuffer-history-isearch-push-state) |
| 2559 | (add-hook 'isearch-mode-end-hook 'minibuffer-history-isearch-end nil t)) | 2559 | (add-hook 'isearch-mode-end-hook 'minibuffer-history-isearch-end nil t)) |
| 2560 | 2560 | ||
| 2561 | (defun minibuffer-history-isearch-end () | 2561 | (defun minibuffer-history-isearch-end () |
| @@ -3585,8 +3585,8 @@ to `shell-command-history'." | |||
| 3585 | (minibuffer-with-setup-hook | 3585 | (minibuffer-with-setup-hook |
| 3586 | (lambda () | 3586 | (lambda () |
| 3587 | (shell-completion-vars) | 3587 | (shell-completion-vars) |
| 3588 | (set (make-local-variable 'minibuffer-default-add-function) | 3588 | (setq-local minibuffer-default-add-function |
| 3589 | 'minibuffer-default-add-shell-commands)) | 3589 | #'minibuffer-default-add-shell-commands)) |
| 3590 | (apply #'read-from-minibuffer prompt initial-contents | 3590 | (apply #'read-from-minibuffer prompt initial-contents |
| 3591 | minibuffer-local-shell-command-map | 3591 | minibuffer-local-shell-command-map |
| 3592 | nil | 3592 | nil |
| @@ -7431,8 +7431,8 @@ Mode' for details." | |||
| 7431 | (if (local-variable-p var) | 7431 | (if (local-variable-p var) |
| 7432 | (push (cons var (symbol-value var)) | 7432 | (push (cons var (symbol-value var)) |
| 7433 | visual-line--saved-state)))) | 7433 | visual-line--saved-state)))) |
| 7434 | (set (make-local-variable 'line-move-visual) t) | 7434 | (setq-local line-move-visual t) |
| 7435 | (set (make-local-variable 'truncate-partial-width-windows) nil) | 7435 | (setq-local truncate-partial-width-windows nil) |
| 7436 | (setq truncate-lines nil | 7436 | (setq truncate-lines nil |
| 7437 | word-wrap t | 7437 | word-wrap t |
| 7438 | fringe-indicator-alist | 7438 | fringe-indicator-alist |
| @@ -8825,10 +8825,9 @@ Called from `temp-buffer-show-hook'." | |||
| 8825 | (let ((base-position completion-base-position) | 8825 | (let ((base-position completion-base-position) |
| 8826 | (insert-fun completion-list-insert-choice-function)) | 8826 | (insert-fun completion-list-insert-choice-function)) |
| 8827 | (completion-list-mode) | 8827 | (completion-list-mode) |
| 8828 | (set (make-local-variable 'completion-base-position) base-position) | 8828 | (setq-local completion-base-position base-position) |
| 8829 | (set (make-local-variable 'completion-list-insert-choice-function) | 8829 | (setq-local completion-list-insert-choice-function insert-fun)) |
| 8830 | insert-fun)) | 8830 | (setq-local completion-reference-buffer mainbuf) |
| 8831 | (set (make-local-variable 'completion-reference-buffer) mainbuf) | ||
| 8832 | (if base-dir (setq default-directory base-dir)) | 8831 | (if base-dir (setq default-directory base-dir)) |
| 8833 | (when completion-tab-width | 8832 | (when completion-tab-width |
| 8834 | (setq tab-width completion-tab-width)) | 8833 | (setq tab-width completion-tab-width)) |
| @@ -9288,8 +9287,7 @@ to a non-nil value." | |||
| 9288 | (cond | 9287 | (cond |
| 9289 | ((and (not buffer-read-only) view-mode) | 9288 | ((and (not buffer-read-only) view-mode) |
| 9290 | (View-exit-and-edit) | 9289 | (View-exit-and-edit) |
| 9291 | (make-local-variable 'view-read-only) | 9290 | (setq-local view-read-only t)) ; Must leave view mode. |
| 9292 | (setq view-read-only t)) ; Must leave view mode. | ||
| 9293 | ((and buffer-read-only view-read-only | 9291 | ((and buffer-read-only view-read-only |
| 9294 | ;; If view-mode is already active, `view-mode-enter' is a nop. | 9292 | ;; If view-mode is already active, `view-mode-enter' is a nop. |
| 9295 | (not view-mode) | 9293 | (not view-mode) |
| @@ -9307,8 +9305,8 @@ and setting it to nil." | |||
| 9307 | (setq buffer-invisibility-spec vis-mode-saved-buffer-invisibility-spec) | 9305 | (setq buffer-invisibility-spec vis-mode-saved-buffer-invisibility-spec) |
| 9308 | (kill-local-variable 'vis-mode-saved-buffer-invisibility-spec)) | 9306 | (kill-local-variable 'vis-mode-saved-buffer-invisibility-spec)) |
| 9309 | (when visible-mode | 9307 | (when visible-mode |
| 9310 | (set (make-local-variable 'vis-mode-saved-buffer-invisibility-spec) | 9308 | (setq-local vis-mode-saved-buffer-invisibility-spec |
| 9311 | buffer-invisibility-spec) | 9309 | buffer-invisibility-spec) |
| 9312 | (setq buffer-invisibility-spec nil))) | 9310 | (setq buffer-invisibility-spec nil))) |
| 9313 | 9311 | ||
| 9314 | (defvar messages-buffer-mode-map | 9312 | (defvar messages-buffer-mode-map |