unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Francis Belliveau <f.belliveau@comcast.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Problem with CC mode hooks and font-locking
Date: Sat, 1 Dec 2018 09:33:39 -0500	[thread overview]
Message-ID: <19114789-568E-41DD-9A06-C0410F023E53@comcast.net> (raw)
In-Reply-To: <837egtd6ll.fsf@gnu.org>

Thank you Eli, I found found the problem hidden elsewhere that was toggling things.  Understanding is everything.
By the way "Starting from the dock" is the same a clicking an icon on the desktop.  It just starts the application without any arguments.

I am now at the point of not liking what this is doing because, as Eli said, all coloring has been disabled.  I did like seeing the colors in buffers like the output of "grep".

So I removed the statement from my .emacs file and placed (font-lock-mode -1) in my  'c-initialization-hook' with the intention of only disabling colors in my coding modes.
That seems to disable it for only the first file loaded, but not the others.  As Eli suggested, this does not have any effect on Lisp mode; that buffer is always colored.  My guess here is that placing it there does not step on the defaults for all future mode initializations like I would have expected.

So I moved if to my 'c-mode-common-hook' and that did the trick.

Thanks to all who read through my details.  I hope that it will help others to understand these things.

Fran


> On Dec 1, 2018, at 02:55, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Francis Belliveau <f.belliveau@comcast.net>
>> 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.
> 




  reply	other threads:[~2018-12-01 14:33 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24 15:23 Where is Emacs Lisp taught ? Jean-Christophe Helary
2018-10-24 16:02 ` Emanuel Berg
2018-10-24 22:24   ` Garreau, Alexandre
2018-10-24 23:30     ` Jean-Christophe Helary
2018-10-25  3:31       ` Van L
2018-10-25 19:01     ` Emanuel Berg
2018-10-26 11:43       ` Garreau, Alexandre
2018-10-26 13:53         ` Emanuel Berg
2018-10-26 15:41         ` Stefan Monnier
2018-10-27 10:50           ` Garreau, Alexandre
2018-11-14 23:27     ` Drew Adams
2018-11-15  3:08       ` Stefan Monnier
2018-11-15  4:47         ` Drew Adams
2018-11-15  8:04         ` tomas
2018-11-15 20:01         ` Bob Proulx
     [not found]     ` <mailman.4061.1542238084.1284.help-gnu-emacs@gnu.org>
2018-11-17 15:41       ` Gene
2018-11-17 17:39         ` Java-mode Debug question ? Francis Belliveau
2018-11-17 17:51           ` Eli Zaretskii
2018-11-18 12:34             ` Francis Belliveau
2018-11-18 15:32               ` Francis Belliveau
2018-11-27  1:06             ` Problem with CC mode hooks and font-locking Francis Belliveau
2018-11-27  2:38               ` Stefan Monnier
2018-11-30 21:50                 ` Francis Belliveau
2018-12-01  7:55                   ` Eli Zaretskii
2018-12-01 14:33                     ` Francis Belliveau [this message]
2019-02-22  4:14         ` Where is Emacs Lisp taught ? Van L
     [not found] ` <mailman.2668.1540396976.1284.help-gnu-emacs@gnu.org>
2018-10-26 18:05   ` Gene
2018-10-27  0:54     ` Jean-Christophe Helary
2018-10-27 17:27       ` Emanuel Berg
2018-10-28  0:27       ` Garreau, Alexandre
2018-10-28  1:16         ` Jean-Christophe Helary
2018-10-28  2:47           ` Garreau, Alexandre
2018-10-28  7:04             ` Alan E. Davis
2018-10-28  7:28               ` Van L
2018-10-28 17:07               ` Emanuel Berg
     [not found]             ` <mailman.2937.1540710329.1284.help-gnu-emacs@gnu.org>
2018-10-28 17:03               ` Emanuel Berg
2018-10-28 17:14                 ` Emanuel Berg
2018-10-30 19:30               ` Gene
2018-10-30 19:46                 ` Stefan Monnier
2018-10-30 20:33                   ` Nick Dokos
     [not found]                   ` <mailman.3129.1540931601.1284.help-gnu-emacs@gnu.org>
2018-10-31 11:20                     ` Emanuel Berg
     [not found]                 ` <mailman.3123.1540928817.1284.help-gnu-emacs@gnu.org>
2018-10-30 20:28                   ` Emanuel Berg
2018-10-30 20:32                     ` Drew Adams
2018-10-31  2:14                     ` Gmane Autoauthorizer (was: Re: Where is Emacs Lisp taught ?) Nuno Silva
2018-10-31 11:23                       ` Emanuel Berg
2018-11-02  1:33                         ` Gmane Autoauthorizer Nuno Silva
2018-11-02  8:38                           ` Emanuel Berg
2018-11-03 12:41                             ` Nuno Silva
2018-11-03 15:24                               ` Emanuel Berg
2018-11-04 21:25                                 ` Nuno Silva
2018-11-05 20:51                                   ` Emanuel Berg
2018-11-01 13:02                       ` Gmane Autoauthorizer (was: Re: Where is Emacs Lisp taught ?) Emanuel Berg
2018-11-01 13:07                         ` Emanuel Berg
2018-11-02  1:23                           ` Gmane Autoauthorizer Nuno Silva
     [not found]                     ` <mailman.3128.1540931562.1284.help-gnu-emacs@gnu.org>
2018-10-31 11:19                       ` Where is Emacs Lisp taught ? Emanuel Berg
2018-10-31 14:22                         ` Drew Adams
     [not found]                         ` <mailman.3163.1540995758.1284.help-gnu-emacs@gnu.org>
2018-10-31 16:01                           ` Emanuel Berg
2018-11-09  9:16                             ` Van L
     [not found]                             ` <mailman.3710.1541755025.1284.help-gnu-emacs@gnu.org>
2018-11-10 17:02                               ` Gene
2018-11-04 12:17                         ` Daniel Nemenyi
     [not found]         ` <mailman.2929.1540689371.1284.help-gnu-emacs@gnu.org>
2018-10-28  2:11           ` Gene
2018-10-28  2:21             ` Jean-Christophe Helary
     [not found]             ` <mailman.2933.1540693317.1284.help-gnu-emacs@gnu.org>
2018-10-30 17:35               ` Gene
2018-10-27 18:40     ` Gene
2018-10-27 19:27       ` Emanuel Berg
2018-10-28  0:52       ` Garreau, Alexandre
2018-10-28  1:11       ` Jean-Christophe Helary
2018-10-28  0:19     ` Garreau, Alexandre
     [not found]     ` <mailman.2923.1540686004.1284.help-gnu-emacs@gnu.org>
2018-10-30 17:22       ` Gene
2018-10-31  3:54         ` Van L
2018-10-31 10:42         ` Eric S Fraga
     [not found]         ` <mailman.3146.1540958071.1284.help-gnu-emacs@gnu.org>
2018-11-02 19:34           ` Gene
2018-11-02 20:45             ` Gene
  -- strict thread matches above, loose matches on Subject: below --
2018-12-15 10:04 Problem with CC mode hooks and font-locking Van L
     [not found] ` <D054980C-4420-43FE-9133-53E00BACC925@comcast.net>
2018-12-16 21:31   ` Van L

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=19114789-568E-41DD-9A06-C0410F023E53@comcast.net \
    --to=f.belliveau@comcast.net \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).