From 49f11ca0b0f4b2c2d8da610ad3d4c2ce0ad91ab1 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Tue, 26 Jan 2016 00:47:10 -0500 Subject: [PATCH] Sort packages in some packages.el --- layers/osx/packages.el | 46 ++++++++--------- layers/shell/packages.el | 104 +++++++++++++++++++++------------------ 2 files changed, 79 insertions(+), 71 deletions(-) diff --git a/layers/osx/packages.el b/layers/osx/packages.el index 8b20c838a..f1e524890 100644 --- a/layers/osx/packages.el +++ b/layers/osx/packages.el @@ -1,11 +1,11 @@ (setq osx-packages '( exec-path-from-shell + helm + launchctl osx-trash pbcopy - launchctl reveal-in-osx-finder - helm term )) @@ -26,16 +26,16 @@ (setq insert-directory-program gls dired-listing-switches "-aBhl --group-directories-first"))))) -(defun osx/init-osx-trash () - (use-package osx-trash - :if (and (spacemacs/system-is-mac) - (not (boundp 'mac-system-move-file-to-trash-use-finder))) - :init (osx-trash-setup))) - -(defun osx/init-pbcopy () - (use-package pbcopy - :if (and (spacemacs/system-is-mac) (not (display-graphic-p))) - :init (turn-on-pbcopy))) +(when (configuration-layer/layer-usedp 'spacemacs-helm) + (defun osx/pre-init-helm () + ;; Use `mdfind' instead of `locate'. + (when (spacemacs/system-is-mac) + (spacemacs|use-package-add-hook helm + :post-config + ;; Disable fuzzy matchting to make mdfind work with helm-locate + ;; https://github.com/emacs-helm/helm/issues/799 + (setq helm-locate-fuzzy-match nil) + (setq helm-locate-command "mdfind -name %s %s"))))) (defun osx/init-launchctl () (use-package launchctl @@ -69,22 +69,22 @@ (kbd "#") 'launchctl-unsetenv (kbd "h") 'launchctl-help)))) +(defun osx/init-osx-trash () + (use-package osx-trash + :if (and (spacemacs/system-is-mac) + (not (boundp 'mac-system-move-file-to-trash-use-finder))) + :init (osx-trash-setup))) + +(defun osx/init-pbcopy () + (use-package pbcopy + :if (and (spacemacs/system-is-mac) (not (display-graphic-p))) + :init (turn-on-pbcopy))) + (defun osx/init-reveal-in-osx-finder () (use-package reveal-in-osx-finder :if (spacemacs/system-is-mac) :commands reveal-in-osx-finder)) -(when (configuration-layer/layer-usedp 'spacemacs-helm) - (defun osx/pre-init-helm () - ;; Use `mdfind' instead of `locate'. - (when (spacemacs/system-is-mac) - (spacemacs|use-package-add-hook helm - :post-config - ;; Disable fuzzy matchting to make mdfind work with helm-locate - ;; https://github.com/emacs-helm/helm/issues/799 - (setq helm-locate-fuzzy-match nil) - (setq helm-locate-command "mdfind -name %s %s"))))) - (defun osx/post-init-term () (with-eval-after-load 'term (define-key term-raw-map (kbd "s-v") 'term-paste))) diff --git a/layers/shell/packages.el b/layers/shell/packages.el index f0a34b9fc..690f139e9 100644 --- a/layers/shell/packages.el +++ b/layers/shell/packages.el @@ -11,22 +11,25 @@ (setq shell-packages '( - company - helm - multi-term (comint :location built-in) - xterm-color - shell + company + esh-help + (eshell :location built-in) + eshell-prompt-extras + eshell-z + helm + magit + multi-term + (shell :location built-in) shell-pop smooth-scrolling - term - eshell - eshell-z - eshell-prompt-extras - esh-help - magit + (term :location built-in) + xterm-color )) +(defun shell/init-comint () + (setq comint-prompt-read-only t)) + (defun shell/pre-init-company () ;; support in eshell (spacemacs|use-package-add-hook eshell @@ -54,6 +57,12 @@ the user activate the completion manually." (add-hook 'eshell-mode-hook 'spacemacs//eshell-switch-company-frontend)))) +(defun shell/init-esh-help () + (use-package esh-help + :defer t + :init (add-hook 'eshell-mode-hook 'eldoc-mode) + :config (setup-esh-help-eldoc))) + (defun shell/init-eshell () (use-package eshell :defer t @@ -116,7 +125,8 @@ is achieved by adding the relevant text properties." (autoload 'eshell-delchar-or-maybe-eof "em-rebind") - ;; Defining a function like this makes it possible to type 'clear' in eshell and have it work + ;; Defining a function like this makes it possible to type 'clear' + ;; in eshell and have it work (defun eshell/clear () (interactive) (let ((inhibit-read-only t)) @@ -156,19 +166,6 @@ is achieved by adding the relevant text properties." (kbd "C-k") 'eshell-previous-matching-input-from-input (kbd "C-j") 'eshell-next-matching-input-from-input)))) -(defun shell/init-eshell-z () - (use-package eshell-z - :defer t - :init - (with-eval-after-load 'eshell - (require 'eshell-z)))) - -(defun shell/init-esh-help () - (use-package esh-help - :defer t - :init (add-hook 'eshell-mode-hook 'eldoc-mode) - :config (setup-esh-help-eldoc))) - (defun shell/init-eshell-prompt-extras () (use-package eshell-prompt-extras :commands epe-theme-lambda @@ -176,6 +173,13 @@ is achieved by adding the relevant text properties." (setq eshell-highlight-prompt nil eshell-prompt-function 'epe-theme-lambda))) +(defun shell/init-eshell-z () + (use-package eshell-z + :defer t + :init + (with-eval-after-load 'eshell + (require 'eshell-z)))) + (when (configuration-layer/layer-usedp 'spacemacs-helm) (defun shell/pre-init-helm () (spacemacs|use-package-add-hook helm @@ -205,6 +209,11 @@ is achieved by adding the relevant text properties." (spacemacs/set-leader-keys-for-major-mode 'shell-mode "H" 'spacemacs/helm-shell-history))))) +(defun shell/pre-init-magit () + (spacemacs|use-package-add-hook magit + :post-init + (defalias 's 'magit-status))) + (defun shell/init-multi-term () (use-package multi-term :defer t @@ -235,22 +244,6 @@ is achieved by adding the relevant text properties." (projectile-with-default-dir (projectile-project-root) (multi-term))) (spacemacs/set-leader-keys "p$t" 'projectile-multi-term-in-root))))) -(defun shell/init-comint () - (setq comint-prompt-read-only t)) - -(defun shell/init-xterm-color () - (use-package xterm-color - :init - (progn - ;; Comint and Shell - (add-hook 'comint-preoutput-filter-functions 'xterm-color-filter) - (setq comint-output-filter-functions (remove 'ansi-color-process-output comint-output-filter-functions)) - (setq font-lock-unfontify-region-function 'xterm-color-unfontify-region) - (with-eval-after-load 'esh-mode - (add-hook 'eshell-mode-hook (lambda () (setq xterm-color-preserve-properties t))) - (add-hook 'eshell-preoutput-filter-functions 'xterm-color-filter) - (setq eshell-output-filter-functions (remove 'eshell-handle-ansi-color eshell-output-filter-functions)))))) - (defun shell/init-shell () (spacemacs/register-repl 'shell 'shell) (defun shell-comint-input-sender-hook () @@ -266,8 +259,10 @@ is achieved by adding the relevant text properties." ;; Check for man command and execute it. ((string-match "^[ \t]*man[ \t]*" command) (comint-send-string proc "\n") - (setq command (replace-regexp-in-string "^[ \t]*man[ \t]*" "" command)) - (setq command (replace-regexp-in-string "[ \t]+$" "" command)) + (setq command (replace-regexp-in-string + "^[ \t]*man[ \t]*" "" command)) + (setq command (replace-regexp-in-string + "[ \t]+$" "" command)) (funcall 'man command)) ;; Send other commands to the default handler. (t (comint-simple-send proc command)))))) @@ -304,7 +299,8 @@ is achieved by adding the relevant text properties." (when (ignore-errors (get-buffer-process (current-buffer))) (set-process-sentinel (get-buffer-process (current-buffer)) (lambda (proc change) - (when (string-match "\\(finished\\|exited\\)" change) + (when (string-match "\\(finished\\|exited\\)" + change) (kill-buffer (process-buffer proc)) (delete-window)))))) (add-hook 'term-mode-hook 'ansi-term-handle-close) @@ -352,7 +348,19 @@ is achieved by adding the relevant text properties." (kbd "C-k") 'term-send-up (kbd "C-j") 'term-send-down)) -(defun shell/pre-init-magit () - (spacemacs|use-package-add-hook magit - :post-init - (defalias 's 'magit-status))) +(defun shell/init-xterm-color () + (use-package xterm-color + :init + (progn + ;; Comint and Shell + (add-hook 'comint-preoutput-filter-functions 'xterm-color-filter) + (setq comint-output-filter-functions + (remove 'ansi-color-process-output comint-output-filter-functions)) + (setq font-lock-unfontify-region-function 'xterm-color-unfontify-region) + (with-eval-after-load 'esh-mode + (add-hook 'eshell-mode-hook + (lambda () (setq xterm-color-preserve-properties t))) + (add-hook 'eshell-preoutput-filter-functions 'xterm-color-filter) + (setq eshell-output-filter-functions + (remove 'eshell-handle-ansi-color + eshell-output-filter-functions))))))