From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#14325: 24.3; cc-mode does not initialize correctly w/ -batch Date: Wed, 1 May 2013 17:23:46 +0000 (UTC) Organization: muc.de e.V. Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1367429084 30602 80.91.229.3 (1 May 2013 17:24:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 May 2013 17:24:44 +0000 (UTC) To: gnu-emacs-bug@moderators.isc.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 01 19:24:42 2013 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 1UXall-0007ui-LV for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 May 2013 19:24:41 +0200 Original-Received: from localhost ([::1]:43579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXall-0004Lo-62 for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 May 2013 13:24:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXalh-0004Lh-5p for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:24:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXalf-0007Xw-Lu for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:24:37 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXald-0007X7-8X; Wed, 01 May 2013 13:24:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UXam6-0002ws-HP; Wed, 01 May 2013 13:25:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <878v3z29r2.fsf@Rainer.invalid> Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 01 May 2013 17:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14325 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.136742907311272 (code B ref -1); Wed, 01 May 2013 17:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 May 2013 17:24:33 +0000 Original-Received: from localhost ([127.0.0.1]:54122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXalc-0002vj-E6 for submit@debbugs.gnu.org; Wed, 01 May 2013 13:24:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49044) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXalY-0002vY-Jr for submit@debbugs.gnu.org; Wed, 01 May 2013 13:24:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXal3-00074C-97 for submit@debbugs.gnu.org; Wed, 01 May 2013 13:23:58 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:53135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXal3-000745-5u for submit@debbugs.gnu.org; Wed, 01 May 2013 13:23:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXal1-0004JI-7p for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:23:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXakz-000739-Q6 for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:23:55 -0400 Original-Received: from moderators.individual.net ([130.133.4.7]:58526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXakz-000734-JL for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 13:23:53 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by moderators.individual.net (Exim 4.80.1) for gnu-emacs-bug@moderators.isc.org with esmtp (envelope-from ) id <1UXakz-002nHK-0G>; Wed, 01 May 2013 19:23:53 +0200 Original-Received: (qmail 29726 invoked by uid 8); 1 May 2013 17:23:46 -0000 Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 67 Original-NNTP-Posting-Host: news.muc.de Original-X-Trace: colin.muc.de 1367429026 29724 193.149.48.2 (1 May 2013 17:23:46 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: Wed, 1 May 2013 17:23:46 +0000 (UTC) User-Agent: tin/1.9.6-20101126 ("Burnside") (UNIX) (FreeBSD/8.4-PRERELEASE (amd64)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:73871 Archived-At: Achim Gratz wrote: > Alan Mackenzie writes: >> Yes, the c-after-font-lock-init call will initialise everything properly, >> though it's more a workaround than a solution. > So what would be the solution, then? >> Font Lock Mode is a minor mode, and part of its initialisation is calling >> font-lock-mode-hook. (font-lock-mode-hook is here c-after-font-lock-init.) >> If you run font-lock-fontify-buffer (etc.) without fully initialising Font >> Lock Mode, you're liable to run into bugs. If that were all there were >> to it, I'd have nothing more to say, but sadly it's not so simple. > Well, Org requires font-lock, it switches font-lock off and on when it > changes font-lock settings and it uses it for fontification with > whatever major mode the content wants to have. OK. Could you possibly give the exact sequence of Font Lock and CC Mode calls which lead to the error? > If there is a code-path that enters cc-mode in uninitialized state, then > shouldn't cc-mode check for nil instead of crashing Emacs by blindly > assuming it can funcall the contents of that variable? The variable is (or should be) initialised by font-lock-mode-hook calling c-after-font-lock-init. This should happen when font-lock-mode is called. The question is why the switching on of Font Lock Mode here fails to do this. >> Font Lock Mode is, by default disabled in batch mode. If you enable it, >> this also enables jit-lock-mode (which is surely wrong), which prevents >> any fontification actually taking place, since the buffer is never >> displayed on the screen to trigger the fontification. > Since Org can use the results of the fontification, some of it must > happen anyway? Besides, even if I stop jit-lock-mode from being > used (by adding it to font-lock-inhibit-thing-lock), cc-mode still > throws an error. >> I think the following sequence of commands would fontify the buffer >> properly in batch mode: >> (c-mode) >> (setq font-lock-support-mode nil) ; disable jit-lock-mode >> (font-lock-mode 1) > I've tried to put these (without switching to c-mode since selecting the > mode is done elsewhere) into various places and still get the same error > from cc-mode. OK. >> However, you'll probably prefer to carry on with using Font Lock Mode >> uninitialised. ;-) I think Glenn's patch achieves this painlessly. > I'd prefer if fontlock-fontify-* would work in batch mode without > workarounds. I'll have no problem sticking (when noninteractive ...) > into the intialization or Org itself if that's the ticket. I still > don't have a clue where that should be done. I'd like to track this down, too. > Regards, > Achim. -- Alan Mackenzie (Nuremberg, Germany).