From: Stefan Monnier Date: Tue, 27 Apr 2010 18:14:16 +0000 (-0400) Subject: Let the user turn off locally a globalized minor mode X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~363 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=17818d715235dafd82625fb6d739dddaf60c2701;p=emacs.git 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). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e17b075759b..c35314af1b0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2010-04-27 Stefan Monnier + * 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 diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 2849f4cf154..d18aa230b75 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -361,13 +361,14 @@ See `%s' for more information on %s." (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 ()