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

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

Re: Turning off a global mode?


From: Dmitry Gutov
Subject: Re: Turning off a global mode?
Date: Fri, 4 Mar 2016 17:58:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

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




reply via email to

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