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 12:53:28 +0000 (UTC) Organization: muc.de e.V. Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1367413260 22584 80.91.229.3 (1 May 2013 13:01:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 May 2013 13:01:00 +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 15:00:58 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 1UXWeU-0007qq-5r for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 May 2013 15:00:54 +0200 Original-Received: from localhost ([::1]:56909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXWeT-0002uT-BW for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 May 2013 09:00:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXWeE-0002uH-Ht for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 09:00:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXWeD-0002kt-8a for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 09:00:38 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXWeB-0002kI-5Q; Wed, 01 May 2013 09:00:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UXWed-0006yA-1X; Wed, 01 May 2013 09:01:03 -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 13:01: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.136741325226737 (code B ref -1); Wed, 01 May 2013 13:01:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 May 2013 13:00:52 +0000 Original-Received: from localhost ([127.0.0.1]:53553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXWeR-0006xB-8A for submit@debbugs.gnu.org; Wed, 01 May 2013 09:00:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45500) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXWeO-0006ws-7G for submit@debbugs.gnu.org; Wed, 01 May 2013 09:00:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXWdt-0002gE-IO for submit@debbugs.gnu.org; Wed, 01 May 2013 09:00:19 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:38236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXWdt-0002gA-Fd for submit@debbugs.gnu.org; Wed, 01 May 2013 09:00:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXWdq-0002Tx-J8 for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 09:00:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXWdo-0002f3-E9 for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 09:00:14 -0400 Original-Received: from xvm-90.mit.edu ([18.181.2.90]:43475 helo=mod-relay.xvm.mit.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXWdo-0002ek-BD for bug-gnu-emacs@gnu.org; Wed, 01 May 2013 09:00:12 -0400 Original-Received: by mod-relay.xvm.mit.edu (Postfix) id 13C2723FF1; Wed, 1 May 2013 06:40:19 -0400 (EDT) Original-Received: from mail.muc.de (colin.muc.de [193.149.48.1]) by mod-relay.xvm.mit.edu (Postfix) with ESMTP id B353B23FE6 for ; Wed, 1 May 2013 06:40:18 -0400 (EDT) Original-Received: (qmail 11432 invoked by uid 8); 1 May 2013 12:53:28 -0000 Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 51 Original-NNTP-Posting-Host: news.muc.de Original-X-Trace: colin.muc.de 1367412808 11430 193.149.48.2 (1 May 2013 12:53:28 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: Wed, 1 May 2013 12:53:28 +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 3.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:73867 Archived-At: Achim Gratz wrote: > Publishing from Worg (the community webpages for Org) runs in batch mode > and uses cc-mode for syntax highlighting for some source code examples. > While testing the publishing process with Emacs?24 I've come across an > apparent regression in cc-mode: it tries to use the initial value for > c-standard-font-lock-fontify-region-function, which happens to be nil to > do a funcall and errors out since the function slot of that variable is > void. I've worked around the error by adding this to the init file: > --8<---------------cut here---------------start------------->8--- > ;; to have things work correctly in batch-mode > (require 'font-lock) > (require 'cc-mode) > (c-after-font-lock-init) > --8<---------------cut here---------------end--------------->8--- > I cannot tell if that works correctly in all cases or why this is > necessary, but simply by switching to Emacs?23 it all works correctly > without it. Yes, the c-after-font-lock-init call will initialise everything properly, though it's more a workaround than a solution. 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. 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. 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) . However, you'll probably prefer to carry on with using Font Lock Mode uninitialised. ;-) I think Glenn's patch achieves this painlessly. > Regards, > Achim. -- Alan Mackenzie (Nuremberg, Germany).