Calling (paredit-mode) etc. from elisp code always enables, not toggles, the mode #138

Merged
merged 1 commit into from May 4, 2012

2 participants

@drothlis

Hi! Something I learned today:

'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")

I, as no doubt many others, learn a lot of my elisp from your excellent starter
kit; so it would be nice to see this standard way of enabling minor modes
reflected in your code.

Unfortunately this change will break any users' code that calls
esk-turn-on-paredit, esk-turn-on-whitespace, or
esk-turn-on-idle-highlight-mode. For those users the fix is to replace
(add-hook 'xyz 'esk-turn-on-paredit)
with
(add-hook 'xyz 'paredit-mode).

@drothlis drothlis 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)
c71507f
@technomancy technomancy merged commit c22fa56 into technomancy:v2 May 4, 2012
@technomancy
Owner

good catch; thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment