all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#4148: mode: for a minor mode should turn on, not toggle the mode
@ 2009-08-15  7:05 Dan Nicolaescu
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Nicolaescu @ 2009-08-15  7:05 UTC (permalink / raw)
  To: bug-gnu-emacs


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.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#4148: mode: for a minor mode should turn on, not toggle the mode
@ 2009-08-15 17:40 Chong Yidong
  2009-08-15 18:54 ` Dan Nicolaescu
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2009-08-15 17:40 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 4148

> 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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#4148: mode: for a minor mode should turn on, not toggle the mode
  2009-08-15 17:40 bug#4148: mode: for a minor mode should turn on, not toggle the mode Chong Yidong
@ 2009-08-15 18:54 ` Dan Nicolaescu
  2009-08-17  1:09   ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Nicolaescu @ 2009-08-15 18:54 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 4148

Chong Yidong <cyd@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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#4148: mode: for a minor mode should turn on, not toggle the mode
  2009-08-15 18:54 ` Dan Nicolaescu
@ 2009-08-17  1:09   ` Chong Yidong
  2009-08-17  1:49     ` Dan Nicolaescu
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2009-08-17  1:09 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 4148

Dan Nicolaescu <dann@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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#4148: mode: for a minor mode should turn on, not toggle the mode
  2009-08-17  1:09   ` Chong Yidong
@ 2009-08-17  1:49     ` Dan Nicolaescu
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Nicolaescu @ 2009-08-17  1:49 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 4148

Chong Yidong <cyd@stupidchicken.com> writes:

  > Dan Nicolaescu <dann@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://emacsbugs.donarmstrong.com/cgi-bin/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






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-17  1:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-15 17:40 bug#4148: mode: for a minor mode should turn on, not toggle the mode Chong Yidong
2009-08-15 18:54 ` Dan Nicolaescu
2009-08-17  1:09   ` Chong Yidong
2009-08-17  1:49     ` Dan Nicolaescu
  -- strict thread matches above, loose matches on Subject: below --
2009-08-15  7:05 Dan Nicolaescu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.