From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs Subject: bug#23460: 25.1.50; Strange behavior in local variables like start-comment Date: Thu, 05 May 2016 22:35:23 +0000 Message-ID: References: <20160505222211.GE1950@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c04f99ed7cb4b05321ff52f X-Trace: ger.gmane.org 1462487801 5721 80.91.229.3 (5 May 2016 22:36:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 May 2016 22:36:41 +0000 (UTC) Cc: 23460@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 06 00:36:33 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ayRsm-0000vn-K6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2016 00:36:32 +0200 Original-Received: from localhost ([::1]:55663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayRsi-0004mD-Mo for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 May 2016 18:36:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayRsZ-0004YJ-4m for bug-gnu-emacs@gnu.org; Thu, 05 May 2016 18:36:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayRsM-0002i2-VO for bug-gnu-emacs@gnu.org; Thu, 05 May 2016 18:36:13 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayRsL-0002gZ-PL for bug-gnu-emacs@gnu.org; Thu, 05 May 2016 18:36:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ayRsI-0006OU-8E for bug-gnu-emacs@gnu.org; Thu, 05 May 2016 18:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 May 2016 22:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23460 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23460-submit@debbugs.gnu.org id=B23460.146248774024550 (code B ref 23460); Thu, 05 May 2016 22:36:02 +0000 Original-Received: (at 23460) by debbugs.gnu.org; 5 May 2016 22:35:40 +0000 Original-Received: from localhost ([127.0.0.1]:40892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayRrv-0006Nu-Uf for submit@debbugs.gnu.org; Thu, 05 May 2016 18:35:40 -0400 Original-Received: from mail-oi0-f44.google.com ([209.85.218.44]:34821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ayRrv-0006Nj-4j for 23460@debbugs.gnu.org; Thu, 05 May 2016 18:35:39 -0400 Original-Received: by mail-oi0-f44.google.com with SMTP id x19so119781720oix.2 for <23460@debbugs.gnu.org>; Thu, 05 May 2016 15:35:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8Gr4IBQVfJ5OcycEdpx8sfuGmCElRgxhQrDNAZyY0v0=; b=Oa0tOXm3vjtAXZp6HqQNfVKKKMglyphAO9sIcS+vgpPC2l28YHn/gwSMqeNxPYCSPf lf/k9045YiFZUB7tGIXHBH+VXPGhQhL5qHPUdKtHCW6/zgOUXHc2vElgLa5aiur7yD3t tWIaJSj9EzV7GAhFobG3IPLm1zhV1bh2oT1z4ntGmaJPmioVCTkv6p6P7EZzL8ZmEuY8 NdlVHRAr6qA9o3TLMXX0lhd+xakhmoDSgH2YWxTUEbUkH3FbWwJlhA5HgmvQoLbcMxcT EXN64fdlaY+tBKsln952GMtg8iUPczadRyzpBdRdzX7fn4yO/YsP0VQwK6f+I5ZVAg2d OnuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8Gr4IBQVfJ5OcycEdpx8sfuGmCElRgxhQrDNAZyY0v0=; b=e8SEFfZXfR0LD217Ut67zJPmKi7hB6QGaZZthgVYamnwxh3XH9AmYGXcsVRkHXhMHa Ed98kKDda5CyqnfuKmS61HLE82tQkpxOgB8z0llrRFjJwndzushCg65Lk2vnSEqsegwx ZaEpNd2SLGwF5cjV4zUvXQstkUM0EQECcdhqzhQW89TmNTdG4/kHHPZxYsGdG9XeSuwI rOzdg3ewaBXuB+hCX3VN4dmfi3h6uZDXTR2Lj9DpuMbwAP9qLgEFQT86UjQpE2SQqHtA 6IBDdHEH6VzylulcnRAs76GXjz0teXqYdJFlqAtStHzGHx3S86r4ZyBpea1jKmOUug6G anOA== X-Gm-Message-State: AOPr4FWFlzM3HiZt+/dOZnfjUV6mxHGbWViMrdQf0sFdUzDxH6Ilu32c4olCbBOJKEC3a5CBE3uKr1fTr1befw== X-Received: by 10.157.7.225 with SMTP id 88mr8110710oto.185.1462487733486; Thu, 05 May 2016 15:35:33 -0700 (PDT) In-Reply-To: <20160505222211.GE1950@acm.fritz.box> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:117880 Archived-At: --94eb2c04f99ed7cb4b05321ff52f Content-Type: text/plain; charset=UTF-8 > > 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 --94eb2c04f99ed7cb4b05321ff52f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
= I haven't actually looked at that yet.=C2=A0 But where, with respect to=
setting the major mode, does the outshine function look at
comment-start?

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

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

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

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

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

=C2=A0 =C2=A0 `comment-start' =3D `/* '
=C2=A0 =C2=A0 `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 af= fect
> buffer local vars in general?

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

`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'.=C2=A0 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.=C2=A0

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

The outshine-mode-function function is actually added to ou= tline-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 valu= e of comment-start.

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

--
Kaushal Modi

--94eb2c04f99ed7cb4b05321ff52f--