emacs-devel
[Top][All Lists]
Advanced

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

Re: Should invisible imply intangible?


From: Stefan Monnier
Subject: Re: Should invisible imply intangible?
Date: Sun, 03 Mar 2002 12:11:18 -0500

>     Also, as David Kastrup has mentioned repeatedly, intangible text tends
>     to break lots of things...
> 
> I don't think so.

Please, Richard, try to remember the lengthy discussion we've had about that.
The problem is that the vast majority of elisp code does not expect to
bump into a piece of intangible text and misbehaves when it happens.
In practice, it's generally a non-issue because most uses of intangible
text are restricted to a particular context so that this intangible
text is only accessed by a small body of elisp code.

>     For example: automatically move point to a visible area after each command
>     (and after post-command-hook, of course) or during redisplay (I believe
>     there is already such a feature for text with a `display' property).
> 
> If we can find some better way to move point out of certain text than
> what `intangible' does now, perhaps we should redefine the meaning of
> `intangible'.  But I think it breaks only a few things, occasionally.
> I think it is pretty good.

I think the current semantics of `intangible' is not useless and
until we can come up with something clearly superior, we shouldn't
change it.

I.e. what I suggest is more like the patch below (100% untested),
which extends the treatment of the `composition' and `display' properties
to `invisible'.


        Stefan


Index: keyboard.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v
retrieving revision 1.659
diff -u -u -b -r1.659 keyboard.c
--- keyboard.c  23 Feb 2002 22:02:18 -0000      1.659
+++ keyboard.c  3 Mar 2002 17:08:25 -0000
@@ -1750,7 +1750,7 @@
 {
   int start, end;
   Lisp_Object val;
-  int check_composition = 1, check_display = 1;
+  int check_composition = 1, check_display = 1, check_invisible = 1;
 
   while (check_composition || check_display)
     {
@@ -1766,8 +1766,24 @@
          else
            SET_PT (end);
          check_display = 1;
+         check_invisible = 1;
        }
       check_composition = 0;
+      if (check_invisible
+         && PT > BEGV && PT < ZV
+         && get_property_and_range (PT, Qinvisible, &val, &start, &end, Qnil)
+         && TEXT_PROP_MEANS_INVISIBLE (val)
+         && start < PT && end > PT
+         && (last_pt <= start || last_pt >= end))
+       {
+         if (PT < last_pt)
+           SET_PT (start);
+         else
+           SET_PT (end);
+         check_composition = 1;
+         check_display = 1;
+       }
+      check_invisible = 0;
       if (check_display
          && PT > BEGV && PT < ZV
          && get_property_and_range (PT, Qdisplay, &val, &start, &end, Qnil)
@@ -1780,6 +1796,7 @@
          else
            SET_PT (end);
          check_composition = 1;
+         check_invisible = 1;
        }
       check_display = 0;
     }




reply via email to

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