Remove spacemacs/add-to-local-vars-hook and use (format ...)
It is better to directly hook function using the conventional hook functions. Replace usage of (concat ...) by a (format ...) from which is more readable.
This commit is contained in:
parent
a8b0eaacec
commit
89dc1af9a6
|
@ -51,13 +51,7 @@
|
|||
|
||||
(defun spacemacs//run-local-vars-mode-hook ()
|
||||
"Run a hook for the major-mode after the local variables have been processed."
|
||||
(run-hooks (intern (concat (symbol-name major-mode) "-local-vars-hook"))))
|
||||
|
||||
;; http://stackoverflow.com/a/5148435/3086454
|
||||
(defun spacemacs/add-to-local-vars-hook (mode func)
|
||||
"Add hook to mode--local-vars-hook which is executed after the
|
||||
local variables have been processed."
|
||||
(add-hook (intern (concat (symbol-name mode) "-local-vars-hook")) func))
|
||||
(run-hooks (intern (format "%S-local-vars-hook" major-mode))))
|
||||
|
||||
(defun spacemacs/echo (msg &rest args)
|
||||
"Display MSG in echo-area without logging it in *Messages* buffer."
|
||||
|
|
|
@ -124,8 +124,8 @@
|
|||
(cons 'elixir-enable-compilation-checking nil))
|
||||
(add-to-list 'safe-local-variable-values
|
||||
(cons 'elixir-enable-compilation-checking t))
|
||||
(spacemacs/add-to-local-vars-hook 'elixir-mode
|
||||
'spacemacs//elixir-enable-compilation-checking))))
|
||||
(add-hook 'elixir-mode-local-vars-hook
|
||||
'spacemacs//elixir-enable-compilation-checking))))
|
||||
|
||||
(defun elixir/init-elixir-mode ()
|
||||
(use-package elixir-mode
|
||||
|
|
|
@ -106,7 +106,8 @@
|
|||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(spacemacs/add-to-local-vars-hook 'haskell-mode #'spacemacs-haskell//setup-completion-backend)
|
||||
(add-hook 'haskell-mode-local-vars-hook
|
||||
#'spacemacs-haskell//setup-completion-backend)
|
||||
|
||||
(defun spacemacs//force-haskell-mode-loading ()
|
||||
"Force `haskell-mode' loading when visiting cabal file."
|
||||
|
|
|
@ -125,8 +125,9 @@
|
|||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(spacemacs/add-to-local-vars-hook 'ruby-mode 'spacemacs//ruby-enable-rspec-mode)
|
||||
(spacemacs/add-to-local-vars-hook 'enh-ruby-mode 'spacemacs//ruby-enable-rspec-mode)
|
||||
(spacemacs/add-to-hooks 'spacemacs//ruby-enable-rspec-mode
|
||||
'(ruby-mode-local-vars-hook
|
||||
enh-ruby-mode-local-vars-hook))
|
||||
;; remove hooks automatically added by rspec via autoload
|
||||
;; because we want to be able to control when rspec-mode is
|
||||
;; loaded based on the layer variable `ruby-test-runner'
|
||||
|
@ -195,9 +196,9 @@
|
|||
"Define keybindings for ruby test mode"
|
||||
(use-package ruby-test-mode)
|
||||
:defer t
|
||||
:init
|
||||
(spacemacs/add-to-local-vars-hook 'ruby-mode 'spacemacs//ruby-enable-ruby-test-mode)
|
||||
(spacemacs/add-to-local-vars-hook 'enh-ruby-mode 'spacemacs//ruby-enable-ruby-test-mode)
|
||||
:init (spacemacs/add-to-hooks 'spacemacs//ruby-enable-ruby-test-mode
|
||||
'(ruby-mode-local-vars-hook
|
||||
enh-ruby-mode-local-vars-hook))
|
||||
:config
|
||||
(progn
|
||||
;; `ruby-test-mode' adds a hook to enable itself, this hack
|
||||
|
|
Loading…
Reference in New Issue