all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: 23460@debbugs.gnu.org
Subject: bug#23460: 25.1.50; Strange behavior in local variables like start-comment
Date: Thu, 05 May 2016 22:35:23 +0000	[thread overview]
Message-ID: <CAFyQvY1h=5atq23SPTu1SJxydhuWyz+BJLWoszJZm4pN9Yf0HQ@mail.gmail.com> (raw)
In-Reply-To: <20160505222211.GE1950@acm.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 2604 bytes --]

>
> 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

[-- Attachment #2: Type: text/html, Size: 3834 bytes --]

  reply	other threads:[~2016-05-05 22:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 20:35 bug#23460: 25.1.50; Strange behavior in local variables like start-comment Kaushal Modi
2016-05-05 21:40 ` Kaushal Modi
2016-05-05 22:20   ` Kaushal Modi
2016-05-06  9:37     ` Alan Mackenzie
2016-05-06 14:31       ` Kaushal Modi
2016-05-05 22:22 ` Alan Mackenzie
2016-05-05 22:35   ` Kaushal Modi [this message]
2016-05-05 22:29 ` Michael Heerdegen
2016-05-06 19:25 ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY1h=5atq23SPTu1SJxydhuWyz+BJLWoszJZm4pN9Yf0HQ@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=23460@debbugs.gnu.org \
    --cc=acm@muc.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.