GNU bug report logs - #4148
mode: for a minor mode should turn on, not toggle the mode

Previous Next

Package: emacs;

Reported by: Dan Nicolaescu <dann <at> ics.uci.edu>

Date: Sat, 15 Aug 2009 07:15:04 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4148 in the body.
You can then email your comments to 4148 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4148; Package emacs. (Sat, 15 Aug 2009 07:15:04 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: mode: for a minor mode should turn on, not toggle the mode
Date: Sat, 15 Aug 2009 00:05:26 -0700 (PDT)
A well known long standing problem:
using 
mode: SOME_MINOR_MODE

in a local variable section (or in .dir-locals.el) toggles the minor
mode, it should turn it on.

So if the user sets a hook to turn on the minor mode in her emacs, when
using a file that sets the same minor mode, the minor mode ends up being
disable.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4148; Package emacs. (Sat, 15 Aug 2009 17:45:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 15 Aug 2009 17:45:04 GMT) Full text and rfc822 format available.

Message #8 received at 4148 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 4148 <at> debbugs.gnu.org
Subject: Re: mode: for a minor mode should turn on, not toggle the mode
Date: Sat, 15 Aug 2009 13:40:06 -0400
> A well known long standing problem:
> using 
> mode: SOME_MINOR_MODE

> in a local variable section (or in .dir-locals.el) toggles the minor
> mode, it should turn it on.

> So if the user sets a hook to turn on the minor mode in her emacs, when
> using a file that sets the same minor mode, the minor mode ends up being
> disable.

Does this patch DTRT?

*** trunk/lisp/files.el.~1.1066.~	2009-08-14 19:37:09.000000000 -0400
--- trunk/lisp/files.el	2009-08-15 13:37:24.000000000 -0400
***************
*** 3189,3195 ****
  				     "-mode"))))
  	   (unless (eq (indirect-function mode)
  		       (indirect-function major-mode))
! 	     (funcall mode))))
  	((eq var 'eval)
  	 (save-excursion (eval val)))
  	(t
--- 3189,3199 ----
  				     "-mode"))))
  	   (unless (eq (indirect-function mode)
  		       (indirect-function major-mode))
! 	     (if (memq mode minor-mode-list)
! 		 ;; For a minor mode, enable unconditionally instead
! 		 ;; of toggling (since the mode may already be on).
! 		 (funcall mode 1)
! 	       (funcall mode)))))
  	((eq var 'eval)
  	 (save-excursion (eval val)))
  	(t




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4148; Package emacs. (Sat, 15 Aug 2009 19:00:04 GMT) Full text and rfc822 format available.

Message #11 received at 4148 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 4148 <at> debbugs.gnu.org
Subject: Re: bug#4148: mode: for a minor mode should turn on, not toggle the mode
Date: Sat, 15 Aug 2009 11:54:28 -0700 (PDT)
Chong Yidong <cyd <at> stupidchicken.com> writes:

  > > A well known long standing problem:
  > > using 
  > > mode: SOME_MINOR_MODE
  > 
  > > in a local variable section (or in .dir-locals.el) toggles the minor
  > > mode, it should turn it on.
  > 
  > > So if the user sets a hook to turn on the minor mode in her emacs, when
  > > using a file that sets the same minor mode, the minor mode ends up being
  > > disable.
  > 
  > Does this patch DTRT?
  > 
  > *** trunk/lisp/files.el.~1.1066.~	2009-08-14 19:37:09.000000000 -0400
  > --- trunk/lisp/files.el	2009-08-15 13:37:24.000000000 -0400
  > ***************
  > *** 3189,3195 ****
  >   				     "-mode"))))
  >   	   (unless (eq (indirect-function mode)
  >   		       (indirect-function major-mode))
  > ! 	     (funcall mode))))
  >   	((eq var 'eval)
  >   	 (save-excursion (eval val)))
  >   	(t
  > --- 3189,3199 ----
  >   				     "-mode"))))
  >   	   (unless (eq (indirect-function mode)
  >   		       (indirect-function major-mode))
  > ! 	     (if (memq mode minor-mode-list)
  > ! 		 ;; For a minor mode, enable unconditionally instead
  > ! 		 ;; of toggling (since the mode may already be on).
  > ! 		 (funcall mode 1)
  > ! 	       (funcall mode)))))
  >   	((eq var 'eval)
  >   	 (save-excursion (eval val)))
  >   	(t

Thanks, it seems to work fine.

After this gets checked in, we can re-add (mode . bug-reference) to emacs/.dir-locals.el

Any chance this patch can get onto the next release branch?



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4148; Package emacs. (Mon, 17 Aug 2009 01:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 17 Aug 2009 01:15:04 GMT) Full text and rfc822 format available.

Message #16 received at 4148 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 4148 <at> debbugs.gnu.org
Subject: Re: bug#4148: mode: for a minor mode should turn on, not toggle the mode
Date: Sun, 16 Aug 2009 21:09:18 -0400
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

> Thanks, it seems to work fine.
>
> After this gets checked in, we can re-add (mode . bug-reference) to
> emacs/.dir-locals.el
>
> Any chance this patch can get onto the next release branch?

I'm having trouble coming up with a test-case for testing this patch.
Do you have one?



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4148; Package emacs. (Mon, 17 Aug 2009 01:55:05 GMT) Full text and rfc822 format available.

Message #19 received at 4148 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 4148 <at> debbugs.gnu.org
Subject: Re: bug#4148: mode: for a minor mode should turn on, not toggle the mode
Date: Sun, 16 Aug 2009 18:49:53 -0700 (PDT)
Chong Yidong <cyd <at> stupidchicken.com> writes:

  > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
  > 
  > > Thanks, it seems to work fine.
  > >
  > > After this gets checked in, we can re-add (mode . bug-reference) to
  > > emacs/.dir-locals.el
  > >
  > > Any chance this patch can get onto the next release branch?
  > 
  > I'm having trouble coming up with a test-case for testing this patch.
  > Do you have one?

Here's one:

$ cat foo.el
(add-hook 'change-log-mode-hook (lambda () (bug-reference-mode 1)))

$ cat emacs/.dir-locals.el

((nil . ((tab-width . 8)
         (fill-column . 70)))
 (c-mode . ((c-file-style . "GNU")))
 (text-mode . ((mode . auto-fill)))
 (change-log-mode . ((add-log-time-zone-rule . t)
                     (fill-column . 74)
                     (bug-reference-url-format
                      . "http://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s")
                     (mode . bug-reference))))

;; arch-tag: fb93c160-e9fe-4184-aad1-e4f5daa11cbd


$ emacs -Q -l foo.el
C-x C-f emacs/lisp/ChangeLog

C-h v bug-reference-mode RET

before your patch bug-reference-mode is nil, after it's t




Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Thu, 20 Aug 2009 20:30:13 GMT) Full text and rfc822 format available.

Notification sent to Dan Nicolaescu <dann <at> ics.uci.edu>:
bug acknowledged by developer. (Thu, 20 Aug 2009 20:30:14 GMT) Full text and rfc822 format available.

Message #24 received at 4148-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 4148-done <at> debbugs.gnu.org
Subject: Re: bug#4148: mode: for a minor mode should turn on, not toggle the mode
Date: Mon, 17 Aug 2009 19:51:39 -0400
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

>   > I'm having trouble coming up with a test-case for testing this patch.
>   > Do you have one?
>
> Here's one:

Thanks.  I've checked in the patch.



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Fri, 18 Sep 2009 14:24:16 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 280 days ago.

Previous Next


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