]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer setq-local in eshell
authorStefan Kangas <stefan@marxist.se>
Fri, 4 Dec 2020 09:55:50 +0000 (10:55 +0100)
committerStefan Kangas <stefan@marxist.se>
Fri, 4 Dec 2020 09:55:56 +0000 (10:55 +0100)
* lisp/eshell/em-cmpl.el (eshell-cmpl-initialize):
* lisp/eshell/em-dirs.el (eshell-dirs-initialize):
* lisp/eshell/em-glob.el (eshell-glob-initialize, eshell-glob-regexp):
* lisp/eshell/em-hist.el (eshell-hist-initialize):
* lisp/eshell/em-prompt.el (eshell-prompt-initialize):
* lisp/eshell/em-rebind.el (eshell-rebind-initialize)
(eshell-setup-input-keymap):
* lisp/eshell/em-script.el (eshell-script-initialize):
* lisp/eshell/em-smart.el (eshell-smart-initialize):
* lisp/eshell/em-term.el (eshell-term-initialize, eshell-exec-visual):
* lisp/eshell/em-tramp.el (eshell-tramp-initialize):
* lisp/eshell/em-unix.el (eshell-unix-initialize, eshell/diff):
* lisp/eshell/esh-arg.el (eshell-arg-initialize):
* lisp/eshell/esh-cmd.el (eshell-cmd-initialize):
* lisp/eshell/esh-io.el (eshell-get-target):
* lisp/eshell/esh-mode.el (eshell-mode):
* lisp/eshell/esh-var.el (eshell-var-initialize): Prefer setq-local.

16 files changed:
lisp/eshell/em-cmpl.el
lisp/eshell/em-dirs.el
lisp/eshell/em-glob.el
lisp/eshell/em-hist.el
lisp/eshell/em-prompt.el
lisp/eshell/em-rebind.el
lisp/eshell/em-script.el
lisp/eshell/em-smart.el
lisp/eshell/em-term.el
lisp/eshell/em-tramp.el
lisp/eshell/em-unix.el
lisp/eshell/esh-arg.el
lisp/eshell/esh-cmd.el
lisp/eshell/esh-io.el
lisp/eshell/esh-mode.el
lisp/eshell/esh-var.el

