From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Problem with CC mode hooks and font-locking Date: Sat, 01 Dec 2018 09:55:02 +0200 Message-ID: <837egtd6ll.fsf@gnu.org> References: <5B8BFDC9-A07B-48FE-8C97-1BB0B84E5577@gmail.com> <865zxruycx.fsf@zoho.com> <875zxr7zke.fsf@portable.galex-713.eu> <00997cf4-4577-49d4-b48d-79e6a46b0211@googlegroups.com> <28B5D5A6-4E84-455C-BA8E-84AC0C5BD454@comcast.net> <83h8gftwxb.fsf@gnu.org> <5FC1FE19-E1AE-49EB-9D42-4D0B3E22E34E@comcast.net> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1543650829 16304 195.159.176.226 (1 Dec 2018 07:53:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Dec 2018 07:53:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 01 08:53:45 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gT05w-00049d-OL for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Dec 2018 08:53:44 +0100 Original-Received: from localhost ([::1]:36005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gT083-0006Ci-AC for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Dec 2018 02:55:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gT07a-0006CQ-4H for help-gnu-emacs@gnu.org; Sat, 01 Dec 2018 02:55:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gT07T-0007Gb-Oe for help-gnu-emacs@gnu.org; Sat, 01 Dec 2018 02:55:26 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gT07T-0007GR-L0 for help-gnu-emacs@gnu.org; Sat, 01 Dec 2018 02:55:19 -0500 Original-Received: from [176.228.60.248] (port=3061 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gT07R-0007pR-VC for help-gnu-emacs@gnu.org; Sat, 01 Dec 2018 02:55:19 -0500 In-reply-to: (message from Francis Belliveau on Fri, 30 Nov 2018 16:50:23 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:118813 Archived-At: > From: Francis Belliveau > Date: Fri, 30 Nov 2018 16:50:23 -0500 > > To be clear, what I am trying to do is eliminate the colors being applied to text in all my files. My understanding from the documentation is that if I add (global-font-lock-mode -1) to my .emacs file before I load any modes, the effects should be globally disabled. Therefore, "failure" in this case is when various portions of my text is being shown in different colors. > > I am not sure that it matters, but for clarity, my .emacs setup opens up with the window split vertically so that I can see two buffers simultaneously. > For the experiments below, I always open the application from my dock so that no file is loaded. Then I usually open my .emacs file first, in the left half, then the code files in order on the right. Where I open another file first, it is done in the left side and the others on the right. Maybe the above does matters, as I'm not on macOS, so maybe there's something macOS specific involved here; in particular, I have no idea what does "opening application from my dock" mean. > 1. Placing this in my .emacs file does not seem to have any effect. Lisp, C++ and Java modes all show text in lots of colors. Just doing this one thing, i.e. having a .emacs that says only (global-font-lock-mode -1) disables colors in both Lisp (including *scratch* buffer and any Lisp file I visit) and C/Java files I visited. Do you have anything else in your .emacs in addition to that single line? If so, perhaps those other things are the culprit. What happens if you leave just the above single line in your .emacs, and then restart Emacs? > 2. Removed it from main .emacs and placed it in my 'c-initialization-hook' produces the following curious effects: This is definitely not the right thing to do, so let's disregard what you get when you do this. (c-initialization-hook is only relevant to C-like languages, which is not what you want. And if you do anything from that hook, you should only change local values, i.e. font-lock-mode and not global-font-lock-mode; the latter is a global mode, so it is inappropriate to turn it on or off from a mode hook.) > I do not understand why there is any "file load order" dependency Because you are changing a global setting from a hook that is called when the first C-like file is visited.