unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: Emacs revision #107149
Date: Mon, 13 Feb 2012 22:07:47 +0000	[thread overview]
Message-ID: <20120213220746.GF26954@acm.acm> (raw)
In-Reply-To: <87aa4m5tv1.fsf@gnus.org>

Hi, Lars.

On Mon, Feb 13, 2012 at 10:03:14PM +0100, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm@muc.de> writes:

> >> Why not just call `(default-value 'font-lock-fontify-region-function)'
> >> unconditionally?

> > It's unclean programming, and won't work properly under XEmacs.

> You may well be right, but looking at the code, I don't really see why.
> There's one single consumer of
> `c-standard-font-lock-fontify-region-function'?  There's one single
> place it's set?  If it isn't set, the function breaks unconditionally?

> Or is it set to something else under XEmacs (in code that's not in the
> Emacs 24 tree)?

No, it's identical in XEmacs.

Anyhow, you've neglected to address the main points in my last post.
Would you please do so now:


>>Try this instead: It solves the actual problem stated in the comment,
>>rather than papering over it:


>>*** mm-view.el~	2012-02-08 14:25:18.000000000 +0000
>>--- mm-view.el	2012-02-12 21:50:34.000000000 +0000
>>***************
>>*** 601,610 ****
>>        (require 'font-lock)
>>        ;; I find font-lock a bit too verbose.
>>        (let ((font-lock-verbose nil)
>>! 	    (font-lock-support-mode nil))
>>  	;; Disable support modes, e.g., jit-lock, lazy-lock, etc.
>>  	;; Note: XEmacs people use `font-lock-mode-hook' to run those modes.
>>! 	(set (make-local-variable 'font-lock-mode-hook) nil)
>>          (setq buffer-file-name (mm-handle-filename handle))
>>          (set (make-local-variable 'enable-local-variables) nil)
>>  	(with-demoted-errors
>>--- 601,612 ----
>>        (require 'font-lock)
>>        ;; I find font-lock a bit too verbose.
>>        (let ((font-lock-verbose nil)
>>! 	    (font-lock-support-mode nil)
>>! 	    (font-lock-mode-hook font-lock-mode-hook))
>>  	;; Disable support modes, e.g., jit-lock, lazy-lock, etc.
>>  	;; Note: XEmacs people use `font-lock-mode-hook' to run those modes.
>>! 	(remove-hook 'font-lock-mode-hook 'turn-on-fast-lock)
>>! 	(remove-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
>>          (setq buffer-file-name (mm-handle-filename handle))
>>          (set (make-local-variable 'enable-local-variables) nil)
>>  	(with-demoted-errors

So, how about this patch?  Would it work for what you need to do?  As
yet, I've no clear understanding of what your mode is trying to do here,
or why.  I'd appreciate you filling in the gaps for me.

>>But, do you actually have to suppress these support modes?  They're there
>>to fontify text screens faster.  Why disable them?  Nowadays, with faster
>>HW than ever, it seems pointless even to bother.  You've admitted, I
>>think, that you don't know why that code is there.  You could just rip it
>>out.

>>> > Again, why are you breaking these hook calls?  This seems to be a very
>>> > bad solution to whatever the problem was.

>>> It works for all modes tested, except C mode, apparently.

>>How do you know?  font-lock-mode-hook is used by hi-lock mode,
>>cperl-mode, sql mode, ada mode, verilog mode, and CC Mode.  One of these
>>is definitely being broken.  The others probably are, if you ever use
>>them.

Have you individually checked any of the other modes you might use, to
make sure that they don't get fouled up by not calling their
font-lock-mode-hooks?

>>The point is, you are reaching into other major modes and messing them
>>up to an unknown extent.  This is not good programming practice.

This is the main point.  You are knowingly sabotaging the initialisation
of modes that you use.  This is bad.  Please respond to this point.


Evening, Lars.

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2012-02-13 22:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 23:20 Emacs revision #107149 Alan Mackenzie
2012-02-11 15:56 ` Lars Ingebrigtsen
2012-02-11 18:07   ` Wolfgang Jenkner
2012-02-11 19:59   ` Alan Mackenzie
2012-02-12 20:42     ` Lars Ingebrigtsen
2012-02-12 22:22       ` Alan Mackenzie
2012-02-13  1:00         ` Wolfgang Jenkner
2012-02-13 21:35           ` Alan Mackenzie
2012-02-13  3:15         ` Stefan Monnier
2012-02-13 21:42           ` Alan Mackenzie
2012-02-13 22:18             ` Stefan Monnier
2012-02-13 21:03         ` Lars Ingebrigtsen
2012-02-13 22:07           ` Alan Mackenzie [this message]
2012-02-20  9:51             ` Lars Ingebrigtsen
2012-02-21 15:16               ` Alan Mackenzie

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=20120213220746.GF26954@acm.acm \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).