           ;; sh-mode has already made indent-line-function local
           ;; but do it in case this is called before that.
           (setq-local indent-line-function #'sh-indent-line))
-        (if sh-make-vars-local
-            (sh-make-vars-local))
+        (when sh-make-vars-local
+          (sh-make-vars-local))
         ;; (message "Indentation setup for shell type %s" sh-shell)
         )
        ((or (eq sh-shell 'tcsh)
             (eq sh-shell 'csh))
-        (setq-local indent-line-function   #'csh-indent-line)
+        (setq-local indent-line-function #'csh-indent-line)
         (setq-local indent-region-function #'csh-indent-region))
        ((null sh-indent-supported-here)
         (message "No indentation for this shell type.")

              (if (looking-at "[ \t]*\\\\\n")
                  (goto-char (match-end 0))
                (funcall orig))))
          (smie-setup (symbol-value (funcall mksym "grammar"))
                      (funcall mksym "rules")
                      :forward-token  (funcall mksym "forward-token")

                  (sh-feature sh-imenu-generic-expression))
      (let ((tem (sh-feature sh-mode-syntax-table-input)))
        (when tem
          (setq-local sh-mode-syntax-table (apply 'sh-mode-syntax-table tem))
          (set-syntax-table sh-mode-syntax-table)))
      (dolist (var (sh-feature sh-variables))
        (sh-remember-variable var))
