emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: jit-lock.el


From: Stefan
Subject: Re: jit-lock.el
Date: Sun, 10 Oct 2004 01:32:20 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin)

> Is anyone investigating this bug report?

I just looked at it.

> To: address@hidden
> From: Karl Chen <address@hidden>
> Date: Tue, 22 Jun 2004 01:43:16 -0700
> Subject: another jit-lock bug
> Reply-To: address@hidden
> Sender: address@hidden


> emacs -q

> (global-set-key "\r" (lambda () (interactive) (newline)
> (indent-according-to-mode)))
> (global-font-lock-mode)
> (setq font-lock-support-mode 'jit-lock-mode)

> C-x C-f /tmp/a.sh

> if true ; then
>     # when you press return here, auto indent succeeds
> fi

> case z in
>     asdf)
> # auto indent fails here only when font-lock-support-mode is
> # jit-lock-mode, using (indent-according-to-mode) as part of an # interactive 
> key (if you manually evaluate # (indent-according-to-mode) it works)

Here's what happens.  The `)' right after `asdf' has a syntax-table text
property of ".".  If you put point right after it and do (newline), the
newline you inset inherits the "." property.  That incorrect property is
removed next time font-lock is invoked, i.e. immediately (with
font-lock-support-mode) or after the current command is finished (without
font-lock-support-mode).  If you call indent-according-to-mode as part of
the same command, the indentation code gets confused by this transient
newline-with-punctuation-syntax.

I think the best solution is the one below.  Any objection?
I really can't think of any case where the syntax-table text-property should
be sticky, but it may just be a lack of imagination.


        Stefan


--- textprop.c  18 May 2004 10:10:08 -0400      1.138
+++ textprop.c  10 Oct 2004 01:23:30 -0400      
@@ -1,5 +1,5 @@
 /* Interface code for dealing with text properties.
-   Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003
+   Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -2233,7 +2233,9 @@
 the character doesn't inherit PROPERTY if NONSTICKINESS is non-nil,
 inherits it if NONSTICKINESS is nil.  The front-sticky and
 rear-nonsticky properties of the character overrides NONSTICKINESS.  */);
-  Vtext_property_default_nonsticky = Qnil;
+  /* Text property `syntax-table' should be nonsticky by default.  */
+  Vtext_property_default_nonsticky
+    = Fcons (Fcons (intern ("syntax-table"), Qt), Qnil);
 
   staticpro (&interval_insert_behind_hooks);
   staticpro (&interval_insert_in_front_hooks);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]