unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: 'initial-major-mode interaction with 'major-mode
       [not found] <5602dc29-464a-4ecd-8d5a-364283d479e7@o1g2000vbe.googlegroups.com>
@ 2010-05-18 16:06 ` Lars Wessman
  2010-05-18 16:51 ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Lars Wessman @ 2010-05-18 16:06 UTC (permalink / raw)
  To: help-gnu-emacs

On May 18, 12:13 pm, Lars Wessman <lars.wess...@gmail.com> wrote:

There's a typo here:

> Starting with 23.2, we get warned that 'default-major-mode is
> "obsolete" and that we should use 'text-mode instead when byte
> compiling .emacs. The only problem is that

should read:

... and that we should use 'major-mode instead when byte-
compiling .emacs ....


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

* Re: 'initial-major-mode interaction with 'major-mode
       [not found] <5602dc29-464a-4ecd-8d5a-364283d479e7@o1g2000vbe.googlegroups.com>
  2010-05-18 16:06 ` 'initial-major-mode interaction with 'major-mode Lars Wessman
@ 2010-05-18 16:51 ` Stefan Monnier
  2010-05-19 19:11   ` Lars Wessman
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2010-05-18 16:51 UTC (permalink / raw)
  To: help-gnu-emacs

> Starting with 23.2, we get warned that 'default-major-mode is
> "obsolete" and that we should use 'text-mode instead when byte
> compiling .emacs. The only problem is that

