GNU bug report logs - #6040
globalized minor modes - priority over mode hook?

Previous Next

Package: emacs;

Reported by: David Reitter <david.reitter <at> gmail.com>

Date: Mon, 26 Apr 2010 16:15:02 UTC

Severity: normal

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: David Reitter <david.reitter <at> gmail.com>
Subject: bug#6040: closed (Re: bug#6040: globalized minor modes - priority
 over mode hook?)
Date: Thu, 06 Oct 2011 19:35:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#6040: globalized minor modes - priority over mode hook?

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 6040 <at> debbugs.gnu.org.

-- 
6040: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6040
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Glenn Morris <rgm <at> gnu.org>
To: 6040-done <at> debbugs.gnu.org
Subject: Re: bug#6040: globalized minor modes - priority over mode hook?
Date: Thu, 06 Oct 2011 15:34:07 -0400
Version: 24.1

David Reitter wrote:

> Emacs -Q
>
> (add-hook 'text-mode-hook 'turn-on-word-wrap) ; turns OFF auto-fill
>
> (defvaralias 'auto-fill-mode 'auto-fill-function)  ; kludge
> (define-globalized-minor-mode global-auto-fill-mode auto-fill-mode turn-on-auto-fill)
>
> (defun turn-on-word-wrap ()
>   "Turn on Word Wrap mode in current buffer."
>   (turn-off-auto-fill)
>   (turn-on-visual-line-mode))
>
> ;; demo
>
> (global-auto-fill-mode 1)  ; set default
> (text-mode)
>
> ;; result: auto-fill-mode is on, even though it is intended to be off


I see this in 23.3 but not the current trunk, so it looks like this was
fixed.

[Message part 3 (message/rfc822, inline)]
From: David Reitter <david.reitter <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: "emacs-devel <at> gnu.org devel" <emacs-devel <at> gnu.org>
Subject: Re: globalized minor modes - priority over mode hook?
Date: Mon, 26 Apr 2010 11:41:06 -0400
On Apr 26, 2010, at 10:30 AM, Stefan Monnier wrote:

>> `run-mode-hooks' runs the mode hooks first, then
>> after-change-major-mode-hooks.
> 
> That would be a bug.  Do you have a recipe to reproduce it?

Yes, below.

Looking at the code of `after-find-file', I think file-local variables will similarly be overruled by the global minor mode.

I ended up implementing what I wanted below by setting defaults for `auto-fill-function', but that's more low-level than intended, obviously.

I'm bcc'ing the bug DB.

---
Emacs -Q

(add-hook 'text-mode-hook 'turn-on-word-wrap) ; turns OFF auto-fill

(defvaralias 'auto-fill-mode 'auto-fill-function)  ; kludge
(define-globalized-minor-mode global-auto-fill-mode auto-fill-mode turn-on-auto-fill)

(defun turn-on-word-wrap ()
  "Turn on Word Wrap mode in current buffer."
  (turn-off-auto-fill)
  (turn-on-visual-line-mode))

;; demo

(global-auto-fill-mode 1)  ; set default
(text-mode)

;; result: auto-fill-mode is on, even though it is intended to be off





This bug report was last modified 13 years and 310 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.