Mercurial > emacs
changeset 108144:c46b2d0614cb
Let the user turn off locally a globalized minor mode
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Avoid re-enabling a minor mode after the user turned the minor mode
off if MODE-enable-in-buffers is run twice (typically once from
fundamental-mode's after-change-major-mode-hook and a second time from
run-mode-hook's own after-change-major-mode-hook).
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 27 Apr 2010 14:14:16 -0400 |
parents | 624169215019 |
children | 947dd776616f 3fc390a10afb c6c7a71f6e16 |
files | lisp/ChangeLog lisp/emacs-lisp/easy-mmode.el |
diffstat | 2 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Apr 27 13:57:32 2010 -0400 +++ b/lisp/ChangeLog Tue Apr 27 14:14:16 2010 -0400 @@ -1,5 +1,11 @@ 2010-04-27 Stefan Monnier <monnier@iro.umontreal.ca> + * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): + Avoid re-enabling a minor mode after the user turned the minor mode + off if MODE-enable-in-buffers is run twice (typically once from + fundamental-mode's after-change-major-mode-hook and a second time from + run-mode-hook's own after-change-major-mode-hook). + * emacs-lisp/lisp.el (lisp-complete-symbol): Fail gracefully. 2010-04-27 Sam Steingold <sds@gnu.org>
--- a/lisp/emacs-lisp/easy-mmode.el Tue Apr 27 13:57:32 2010 -0400 +++ b/lisp/emacs-lisp/easy-mmode.el Tue Apr 27 14:14:16 2010 -0400 @@ -361,13 +361,14 @@ (dolist (buf ,MODE-buffers) (when (buffer-live-p buf) (with-current-buffer buf - (if ,mode - (unless (eq ,MODE-major-mode major-mode) - (,mode -1) - (,turn-on) - (setq ,MODE-major-mode major-mode)) - (,turn-on) - (setq ,MODE-major-mode major-mode)))))) + (unless (eq ,MODE-major-mode major-mode) + (if ,mode + (progn + (,mode -1) + (,turn-on) + (setq ,MODE-major-mode major-mode)) + (,turn-on) + (setq ,MODE-major-mode major-mode))))))) (put ',MODE-enable-in-buffers 'definition-name ',global-mode) (defun ,MODE-check-buffers ()