default-major-mode was a weird alias for (default-value 'major-mode).
So (setq default-major-mode <foo>) is the same as
(setq-default major-mode <foo>).


        Stefan


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

* Re: 'initial-major-mode interaction with 'major-mode
  2010-05-18 16:51 ` Stefan Monnier
@ 2010-05-19 19:11   ` Lars Wessman
  2010-05-20  3:53     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Wessman @ 2010-05-19 19:11 UTC (permalink / raw)
  To: help-gnu-emacs

On May 18, 5:51 pm, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
> > Starting with 23.2, we get warned that 'default-major-mode is
> > "obsolete" and that we should use 'text-mode instead when byte
> > compiling .emacs. The only problem is that
>
> default-major-mode was a weird alias for (default-value 'major-mode).
> So (setq default-major-mode <foo>) is the same as
> (setq-default major-mode <foo>).
>
>         Stefan

Thanks Stefan. Have you tested this on your machine (alternating
between default-major-mode and major-mode)? After reading your message
I tried using major-mode again and *scratch* opens up in Fundamental
mode. I switch it back to default-major-mode and *scratch* opens up in
lisp-interaction-mode as specified in 'initial-major-mode.

I'm noticing a difference in behavior between using 'default-major-
mode and 'major-mode, and I'm not hallucinating it. Is it possible
that some other setting is affecting the behavior of one or the other?


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

* Re: 'initial-major-mode interaction with 'major-mode
  2010-05-19 19:11   ` Lars Wessman
@ 2010-05-20  3:53     ` Stefan Monnier
  2010-05-20  9:44       ` Lars Wessman
                         ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stefan Monnier @ 2010-05-20  3:53 UTC (permalink / raw)
  To: help-gnu-emacs

> Thanks Stefan. Have you tested this on your machine (alternating
> between default-major-mode and major-mode)?

Of course.  And I recently rewrote the way default-major-mode works
internally and am responsible for declaring it obsolete.

> After reading your message I tried using major-mode again and
> *scratch* opens up in Fundamental mode. I switch it back to
> default-major-mode and *scratch* opens up in lisp-interaction-mode as
> specified in 'initial-major-mode.
> I'm noticing a difference in behavior between using 'default-major-
> mode and 'major-mode, and I'm not hallucinating it. Is it possible
> that some other setting is affecting the behavior of one or the other?

Define "using".  I.e. show us the actual code you tried.
And don't forget that for `major-mode', you need to set it with
`setq-default' rather than with `setq'.


        Stefan


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

* Re: 'initial-major-mode interaction with 'major-mode
  2010-05-20  3:53     ` Stefan Monnier
@ 2010-05-20  9:44       ` Lars Wessman
  2010-05-20 11:52         ` Cecil Westerhof
  2010-05-20  9:46       ` Lars Wessman
  2010-05-20 10:33       ` Lars Wessman
  2 siblings, 1 reply; 8+ messages in thread
From: Lars Wessman @ 2010-05-20  9:44 UTC (permalink / raw)
  To: help-gnu-emacs

On May 20, 4:53 am, Stefan Monnier <monn...@iro.umontreal.ca> wrote:

> Define "using".  I.e. show us the actual code you tried.´

I included the code you've just asked me for in the original message
describing the problem. I took care to make the description of the
problem quite complete.

> And don't forget that for `major-mode', you need to set it with
> `setq-default' rather than with `setq'.

Ahhh.. so that's it! Thank you.

Just for curiosity's sake, why was the decision made to create a
separate function for defining defaults (assuming that is what setq-
default does without having checked the code)? What is gained by
departing from the simplicity of just using setq? Again, I'm not
challenging the change, just interested in the reasoning behind it
because I like to know how architectural decisions are justified in
general.

>         Stefan

Lars



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

* Re: 'initial-major-mode interaction with 'major-mode
  2010-05-20  3:53     ` Stefan Monnier
  2010-05-20  9:44       ` Lars Wessman
@ 2010-05-20  9:46       ` Lars Wessman
  2010-05-20 10:33       ` Lars Wessman
  2 siblings, 0 replies; 8+ messages in thread
From: Lars Wessman @ 2010-05-20  9:46 UTC (permalink / raw)
  To: help-gnu-emacs

On May 20, 4:53 am, Stefan Monnier <monn...@iro.umontreal.ca> wrote:

> Define "using".  I.e. show us the actual code you tried.´

I included the code you've just asked me for in the original message
describing the problem. I took care to make the description of the
problem quite complete.

> And don't forget that for `major-mode', you need to set it with
> `setq-default' rather than with `setq'.

Ahhh.. so that's it! Thank you.

Just for curiosity's sake, why was the decision made to create a
separate function for defining defaults (assuming that is what setq-
default does without having checked the code)? What is gained by
departing from the simplicity of just using setq? Again, I'm not
challenging the change, just interested in the reasoning behind it
because I like to know how architectural decisions are justified in
general.

>         Stefan

Lars



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

* Re: 'initial-major-mode interaction with 'major-mode
  2010-05-20  3:53     ` Stefan Monnier
  2010-05-20  9:44       ` Lars Wessman
  2010-05-20  9:46       ` Lars Wessman
@ 2010-05-20 10:33       ` Lars Wessman
  2 siblings, 0 replies; 8+ messages in thread
From: Lars Wessman @ 2010-05-20 10:33 UTC (permalink / raw)
  To: help-gnu-emacs

On May 20, 4:53 am, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
> > Thanks Stefan. Have you tested this on your machine (alternating
> > between default-major-mode and major-mode)?
>
> Of course.  And I recently rewrote the way default-major-mode works
> internally and am responsible for declaring it obsolete.
>
> > After reading your message I tried using major-mode again and
> > *scratch* opens up in Fundamental mode. I switch it back to
> > default-major-mode and *scratch* opens up in lisp-interaction-mode as
> > specified in 'initial-major-mode.
> > I'm noticing a difference in behavior between using 'default-major-
> > mode and 'major-mode, and I'm not hallucinating it. Is it possible
> > that some other setting is affecting the behavior of one or the other?
>
> Define "using".  I.e. show us the actual code you tried.

I did put the code in the original message.

> And don't forget that for `major-mode', you need to set it with
> `setq-default' rather than with `setq'.

The problem was that I wasn't using setq-default, I had not picked
that detail up in your first message. Thanks.

What is the rationale for switching from the use of setq to setq-
default? Just curious.

>
>         Stefan

Lars


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

* Re: 'initial-major-mode interaction with 'major-mode
  2010-05-20  9:44       ` Lars Wessman
@ 2010-05-20 11:52         ` Cecil Westerhof
  0 siblings, 0 replies; 8+ messages in thread
From: Cecil Westerhof @ 2010-05-20 11:52 UTC (permalink / raw)
  To: help-gnu-emacs

Op donderdag 20 mei 2010 11:44 CEST schreef Lars Wessman:

> Just for curiosity's sake, why was the decision made to create a
> separate function for defining defaults (assuming that is what setq-
> default does without having checked the code)? What is gained by
> departing from the simplicity of just using setq? Again, I'm not
> challenging the change, just interested in the reasoning behind it
> because I like to know how architectural decisions are justified in
> general.

With setq you set the value in the current buffer (if it is not a global
value). With setq-default  you make the value you set  the value for all
the buffers you do not explicitly set it. So that could change the value
in for example ten buffers instead of only the current one.

There is  a little caveat. If you  already set the value  in the current
buffer and then use setq-default  the value changes in the buffers where
it was not set, but not in the current buffer.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


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

end of thread, other threads:[~2010-05-20 11:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5602dc29-464a-4ecd-8d5a-364283d479e7@o1g2000vbe.googlegroups.com>
2010-05-18 16:06 ` 'initial-major-mode interaction with 'major-mode Lars Wessman
2010-05-18 16:51 ` Stefan Monnier
2010-05-19 19:11   ` Lars Wessman
2010-05-20  3:53     ` Stefan Monnier
2010-05-20  9:44       ` Lars Wessman
2010-05-20 11:52         ` Cecil Westerhof
2010-05-20  9:46       ` Lars Wessman
2010-05-20 10:33       ` Lars Wessman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).