emacs-devel
[Top][All Lists]
Advanced

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

Re: Undo-limit default


From: Chong Yidong
Subject: Re: Undo-limit default
Date: Sun, 07 Dec 2008 09:32:39 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

martin rudalics <address@hidden> writes:

>> I thought that the `fontified' property did not go into the undo-list.
>> Are not the calls changing that property surrounded by macros that
>> should prevent that?
>
> Only those of font-lock itself.
>
>> What major modes do you see this in?
>
> All font-locked ones.  The property is stored as a text property and
> shows up whenever you delete or reinsert corresponding text.
>
> IMHO putting any font-lock handled property on the undo-list is harmful.

Could you check whether stripping out the font-lock information has any
bad effects?  The following untested patch should implement this
behavior:

*** trunk/src/undo.c.~1.86.~    2008-09-22 11:47:50.000000000 -0400
--- trunk/src/undo.c    2008-12-07 09:25:53.000000000 -0500
***************
*** 60,65 ****
--- 60,69 ----
  
  int undo_inhibit_record_point;
  
+ /* Text properties not recorded in the undo list.  */
+ 
+ Lisp_Object Vundo_discarded_text_properties;
+ 
  /* Record point as it was at beginning of this command (if necessary)
     and prepare the undo info for recording a change.
     PT is the position of point that will naturally occur as a result of the
***************
*** 171,176 ****
--- 175,184 ----
  {
    Lisp_Object sbeg;
  
+   string = Fremove_text_properties (0, SCHARS (string),
+                                   Vundo_discarded_text_properties,
+                                   string);
+ 
    if (EQ (current_buffer->undo_list, Qt))
      return;
  
***************
*** 734,739 ****
--- 742,756 ----
    DEFVAR_BOOL ("undo-inhibit-record-point", &undo_inhibit_record_point,
               doc: /* Non-nil means do not record `point' in 
`buffer-undo-list'.  */);
    undo_inhibit_record_point = 0;
+ 
+   DEFVAR_INT ("undo-discarded-text-properties", 
&Vundo_discarded_text_properties,
+             doc: /* Text properties not recorded in the undo list.
+ This should be a property list whose property names specify the
+ properties to remove.  (The values stored in the property list are
+ ignored.)  */);
+   Vundo_discarded_text_properties = list4 (intern("fontified nil"), Qnil,
+                                          intern ("jit-lock-defer-multiline"), 
Qnil);
+   staticpro (&Vundo_discarded_text_properties);
  }
  
  /* arch-tag: d546ee01-4aed-4ffb-bb8b-eefaae50d38a




reply via email to

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