help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smartparens documentation question.


From: Michael Heerdegen
Subject: Re: Smartparens documentation question.
Date: Sun, 11 Apr 2021 06:54:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

"R. Clayton" <factotum@rclayton.org> writes:

> In smartparens I read in the documentation for the function
> show-smartparens-mode that
>
>   If called from Lisp, also enable the mode if ARG is omitted or nil, and
>   toggle it if ARG is ‘toggle’; disable the mode otherwise.
>
> This strikes me as backwards, because I thought the idiom is nil args turn
> things off and non-nil args turn things on, but ok, sure, maybe it's a
> minor-mode thing.

The (currently) correct idiom is (`define-minor-mode'):

When called from Lisp, the mode command toggles the mode if the
argument is `toggle', disables the mode if the argument is a
non-positive integer, and enables the mode otherwise (including
if the argument is omitted or nil or a positive integer).

>  However, poking around in smartparens.el shows
>
>   ;;;###autoload
>   (defun turn-on-show-smartparens-mode ()
>     "Turn on `show-smartparens-mode'."
>     (interactive)
>     (unless (or (member major-mode sp-ignore-modes-list)
>                 (and (not (derived-mode-p 'comint-mode))
>                      (eq (get major-mode 'mode-class) 'special)))
>       (show-smartparens-mode t)))

That would be correct code if the docstring of `show-smartparens-mode'
is wrong.

AFAIR these details (which arguments exactly turn the mode on and off)
were subject to change in the recent past.  You might want to contact
the author of smartparens so he or she can correct the docstring or
whatever is wrong.

Thanks,

Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]