index 53a0cda354ec148e1736a041e2a6bc3cb91d35a3..d0d7aff7720fe9ad9e3f4979e2cf768740de1d90 100644 (file)
@@ -267,48 +267,48 @@ to writing a completion function."
 
 (defun eshell-cmpl-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the completions module."
-  (set (make-local-variable 'pcomplete-command-completion-function)
-       eshell-command-completion-function)
-  (set (make-local-variable 'pcomplete-command-name-function)
-       eshell-cmpl-command-name-function)
-  (set (make-local-variable 'pcomplete-default-completion-function)
-       eshell-default-completion-function)
-  (set (make-local-variable 'pcomplete-parse-arguments-function)
-       'eshell-complete-parse-arguments)
-  (set (make-local-variable 'pcomplete-file-ignore)
-       eshell-cmpl-file-ignore)
-  (set (make-local-variable 'pcomplete-dir-ignore)
-       eshell-cmpl-dir-ignore)
-  (set (make-local-variable 'pcomplete-ignore-case)
-       eshell-cmpl-ignore-case)
-  (set (make-local-variable 'pcomplete-autolist)
-       eshell-cmpl-autolist)
+  (setq-local pcomplete-command-completion-function
+              eshell-command-completion-function)
+  (setq-local pcomplete-command-name-function
+              eshell-cmpl-command-name-function)
+  (setq-local pcomplete-default-completion-function
+              eshell-default-completion-function)
+  (setq-local pcomplete-parse-arguments-function
+              'eshell-complete-parse-arguments)
+  (setq-local pcomplete-file-ignore
+              eshell-cmpl-file-ignore)
+  (setq-local pcomplete-dir-ignore
+              eshell-cmpl-dir-ignore)
+  (setq-local pcomplete-ignore-case
+              eshell-cmpl-ignore-case)
+  (setq-local pcomplete-autolist
+              eshell-cmpl-autolist)
   (if (boundp 'pcomplete-suffix-list)
-      (set (make-local-variable 'pcomplete-suffix-list)
-           eshell-cmpl-suffix-list))
-  (set (make-local-variable 'pcomplete-recexact)
-       eshell-cmpl-recexact)
-  (set (make-local-variable 'pcomplete-man-function)
-       eshell-cmpl-man-function)
-  (set (make-local-variable 'pcomplete-compare-entry-function)
-       eshell-cmpl-compare-entry-function)
-  (set (make-local-variable 'pcomplete-expand-before-complete)
-       eshell-cmpl-expand-before-complete)
-  (set (make-local-variable 'pcomplete-cycle-completions)
-       eshell-cmpl-cycle-completions)
-  (set (make-local-variable 'pcomplete-cycle-cutoff-length)
-       eshell-cmpl-cycle-cutoff-length)
-  (set (make-local-variable 'pcomplete-restore-window-delay)
-       eshell-cmpl-restore-window-delay)
-  (set (make-local-variable 'pcomplete-use-paring)
-       eshell-cmpl-use-paring)
+      (setq-local pcomplete-suffix-list
+                  eshell-cmpl-suffix-list))
+  (setq-local pcomplete-recexact
+              eshell-cmpl-recexact)
+  (setq-local pcomplete-man-function
+              eshell-cmpl-man-function)
+  (setq-local pcomplete-compare-entry-function
+              eshell-cmpl-compare-entry-function)
+  (setq-local pcomplete-expand-before-complete
+              eshell-cmpl-expand-before-complete)
+  (setq-local pcomplete-cycle-completions
+              eshell-cmpl-cycle-completions)
+  (setq-local pcomplete-cycle-cutoff-length
+              eshell-cmpl-cycle-cutoff-length)
+  (setq-local pcomplete-restore-window-delay
+              eshell-cmpl-restore-window-delay)
+  (setq-local pcomplete-use-paring
+              eshell-cmpl-use-paring)
   ;; `comint-file-name-quote-list' should only be set after all the
   ;; load-hooks for any other extension modules have been run, which
   ;; is true at the time `eshell-mode-hook' is run
   (add-hook 'eshell-mode-hook
             (lambda ()
-              (set (make-local-variable 'comint-file-name-quote-list)
-                   eshell-special-chars-outside-quoting))
+              (setq-local comint-file-name-quote-list
+                          eshell-special-chars-outside-quoting))
             nil t)
   (add-hook 'pcomplete-quote-arg-hook #'eshell-quote-backslash nil t)
   (add-hook 'completion-at-point-functions
index b4ed3794add1f207b7fabb285eaec1fcd1954aab..c0c253902562f4a2301298cc2be294ecd5519c5c 100644 (file)
@@ -175,8 +175,7 @@ Thus, this does not include the current directory.")
 
 (defun eshell-dirs-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the builtin functions for Eshell."
-  (make-local-variable 'eshell-variable-aliases-list)
-  (setq eshell-variable-aliases-list
+  (setq-local eshell-variable-aliases-list
        (append
         eshell-variable-aliases-list
          `(("-" ,(lambda (indices)
@@ -199,8 +198,7 @@ Thus, this does not include the current directory.")
             t))))
 
   (when eshell-cd-on-directory
-    (make-local-variable 'eshell-interpreter-alist)
-    (setq eshell-interpreter-alist
+    (setq-local eshell-interpreter-alist
          (cons (cons #'(lambda (file _args)
                           (eshell-lone-directory-p file))
                      'eshell-dirs-substitute-cd)
index a32a6abe29c301064bff9b181fd65cef052c1995..9ae2dd94ecfe52c4169be98e58e6e0e0e48bbc9f 100644 (file)
@@ -129,7 +129,7 @@ This option slows down recursive glob processing by quite a bit."
   "Initialize the extended globbing code."
   ;; it's important that `eshell-glob-chars-list' come first
   (when (boundp 'eshell-special-chars-outside-quoting)
-    (set (make-local-variable 'eshell-special-chars-outside-quoting)
+    (setq-local eshell-special-chars-outside-quoting
         (append eshell-glob-chars-list eshell-special-chars-outside-quoting)))
   (add-hook 'eshell-parse-argument-hook 'eshell-parse-glob-chars t t)
   (add-hook 'eshell-pre-rewrite-command-hook
@@ -205,7 +205,7 @@ resulting regular expression."
        regexp)
     (while (string-match
            (or eshell-glob-chars-regexp
-               (set (make-local-variable 'eshell-glob-chars-regexp)
+                (setq-local eshell-glob-chars-regexp
                     (format "[%s]+" (apply 'string eshell-glob-chars-list))))
            pattern matched-in-pattern)
       (let* ((op-begin (match-beginning 0))
index c27e4503767003758c3e63a3cb7b4f1a51284fdf..490b8b679c1518b40ad678f63074519c80f89e77 100644 (file)
@@ -243,11 +243,10 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
   (if (and (eshell-using-module 'eshell-rebind)
           (not eshell-non-interactive-p))
       (let ((rebind-alist eshell-rebind-keys-alist))
-       (make-local-variable 'eshell-rebind-keys-alist)
-       (setq eshell-rebind-keys-alist
+        (setq-local eshell-rebind-keys-alist
              (append rebind-alist eshell-hist-rebind-keys-alist))
-       (set (make-local-variable 'search-invisible) t)
-       (set (make-local-variable 'search-exit-option) t)
+        (setq-local search-invisible t)
+        (setq-local search-exit-option t)
        (add-hook 'isearch-mode-hook
                   (lambda ()
                     (if (>= (point) eshell-last-output-end)
@@ -278,8 +277,8 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
   (make-local-variable 'eshell-save-history-index)
 
   (if (minibuffer-window-active-p (selected-window))
-      (set (make-local-variable 'eshell-save-history-on-exit) nil)
-    (set (make-local-variable 'eshell-history-ring) nil)
+      (setq-local eshell-save-history-on-exit nil)
+    (setq-local eshell-history-ring nil)
     (if eshell-history-file-name
        (eshell-read-history nil t))
 
index dcee1e7a9819b64ccc12200d9cb96f605a18f78e..c6afc5a240d9a44009b5458feaa4670c4babf659 100644 (file)
@@ -117,10 +117,9 @@ arriving, or after."
 
     (make-local-variable 'eshell-prompt-regexp)
     (if eshell-prompt-regexp
-       (set (make-local-variable 'paragraph-start) eshell-prompt-regexp))
+        (setq-local paragraph-start eshell-prompt-regexp))
 
-    (set (make-local-variable 'eshell-skip-prompt-function)
-        'eshell-skip-prompt)
+    (setq-local eshell-skip-prompt-function #'eshell-skip-prompt)
     (eshell-prompt-mode)))
 
 (defun eshell-emit-prompt ()
index 7991c631772a188ac3846a3fa3e0b80ae851006a..ab1021168770920fbbccf9d4a8f1f514f13d4886 100644 (file)
@@ -163,7 +163,7 @@ This is default behavior of shells like bash."
     (add-hook 'pre-command-hook 'eshell-save-previous-point nil t)
     (make-local-variable 'overriding-local-map)
     (add-hook 'post-command-hook 'eshell-rebind-input-map nil t)
-    (set (make-local-variable 'eshell-lock-keymap) nil)
+    (setq-local eshell-lock-keymap nil)
     (eshell-rebind-mode)))
 
 (defun eshell-lock-local-map (&optional arg)
@@ -219,8 +219,7 @@ lock it at that."
 
 (defun eshell-setup-input-keymap ()
   "Setup the input keymap to be used during input editing."
-  (make-local-variable 'eshell-input-keymap)
-  (setq eshell-input-keymap (make-sparse-keymap))
+  (setq-local eshell-input-keymap (make-sparse-keymap))
   (set-keymap-parent eshell-input-keymap eshell-mode-map)
   (let ((bindings eshell-rebind-keys-alist))
     (while bindings
index 5c2f145f595bb2e44e8e5bb8e5cc0e526c512c70..857ae6a47555a6ef0e14d6acc4729752c3914ae0 100644 (file)
@@ -58,15 +58,13 @@ This includes when running `eshell-command'."
 
 (defun eshell-script-initialize ()  ;Called from `eshell-mode' via intern-soft!
   "Initialize the script parsing code."
-  (make-local-variable 'eshell-interpreter-alist)
-  (setq eshell-interpreter-alist
+  (setq-local eshell-interpreter-alist
        (cons (cons #'(lambda (file _args)
                         (string= (file-name-nondirectory file)
                                  "eshell"))
                     'eshell/source)
              eshell-interpreter-alist))
-  (make-local-variable 'eshell-complex-commands)
-  (setq eshell-complex-commands
+  (setq-local eshell-complex-commands
        (append '("source" ".") eshell-complex-commands))
   ;; these two variables are changed through usage, but we don't want
   ;; to ruin it for other modules
index a28bb1d641502fc1ff14cbbd1b47a8f62bdfa30c..8bc88f2f4bc263c23705668297901194f74eb56e 100644 (file)
@@ -170,9 +170,9 @@ The options are `begin', `after' or `end'."
   (unless eshell-non-interactive-p
     ;; override a few variables, since they would interfere with the
     ;; smart display functionality.
-    (set (make-local-variable 'eshell-scroll-to-bottom-on-output) nil)
-    (set (make-local-variable 'eshell-scroll-to-bottom-on-input) nil)
-    (set (make-local-variable 'eshell-scroll-show-maximum-output) t)
+    (setq-local eshell-scroll-to-bottom-on-output nil)
+    (setq-local eshell-scroll-to-bottom-on-input nil)
+    (setq-local eshell-scroll-show-maximum-output t)
 
     (add-hook 'window-scroll-functions 'eshell-smart-scroll-window nil t)
     (add-hook 'window-configuration-change-hook 'eshell-refresh-windows)
index f52b3cda73b4013df044f5b6c2b7d6d1df4f5fb5..be91cf7977465d7df4b4253d4a6d775c80fc2fec 100644 (file)
@@ -143,8 +143,7 @@ behavior for short-lived processes, see bug#18108."
 
 (defun eshell-term-initialize ()    ;Called from `eshell-mode' via intern-soft!
   "Initialize the `term' interface code."
-  (make-local-variable 'eshell-interpreter-alist)
-  (setq eshell-interpreter-alist
+  (setq-local eshell-interpreter-alist
        (cons (cons #'eshell-visual-command-p
                    'eshell-exec-visual)
              eshell-interpreter-alist)))
@@ -179,9 +178,8 @@ allowed."
     (save-current-buffer
       (switch-to-buffer term-buf)
       (term-mode)
-      (set (make-local-variable 'term-term-name) eshell-term-name)
-      (make-local-variable 'eshell-parent-buffer)
-      (setq eshell-parent-buffer eshell-buf)
+      (setq-local term-term-name eshell-term-name)
+      (setq-local eshell-parent-buffer eshell-buf)
       (term-exec term-buf program program nil args)
       (let ((proc (get-buffer-process term-buf)))
        (if (and proc (eq 'run (process-status proc)))
index 01f7038e46240f8ddcc451bbb898fe150bc544c9..c2d3c3edce2bcc85a3b38bdf67a3a9058f18cd9d 100644 (file)
   (when (eshell-using-module 'eshell-cmpl)
     (add-hook 'pcomplete-try-first-hook
              'eshell-complete-host-reference nil t))
-  (make-local-variable 'eshell-complex-commands)
-  (setq eshell-complex-commands
-       (append '("su" "sudo")
-               eshell-complex-commands)))
+  (setq-local eshell-complex-commands
+              (append '("su" "sudo")
+                      eshell-complex-commands)))
 
 (autoload 'eshell-parse-command "esh-cmd")
 
index c66f307bfeeb33a1eaf6a2c72cacf17d351df25d..2d6bd32b5a23c623f5618517ff1b57070d55ebdf 100644 (file)
@@ -144,8 +144,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine."
   (when (eshell-using-module 'eshell-cmpl)
     (add-hook 'pcomplete-try-first-hook
              'eshell-complete-host-reference nil t))
-  (make-local-variable 'eshell-complex-commands)
-  (setq eshell-complex-commands
+  (setq-local eshell-complex-commands
        (append '("grep" "egrep" "fgrep" "agrep" "glimpse" "locate"
                  "cat" "time" "cp" "mv" "make" "du" "diff")
                eshell-complex-commands)))
@@ -1008,7 +1007,7 @@ Show wall-clock time elapsed during execution of COMMAND.")
             (lambda (buff _msg)
                (with-current-buffer buff
                  (diff-mode)
-                 (set (make-local-variable 'eshell-diff-window-config) config)
+                  (setq-local eshell-diff-window-config config)
                  (local-set-key [?q] #'eshell-diff-quit)
                  (if (fboundp 'turn-on-font-lock-if-enabled)
                      (turn-on-font-lock-if-enabled))
index aefda647689aac10fb975c480c74d69c35f12518..cecb6f7918f2fe11958033e4b9011e1b3f6fe8a7 100644 (file)
@@ -168,8 +168,8 @@ treated as a literal character."
 (defun eshell-arg-initialize ()     ;Called from `eshell-mode' via intern-soft!
   "Initialize the argument parsing code."
   (eshell-arg-mode)
-  (set (make-local-variable 'eshell-inside-quote-regexp) nil)
-  (set (make-local-variable 'eshell-outside-quote-regexp) nil))
+  (setq-local eshell-inside-quote-regexp nil)
+  (setq-local eshell-outside-quote-regexp nil))
 
 (defun eshell-insert-buffer-name (buffer-name)
   "Insert BUFFER-NAME into the current buffer at point."
index 68b34837a23def7796e7bc092f1bc177dea50524..81124413a42b680c4fea0a194e3bd26141dd21da 100644 (file)
@@ -290,12 +290,12 @@ otherwise t.")
 
 (defun eshell-cmd-initialize ()     ;Called from `eshell-mode' via intern-soft!
   "Initialize the Eshell command processing module."
-  (set (make-local-variable 'eshell-current-command) nil)
-  (set (make-local-variable 'eshell-command-name) nil)
-  (set (make-local-variable 'eshell-command-arguments) nil)
-  (set (make-local-variable 'eshell-last-arguments) nil)
-  (set (make-local-variable 'eshell-last-command-name) nil)
-  (set (make-local-variable 'eshell-last-async-proc) nil)
+  (setq-local eshell-current-command nil)
+  (setq-local eshell-command-name nil)
+  (setq-local eshell-command-arguments nil)
+  (setq-local eshell-last-arguments nil)
+  (setq-local eshell-last-command-name nil)
+  (setq-local eshell-last-async-proc nil)
 
   (add-hook 'eshell-kill-hook #'eshell-resume-command nil t)
 
index b0443a4acee70dfe4c394bd26de1cd889f589f57..de41fccc1f59a808ce96e2c5293c625f7e0342d8 100644 (file)
@@ -344,8 +344,8 @@ it defaults to `insert'."
            (if buffer-file-read-only
                (error "Cannot write to read-only file `%s'" target))
            (setq buffer-read-only nil)
-           (set (make-local-variable 'eshell-output-file-buffer)
-                (if (eq exists buf) 0 t))
+            (setq-local eshell-output-file-buffer
+                        (if (eq exists buf) 0 t))
            (cond ((eq mode 'overwrite)
                   (erase-buffer))
                  ((eq mode 'append)
index a80c2fc60d95312d9b65b66365c5c579ed806771..e2ec7101f3dbdf2e15385147f42af34f11c37a14 100644 (file)
@@ -312,45 +312,40 @@ and the hook `eshell-exit-hook'."
       (if mode-line-elt
          (setcar mode-line-elt 'eshell-command-running-string))))
 
-  (set (make-local-variable 'bookmark-make-record-function)
-       'eshell-bookmark-make-record)
+  (setq-local bookmark-make-record-function #'eshell-bookmark-make-record)
   (setq local-abbrev-table eshell-mode-abbrev-table)
 
-  (set (make-local-variable 'list-buffers-directory)
-       (expand-file-name default-directory))
+  (setq-local list-buffers-directory (expand-file-name default-directory))
 
   ;; always set the tab width to 8 in Eshell buffers, since external
   ;; commands which do their own formatting almost always expect this
-  (set (make-local-variable 'tab-width) 8)
+  (setq-local tab-width 8)
 
   ;; don't ever use auto-fill in Eshell buffers
   (setq auto-fill-function nil)
 
   ;; always display everything from a return value
   (if (boundp 'print-length)
-      (set (make-local-variable 'print-length) nil))
+      (setq-local print-length nil))
   (if (boundp 'print-level)
-      (set (make-local-variable 'print-level) nil))
+      (setq-local print-level nil))
 
   ;; set require-final-newline to nil; otherwise, all redirected
   ;; output will end with a newline, whether or not the source
   ;; indicated it!
-  (set (make-local-variable 'require-final-newline) nil)
+  (setq-local require-final-newline nil)
 
-  (set (make-local-variable 'max-lisp-eval-depth)
-       (max 3000 max-lisp-eval-depth))
-  (set (make-local-variable 'max-specpdl-size)
-       (max 6000 max-lisp-eval-depth))
+  (setq-local max-lisp-eval-depth (max 3000 max-lisp-eval-depth))
+  (setq-local max-specpdl-size (max 6000 max-lisp-eval-depth))
 
-  (set (make-local-variable 'eshell-last-input-start) (point-marker))
-  (set (make-local-variable 'eshell-last-input-end) (point-marker))
-  (set (make-local-variable 'eshell-last-output-start) (point-marker))
-  (set (make-local-variable 'eshell-last-output-end) (point-marker))
-  (set (make-local-variable 'eshell-last-output-block-begin) (point))
+  (setq-local eshell-last-input-start (point-marker))
+  (setq-local eshell-last-input-end (point-marker))
+  (setq-local eshell-last-output-start (point-marker))
+  (setq-local eshell-last-output-end (point-marker))
+  (setq-local eshell-last-output-block-begin (point))
 
   (let ((modules-list (copy-sequence eshell-modules-list)))
-    (make-local-variable 'eshell-modules-list)
-    (setq eshell-modules-list modules-list))
+    (setq-local eshell-modules-list modules-list))
 
   ;; This is to avoid making the paragraph base direction
   ;; right-to-left if the first word just happens to start with a
@@ -391,7 +386,7 @@ and the hook `eshell-exit-hook'."
       (add-hook 'pre-command-hook #'eshell-preinput-scroll-to-bottom t t))
 
   (when eshell-scroll-show-maximum-output
-    (set (make-local-variable 'scroll-conservatively) 1000))
+    (setq-local scroll-conservatively 1000))
 
   (when eshell-status-in-mode-line
     (add-hook 'eshell-pre-command-hook #'eshell-command-started nil t)
index 7a80cd868774726b0671dfbd7b21f13da1a260c7..9aea5430ad7b55a6d35ecc51d7d6fb93ec506f98 100644 (file)
@@ -227,12 +227,11 @@ environment of created subprocesses."
   ;; Break the association with our parent's environment.  Otherwise,
   ;; changing a variable will affect all of Emacs.
   (unless eshell-modify-global-environment
-    (set (make-local-variable 'process-environment)
-        (eshell-copy-environment)))
+    (setq-local process-environment (eshell-copy-environment)))
 
-  (set (make-local-variable 'eshell-special-chars-inside-quoting)
+  (setq-local eshell-special-chars-inside-quoting
        (append eshell-special-chars-inside-quoting '(?$)))
-  (set (make-local-variable 'eshell-special-chars-outside-quoting)
+  (setq-local eshell-special-chars-outside-quoting
        (append eshell-special-chars-outside-quoting '(?$)))
 
   (add-hook 'eshell-parse-argument-hook #'eshell-interpolate-variable t t)