Permalink
Browse files

Calling (paredit-mode) etc. from elisp code always enables, not toggl…

…es, the mode.

`paredit-mode' with no arguments only toggles the mode when called
interactively. From Lisp, ommitted or `nil' argument enables the mode -- this
"makes it easy to enable the minor mode in a major mode hook, for example".

See: (info "(elisp) Defining Minor Modes")

Third parties using `esk-turn-on-paredit', `esk-turn-on-whitespace', or
`esk-turn-on-idle-highlight-mode' should simply replace
  (add-hook 'xyz 'esk-turn-on-paredit)
with
  (add-hook 'xyz 'paredit-mode)
  • Loading branch information...
1 parent 794a005 commit c71507f85132cf7e3e911629550f03d668781a55 @drothlis drothlis committed May 4, 2012
Showing with 2 additions and 11 deletions.
  1. +1 −1 modules/starter-kit-lisp.el
  2. +1 −10 starter-kit-defuns.el
View
2 modules/starter-kit-lisp.el
@@ -82,7 +82,7 @@
(font-lock-add-keywords (intern (concat (symbol-name mode) "-mode"))
'(("(\\|)" . 'esk-paren-face))))
(add-hook (intern (concat (symbol-name mode) "-mode-hook"))
- 'esk-turn-on-paredit))
+ 'paredit-mode))
(defun esk-pretty-fn ()
(font-lock-add-keywords nil `(("(\\(\\<fn\\>\\)"
View
11 starter-kit-defuns.el
@@ -60,15 +60,6 @@
(require 'saveplace)
(setq save-place t))
-(defun esk-turn-on-whitespace ()
- (whitespace-mode t))
-
-(defun esk-turn-on-paredit ()
- (paredit-mode t))
-
-(defun esk-turn-on-idle-highlight-mode ()
- (idle-highlight-mode t))
-
(defun esk-pretty-lambdas ()
(font-lock-add-keywords
nil `(("(?\\(lambda\\>\\)"
@@ -87,7 +78,7 @@
(add-hook 'prog-mode-hook 'esk-turn-on-save-place-mode)
(add-hook 'prog-mode-hook 'esk-pretty-lambdas)
(add-hook 'prog-mode-hook 'esk-add-watchwords)
-(add-hook 'prog-mode-hook 'esk-turn-on-idle-highlight-mode)
+(add-hook 'prog-mode-hook 'idle-highlight-mode)
(defun esk-prog-mode-hook ()
(run-hooks 'prog-mode-hook))

0 comments on commit c71507f

Please sign in to comment.