From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Francis Belliveau Newsgroups: gmane.emacs.help Subject: Re: Problem with CC mode hooks and font-locking Date: Fri, 30 Nov 2018 16:50:23 -0500 Message-ID: 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 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1543614533 16586 195.159.176.226 (30 Nov 2018 21:48:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2018 21:48:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 30 22:48:48 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 1gSqeW-0004Ch-Bs for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2018 22:48:48 +0100 Original-Received: from localhost ([::1]:34725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqgc-0006t1-9C for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2018 16:50:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqgB-0006st-1i for help-gnu-emacs@gnu.org; Fri, 30 Nov 2018 16:50:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqg7-0005Pn-On for help-gnu-emacs@gnu.org; Fri, 30 Nov 2018 16:50:30 -0500 Original-Received: from resqmta-ch2-06v.sys.comcast.net ([2001:558:fe21:29:69:252:207:38]:53420) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSqg7-0005EB-I7 for help-gnu-emacs@gnu.org; Fri, 30 Nov 2018 16:50:27 -0500 Original-Received: from resomta-ch2-15v.sys.comcast.net ([69.252.207.111]) by resqmta-ch2-06v.sys.comcast.net with ESMTP id SmPsgY5KZVWHQSqg5gDfFX; Fri, 30 Nov 2018 21:50:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1543614625; bh=pF62ofR+1ZKsT0oXvER5Sm0d9ub1dvybUIWH/qLm45M=; h=Received:Received:From:Content-Type:Mime-Version:Subject:Date:To: Message-Id; b=Z9yGDGPf6jXqSdol4T8bk5VOW+DpuuSg229mMSorss8i8/ngWjOq0TYhX45zwB3ox IVqBU0QgDol1h5Lnul/f20hOiRTLenveL0Wve1DNP3a0ZhtmMqdMLFpFGSxFnST1wh GWlgU9uicKXT6CuUptCWIHdydr5WKKzQuMSqhqdz+pBpnzwiobPivVzlJWcpBTIR5N hTquaZst1HNTddZ3wCXIYO80qqPd3DShvCcuO0SwONBCYtdkVQlh5regFE7mNhaNr0 gqmd9yEe3SWi+HyXKeS56b7MmoBzAOvHL3K+XMgsWrz5N4+6NzFsqpd12ts+Z1e/TZ nvGLthS02lEow== Original-Received: from [IPv6:2601:190:580:9c44:5cfd:711b:2e93:339d] ([IPv6:2601:190:580:9c44:5cfd:711b:2e93:339d]) by resomta-ch2-15v.sys.comcast.net with ESMTPSA id Sqg4g9xsmV5JBSqg4gO6tp; Fri, 30 Nov 2018 21:50:25 +0000 In-Reply-To: X-Mailer: Apple Mail (2.3445.9.1) X-CMAE-Envelope: MS4wfI/09udCl62Ke6QTYbYSdGoPLOT5TIRZYZx9omNjpyTW+t/Ct/OKcrzgYdMrMKuXfJa7l8XHvS50JN2KGM1qRtQWMBWY2H9i+iDJ9qOpg4lU6s23uF2b 6loVfLoji3jSjH/pDnFAotTWP3w/3UyJdqRuZ+Hz1nJfG3MTTM3jMAomXT8HahHzscDRsxS5/6y5gxCo0gGdUFMlR8Mc15TH461/HfgVg/S7NjkJjx/DSlQp Yajh45Dv/NmFHzJMzQOe1KPQ1OjxO+RJPLc1XfWg80z5L3l67kg5bH5UMR9hVQl/ X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:558:fe21:29:69:252:207:38 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:118812 Archived-At: First: Thank you Stefan for your answer. I will endeavor to rerun my experiments and document the results in a = more scientific manner. 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. 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. 2. Removed it from main .emacs and placed it in my = 'c-initialization-hook' produces the following curious effects: a) Load .emacs shows Lisp mode with lots of colors b) Load foo.h shows C++ mode with lots of colors, but the colors are = gone from the .emacs text c) Load foo.cpp shows C++ mode all in black d) Load foo.java shows Java mode all in black Curious about the .h file being colorized, but loading it eliminated = the colors from the .emacs buffer. I switched between these 4 buffers in the the two sides and the = coloring stayed firm with the buffer contents as expected. I restarted emacs without any .emacs changes and loaded the files in = different order. - .emacs, foo.cpp, foo.java, foo.h Same effects, Lisp shows colors that go away when the first C++ file = (foo.cpp) is loaded with lots of colors and all others are in black. - .emacs, foo.java, foo.h, foo.cpp Same effects, Lisp shows colors that go away when the first file = (foo.java) is loaded with lots of colors and all others are in black. - foo.h, .emacs, foo.cpp, foo.java This time foo.h is colored, and remains that way. All others are = black. - foo.java, .emacs, foo.h, foo.cpp - foo.cpp, foo.h, foo.java, .emacs Both of these tests showed the first file remained all colored, and = the others all black. 3. Put it back into the main .emacs code, and left it in the = 'c-initialization-hook'. - .emacs, foo.h, foo.cpp, foo.java This produced the same results as in 2 that .emacs first showed itself = all colored and then turned black when foo.h was loaded and shown all = colored. The other files were also all black. I do not understand why there is any "file load order" dependency, or = why the first CC mode file seems to "rob" the Lisp mode buffer of its = color. I use the term "rob" with tongue-in-cheek. The order of things in my .emacs file is: ;; disable all colorization stuff (global-font-lock-mode -1) (defun my-load-once-code-hook () "My function to load when a code-mode is initialized the first time" (progn ;-(setq flb-dbg-val '1) (global-font-lock-mode -1) ;-(setq c-basic-offset my-tab-width) ;-(my-require 'sce) ;-(if c-mode-base-map ;- (define-key c-mode-base-map "\C-m" 'c-newline)) ;-(flb) )) ;; set all the load-once stuff for coding (add-hook 'c-initialization-hook 'my-load-once-code-hook) ;;;;;;;; I expect that this is more than enough for you all to digest for now. My obvious next step would be to move on and place this in a = 'c-mode-common-hook' but I wonder if I should remove the other two uses = first? Does anybody have any other ideas? Thanks for taking the time for reading all this. I will appreciate any = help I can get with chasing down the reason for this. Fran=