 ;; http://www.zsh.org/
 
 (use-feature sh-script
-  :config/el-patch
-
-  ;; Inhibit the "Indentation setup for shell type *sh" message.
-  (defun sh-set-shell (shell &optional no-query-flag insert-flag)
-    (el-patch-concat
-      "Set this buffer's shell to SHELL (a string).
-When used interactively, insert the proper starting #!-line,
-and make the visited file executable via `executable-set-magic',
-perhaps querying depending on the value of `executable-query'.
-
-When this function is called noninteractively, INSERT-FLAG (the third
-argument) controls whether to insert a #!-line and think about making
-the visited file executable, and NO-QUERY-FLAG (the second argument)
-controls whether to query about making the visited file executable.
-
-Calls the value of `sh-set-shell-hook' if set.
-
-Shell script files can cause this function be called automatically
-when the file is visited by having a `sh-shell' file-local variable
-whose value is the shell name (don't quote it)."
-      (el-patch-add
-        "\n\nThis function does not print superfluous messages."))
-    (interactive (list (completing-read
-                        (format "Shell (default %s): "
-                                sh-shell-file)
-                        ;; This used to use interpreter-mode-alist, but that is
-                        ;; no longer appropriate now that uses regexps.
-                        ;; Maybe there could be a separate variable that lists
-                        ;; the shells, used here and to construct i-mode-alist.
-                        ;; But the following is probably good enough:
-                        (append (mapcar (lambda (e) (symbol-name (car e)))
-                                        sh-ancestor-alist)
-                                '("csh" "rc" "sh"))
-                        nil nil nil nil sh-shell-file)
-                       (eq executable-query 'function)
-                       t))
-    (if (string-match "\\.exe\\'" shell)
-        (setq shell (substring shell 0 (match-beginning 0))))
-    (setq sh-shell (sh-canonicalize-shell shell))
-    (if insert-flag
-        (setq sh-shell-file
-              (executable-set-magic shell (sh-feature sh-shell-arg)
-                                    no-query-flag insert-flag)))
-    (setq mode-line-process (format "[%s]" sh-shell))
-    (setq-local sh-shell-variables nil)
-    (setq-local sh-shell-variables-initialized nil)
-    (setq-local imenu-generic-expression
-                (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))
-    (if (setq-local sh-indent-supported-here
-                    (sh-feature sh-indent-supported))
-        (progn
-          (el-patch-remove
-            (message "Setting up indent for shell type %s" sh-shell))
-          (let ((mksym (lambda (name)
-                         (intern (format "sh-smie-%s-%s"
-                                         sh-indent-supported-here name)))))
-            (add-function :around (local 'smie--hanging-eolp-function)
-                          (lambda (orig)
-                            (if (looking-at "[ \t]*\\\\\n")
-                                (goto-char (match-end 0))
-                              (funcall orig))))
-            (add-hook 'smie-indent-functions #'sh-smie--indent-continuation nil t)
-            (smie-setup (symbol-value (funcall mksym "grammar"))
-                        (funcall mksym "rules")
-                        :forward-token  (funcall mksym "forward-token")
-                        :backward-token (funcall mksym "backward-token")))
-          (setq-local parse-sexp-lookup-properties t)
-          (unless sh-use-smie
-            (setq-local sh-kw-alist (sh-feature sh-kw))
-            (let ((regexp (sh-feature sh-kws-for-done)))
-              (if regexp
-                  (setq-local sh-regexp-for-done
-                              (sh-mkword-regexpr (regexp-opt regexp t)))))
-            (el-patch-remove
-              (message "setting up indent stuff"))
-            ;; 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))
-          (el-patch-remove
-            (message "Indentation setup for shell type %s" sh-shell)))
-      (el-patch-remove
-        (message "No indentation for this shell type."))
-      (setq-local indent-line-function 'sh-basic-indent-line))
-    (when font-lock-mode
-      (setq font-lock-set-defaults nil)
-      (font-lock-set-defaults)
-      (font-lock-flush))
-    (setq sh-shell-process nil)
-    (run-hooks 'sh-set-shell-hook))
-
-  ;; Inhibit the "Indentation variables are now local" message.
-  (defun sh-make-vars-local ()
-    (el-patch-concat
-      "Make the indentation variables local to this buffer.
-Normally they already are local.  This command is provided in case
-variable `sh-make-vars-local' has been set to nil.
-
-To revert all these variables to the global values, use
-command `sh-reset-indent-vars-to-global-values'."
-      (el-patch-add
-        "\n\nThis function does not print superfluous messages."))
-    (interactive)
-    (mapc 'make-local-variable sh-var-list)
-    (el-patch-remove
-      (message "Indentation variables are now local.")))
+  :config
+
+  (dolist (func '(sh-set-shell sh-make-vars-local))
+    (advice-add func :around #'radian--advice-silence-messages))
 
   (radian-defhook radian--sh-prettify-mode-line ()
     sh-mode-hook

    "Silence messages from `auto-revert-mode' in the current buffer."
    (setq-local auto-revert-verbose nil))

  :config/el-patch

  (defun auto-revert-buffers ()
    (el-patch-concat
      "Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode.

Should `global-auto-revert-mode' be active all file buffers are checked.

Should `auto-revert-mode' be active in some buffers, those buffers
are checked.

Non-file buffers that have a custom `revert-buffer-function' and
`buffer-stale-function' are reverted either when Auto-Revert
Mode is active in that buffer, or when the variable
`global-auto-revert-non-file-buffers' is non-nil and Global
Auto-Revert Mode is active.

This function stops whenever there is user input.  The buffers not
checked are stored in the variable `auto-revert-remaining-buffers'.

To avoid starvation, the buffers in `auto-revert-remaining-buffers'
are checked first the next time this function is called.

This function is also responsible for removing buffers no longer in
Auto-Revert Mode from `auto-revert-buffer-list', and for canceling
the timer when no buffers need to be checked."
      (el-patch-add
        "\n\nOnly currently displayed buffers are reverted."))

    (setq auto-revert-buffers-counter
          (1+ auto-revert-buffers-counter))

    (save-match-data
      (let ((bufs (el-patch-wrap 2
                    (cl-remove-if-not
                     #'get-buffer-window
                     (if global-auto-revert-mode
                         (buffer-list)
                       auto-revert-buffer-list))))
            remaining new)
        ;; Partition `bufs' into two halves depending on whether or not
        ;; the buffers are in `auto-revert-remaining-buffers'.  The two
        ;; halves are then re-joined with the "remaining" buffers at the
        ;; head of the list.
        (dolist (buf auto-revert-remaining-buffers)
          (if (memq buf bufs)
              (push buf remaining)))
        (dolist (buf bufs)
          (if (not (memq buf remaining))
              (push buf new)))
        (setq bufs (nreverse (nconc new remaining)))
        (while (and bufs
                    (not (and auto-revert-stop-on-user-input
                              (input-pending-p))))
          (let ((buf (car bufs)))
            (with-current-buffer buf
              (if (buffer-live-p buf)
                  (progn
                    ;; Test if someone has turned off Auto-Revert Mode
                    ;; in a non-standard way, for example by changing
                    ;; major mode.
                    (if (and (not auto-revert-mode)
                             (not auto-revert-tail-mode)
                             (memq buf auto-revert-buffer-list))
                        (auto-revert-remove-current-buffer))
                    (when (auto-revert-active-p)
                      ;; Enable file notification.
                      (when (and auto-revert-use-notify
                                 (not auto-revert-notify-watch-descriptor))
                        (auto-revert-notify-add-watch))
                      (auto-revert-handler)))
                ;; Remove dead buffer from `auto-revert-buffer-list'.
                (auto-revert-remove-current-buffer))))
          (setq bufs (cdr bufs)))
        (setq auto-revert-remaining-buffers bufs)
        ;; Check if we should cancel the timer.
        (when (and (not global-auto-revert-mode)
                   (null auto-revert-buffer-list))
          (if (timerp auto-revert-timer)
              (cancel-timer auto-revert-timer))
          (setq auto-revert-timer nil)))))

  :config

  ;; Turn the delay on auto-reloading from 5 seconds down to 1 second.

        (minibuffer-keyboard-quit))
    (funcall keyboard-quit)))

(radian-defadvice radian--advice-split-windows-horizontally
    (split-window-sensibly &rest args)
  :around split-window-sensibly
  "Split windows horizontally by default, rather than vertically.
Since the Emacs terminology is confusing: this means to split
into tall subwindows rather than into wide subwindows by
default."
  (cl-letf* ((split-window-below (symbol-function #'split-window-below))
             (split-window-right (symbol-function #'split-window-right))
             (window-splittable-p (symbol-function #'window-splittable-p))
             ((symbol-function #'split-window-below) split-window-right)
             ((symbol-function #'split-window-right) split-window-below)
             ((symbol-function #'window-splittable-p)
              (lambda (window &optional horizontal)
                (funcall window-splittable-p window (not horizontal)))))
    (apply split-window-sensibly args)))

;; Feature `windmove' provides keybindings S-left, S-right, S-up, and
;; S-down to move between windows. This is much more convenient and
