bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23460: 25.1.50; Strange behavior in local variables like start-comme


From: Kaushal Modi
Subject: bug#23460: 25.1.50; Strange behavior in local variables like start-comment
Date: Thu, 05 May 2016 22:35:23 +0000

I haven't actually looked at that yet.  But where, with respect to
setting the major mode, does the outshine function look at
comment-start?

Yes
 
Were you doing anything involving changing the major mode at the time?
(See below.)

Apologies for that misleading first version of the MWE; the issue I am seeing has nothing to do with changing major mode (I think). 

Thanks for taking the trouble to create this minimal test code.  It
makes it so much easier to understand when people do this.  :-)

No worries. But unintentional I caused more trouble for you by posting an incorrect version of MWE (the 1st version). The second version I posted few minutes back is thoroughly tested in both emacs-25 and master and has no outshine.el dependency i.e. you can focus only on that 2nd version of MWE.

OK.  Have a look at the *Messages* buffer.  You will see the messages
come in pairs:  (I actually did this in a C Mode buffer.)

    `comment-start' = `/* '
    `comment-start' is undefined, it's value is: `nil'

But in the echo area, you will only see the second one.

> I have tested this only for comment-start. But I suspect this might affect
> buffer local vars in general?

I think so, too.  When you visit a buffer, Emacs calls `normal-mode' to
determine and set the major mode.  The first thing `normal-mode' does is
to call `fundamental-mode'.  This invokes `change-major-mode-hook',
which outputs the first "comment-start" message.  Then
`fundamental-mode' kills all local variables, including `comment-start'.

`normal-mode' then determines the correct major mode, and calls it.
This invokes `change-major-mode-hook' again, which outputs the second
"comment-start" message with the `nil'.  The major mode is then fully
set up, including giving a value to `comment-start'.

So, this code seems to be working the way it's intended to. 

Thank you for that detailed explanation. I was not aware of the major mode changes that were happening behind the scenes.
 
What is
outshine doing that triggers a problem in this area? 

The outshine-mode-function function is actually added to outline-minor-mode-hook. I have updated MWE version 2 with that in mind.

Is it doing things
with the `change-major-mode-hook' that involve using `comment-start'?
Maybe this is the problem.

No, it does not use change-major-mode-hook. But it does depend on the buffer local value of comment-start.

In summary, the 2nd version of my MWE should help you consistently show the behavior difference between emacs-25 and master.
--

--
Kaushal Modi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]