* Re: [Emacs-diffs] scratch/so-long d216f81: fixup! Add so-long library
[not found] ` <20190414125502.AB90320536@vcs0.savannah.gnu.org>
@ 2019-04-14 15:03 ` Stefan Monnier
2019-04-14 22:24 ` Phil Sainty
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2019-04-14 15:03 UTC (permalink / raw)
To: emacs-devel; +Cc: Phil Sainty
> +(defun turn-on-so-long-minor-mode ()
> + "Enable minor mode `so-long-minor-mode'."
> + (so-long-minor-mode 1))
You don't need to pass `1`, so you could also write:
(defalias 'turn-on-so-long-minor-mode #'so-long-minor-mode)
or just don't define turn-on-so-long-minor-mode at all, which is what
I recommend.
> +(defun turn-off-so-long-minor-mode ()
> + "Disable minor mode `so-long-minor-mode'."
> + (so-long-minor-mode -1))
I also recommend not to bother defining the turn-off function and let
users call (so-long-minor-mode -1) for the few cases where they might
need it.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Emacs-diffs] scratch/so-long d216f81: fixup! Add so-long library
2019-04-14 15:03 ` [Emacs-diffs] scratch/so-long d216f81: fixup! Add so-long library Stefan Monnier
@ 2019-04-14 22:24 ` Phil Sainty
2019-04-15 11:55 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Phil Sainty @ 2019-04-14 22:24 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
On 2019-04-15 03:03, Stefan Monnier wrote:
> or just don't define turn-on-so-long-minor-mode at all, which is what
> I recommend.
> I also recommend not to bother defining the turn-off function and let
> users call (so-long-minor-mode -1) for the few cases where they might
> need it.
The actual reason for defining these functions is for the associated
so-long-action-alist entry:
(so-long-minor-mode
"Enable so-long-minor-mode"
turn-on-so-long-minor-mode
turn-off-so-long-minor-mode)
This kept things nice and simple.
We could get away without the turn-on function, but I felt the resulting
lack of symmetry would be strange, so opted to have them both.
-Phil
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Emacs-diffs] scratch/so-long d216f81: fixup! Add so-long library
2019-04-14 22:24 ` Phil Sainty
@ 2019-04-15 11:55 ` Stefan Monnier
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2019-04-15 11:55 UTC (permalink / raw)
To: Phil Sainty; +Cc: emacs-devel
>> or just don't define turn-on-so-long-minor-mode at all, which is what
>> I recommend.
>> I also recommend not to bother defining the turn-off function and let
>> users call (so-long-minor-mode -1) for the few cases where they might
>> need it.
> The actual reason for defining these functions is for the associated
> so-long-action-alist entry:
>
> (so-long-minor-mode
> "Enable so-long-minor-mode"
> turn-on-so-long-minor-mode
> turn-off-so-long-minor-mode)
BTW: How 'bout making this alist accept elements of the form
(<minor-mode> "description")?
Being a minor mode means you know how to gets its current status, how to
turn it on and how to turn it off, so you can standardize the treatment
you did for longlines-mode.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-15 11:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190414125501.16807.79719@vcs0.savannah.gnu.org>
[not found] ` <20190414125502.AB90320536@vcs0.savannah.gnu.org>
2019-04-14 15:03 ` [Emacs-diffs] scratch/so-long d216f81: fixup! Add so-long library Stefan Monnier
2019-04-14 22:24 ` Phil Sainty
2019-04-15 11:55 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).