* Turning off a global mode?
@ 2016-03-04 15:41 egarrulo
2016-03-04 15:58 ` Dmitry Gutov
2016-03-04 16:58 ` Stefan Monnier
0 siblings, 2 replies; 3+ messages in thread
From: egarrulo @ 2016-03-04 15:41 UTC (permalink / raw)
To: help-gnu-emacs
`define-globalized-minor-mode' lets you associate a function to turn on
a global mode. How do you turn it off?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Turning off a global mode?
2016-03-04 15:41 Turning off a global mode? egarrulo
@ 2016-03-04 15:58 ` Dmitry Gutov
2016-03-04 16:58 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Gutov @ 2016-03-04 15:58 UTC (permalink / raw)
To: egarrulo, help-gnu-emacs
On 03/04/2016 05:41 PM, egarrulo wrote:
> `define-globalized-minor-mode' lets you associate a function to turn on
> a global mode. How do you turn it off?
Set up something to run when the globalized mode is being turned off?
You use :after hook, like this:
;;;###autoload
(define-globalized-minor-mode global-diff-hl-mode diff-hl-mode
turn-on-diff-hl-mode :after-hook (diff-hl-global-mode-change))
(defun diff-hl-global-mode-change ()
(unless global-diff-hl-mode
(dolist (buf (buffer-list))
(with-current-buffer buf
(when diff-hl-dir-mode
(diff-hl-dir-mode -1))))))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Turning off a global mode?
2016-03-04 15:41 Turning off a global mode? egarrulo
2016-03-04 15:58 ` Dmitry Gutov
@ 2016-03-04 16:58 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2016-03-04 16:58 UTC (permalink / raw)
To: help-gnu-emacs
> `define-globalized-minor-mode' lets you associate a function to turn
> on a global mode. How do you turn it off?
You call it with a negative argument.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-04 16:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04 15:41 Turning off a global mode? egarrulo
2016-03-04 15:58 ` Dmitry Gutov
2016-03-04 16:58 ` Stefan Monnier
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).