Ruby debug highlighting: dynamic check

Move check into function, and add to local-vars hook instead of the mode hook.
This makes the variable changeable at runtime and also as part of local vars.
This commit is contained in:
Eivind Fonn 2017-05-24 09:43:06 +02:00
parent 26bb5912f0
commit b1f1674109
2 changed files with 9 additions and 8 deletions

View file

@ -62,9 +62,11 @@ Called interactively it prompts for a directory."
;; highlight debugger keywords
(defun spacemacs/ruby-highlight-debugger-keywords ()
(defun spacemacs/ruby-maybe-highlight-debugger-keywords ()
"Highlight break point lines."
(interactive)
(highlight-lines-matching-regexp "byebug")
(highlight-lines-matching-regexp "binding.irb")
(highlight-lines-matching-regexp "binding.pry"))
(when ruby-highlight-debugger-keywords
(highlight-lines-matching-regexp "byebug")
(highlight-lines-matching-regexp "binding.irb")
(highlight-lines-matching-regexp "binding.pry")))

View file

@ -213,10 +213,9 @@
:init
(progn
(spacemacs/declare-prefix-for-mode 'ruby-mode "mt" "ruby/test")
(when ruby-highlight-debugger-keywords
(spacemacs/add-to-hooks 'spacemacs/ruby-highlight-debugger-keywords
'(ruby-mode-hook
enh-ruby-mode-hook))))
(spacemacs/add-to-hooks
'spacemacs/ruby-maybe-highlight-debugger-keywords
'(ruby-mode-local-vars-hook enh-ruby-mode-local-vars-hook)))
:config (spacemacs/set-leader-keys-for-major-mode 'ruby-mode
"'" 'ruby-toggle-string-quotes
"{" 'ruby-toggle-block)))