all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Undo-limit default
@ 2008-12-07  1:35 Chong Yidong
  2008-12-07  2:06 ` Michael Ekstrand
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Chong Yidong @ 2008-12-07  1:35 UTC (permalink / raw)
  To: emacs-devel

A user reported bug#1501 after inadvertently encountering the undo
limit.  The default is 20kb.  Does anyone on this list find this too
low, considering how much memory computers possess these days?

(I personally don't feel strongly about this either way, but I can see
how it can be surprising to users.  These days, other programs seem to
store much more undo information.)




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07  1:35 Undo-limit default Chong Yidong
@ 2008-12-07  2:06 ` Michael Ekstrand
  2008-12-07  2:12 ` Lennart Borgman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Michael Ekstrand @ 2008-12-07  2:06 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

Chong Yidong <cyd@stupidchicken.com> writes:
> A user reported bug#1501 after inadvertently encountering the undo
> limit.  The default is 20kb.  Does anyone on this list find this too
> low, considering how much memory computers possess these days?

This is totally subjective, but I seem to have a vague memory of running
in to the undo limit sometime in the last few months.  It doesn't happen
very often, though, and in cases where I'm likely to use that much undo
I'm just as likely to do a VCS revert.

> (I personally don't feel strongly about this either way, but I can see
> how it can be surprising to users.  These days, other programs seem to
> store much more undo information.)

Increasing the default a bit probably can't hurt IMO.  Out of curiosity,
is this limit global or per-buffer?  The documentation for `undo-limit'
doesn't say, and the relevant section in the Emacs manual doesn't
clearly state it either.

- Michael

-- 
mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange files?  I cryptographically sign my messages.
For more information see <http://www.elehack.net/resources/gpg>.

[-- Attachment #2: Type: application/pgp-signature, Size: 196 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07  1:35 Undo-limit default Chong Yidong
  2008-12-07  2:06 ` Michael Ekstrand
@ 2008-12-07  2:12 ` Lennart Borgman
  2008-12-07  8:15 ` Dan Nicolaescu
  2008-12-07 13:02 ` martin rudalics
  3 siblings, 0 replies; 16+ messages in thread
From: Lennart Borgman @ 2008-12-07  2:12 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

On Sun, Dec 7, 2008 at 2:35 AM, Chong Yidong <cyd@stupidchicken.com> wrote:
> A user reported bug#1501 after inadvertently encountering the undo
> limit.  The default is 20kb.  Does anyone on this list find this too
> low, considering how much memory computers possess these days?

How much memory does that consume?

> (I personally don't feel strongly about this either way, but I can see
> how it can be surprising to users.  These days, other programs seem to
> store much more undo information.)

Emacs should be best, shouldn't it? Seriously, if it is surprising to
users isn't it to low then?




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07  1:35 Undo-limit default Chong Yidong
  2008-12-07  2:06 ` Michael Ekstrand
  2008-12-07  2:12 ` Lennart Borgman
@ 2008-12-07  8:15 ` Dan Nicolaescu
  2008-12-07 13:02 ` martin rudalics
  3 siblings, 0 replies; 16+ messages in thread
From: Dan Nicolaescu @ 2008-12-07  8:15 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

  > A user reported bug#1501 after inadvertently encountering the undo
  > limit.  The default is 20kb.  Does anyone on this list find this too
  > low, considering how much memory computers possess these days?

I do, I had to increase it in my .emacs a while ago because I kept
hitting the limit.  But I don't have any suggestion what a good value
would be.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07  1:35 Undo-limit default Chong Yidong
                   ` (2 preceding siblings ...)
  2008-12-07  8:15 ` Dan Nicolaescu
@ 2008-12-07 13:02 ` martin rudalics
  2008-12-07 13:10   ` Lennart Borgman
  3 siblings, 1 reply; 16+ messages in thread
From: martin rudalics @ 2008-12-07 13:02 UTC (permalink / raw)
  To: emacs-devel

 > A user reported bug#1501 after inadvertently encountering the undo
 > limit.  The default is 20kb.  Does anyone on this list find this too
 > low, considering how much memory computers possess these days?

For some years I use

  '(undo-limit 200000)
  '(undo-outer-limit 300000)
  '(undo-strong-limit 300000)

but I don't understand why we keep font-lock assigned properties (in
particular the completely useless 'fontified property) on the undo-list.
Here these usually account for more than 90% of all entries.

martin





^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 13:02 ` martin rudalics
@ 2008-12-07 13:10   ` Lennart Borgman
  2008-12-07 13:20     ` martin rudalics
  0 siblings, 1 reply; 16+ messages in thread
From: Lennart Borgman @ 2008-12-07 13:10 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

On Sun, Dec 7, 2008 at 2:02 PM, martin rudalics <rudalics@gmx.at> wrote:
> but I don't understand why we keep font-lock assigned properties (in
> particular the completely useless 'fontified property) on the undo-list.
> Here these usually account for more than 90% of all entries.

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?

What major modes do you see this in?




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 13:10   ` Lennart Borgman
@ 2008-12-07 13:20     ` martin rudalics
  2008-12-07 14:32       ` Chong Yidong
  0 siblings, 1 reply; 16+ messages in thread
From: martin rudalics @ 2008-12-07 13:20 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: emacs-devel

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

martin




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 13:20     ` martin rudalics
@ 2008-12-07 14:32       ` Chong Yidong
  2008-12-07 14:53         ` Chong Yidong
                           ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Chong Yidong @ 2008-12-07 14:32 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lennart Borgman, emacs-devel

martin rudalics <rudalics@gmx.at> 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




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 14:32       ` Chong Yidong
@ 2008-12-07 14:53         ` Chong Yidong
  2008-12-08 11:48           ` Richard M Stallman
  2008-12-07 14:59         ` martin rudalics
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Chong Yidong @ 2008-12-07 14:53 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lennart Borgman, emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

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

BTW, I don't think such a change should go into Emacs 23.1; it might be
worth doing after the release.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 14:32       ` Chong Yidong
  2008-12-07 14:53         ` Chong Yidong
@ 2008-12-07 14:59         ` martin rudalics
  2008-12-07 15:07         ` Chong Yidong
  2008-12-07 20:59         ` Stefan Monnier
  3 siblings, 0 replies; 16+ messages in thread
From: martin rudalics @ 2008-12-07 14:59 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Lennart Borgman, emacs-devel

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

Crashes Emacs at the time I delete text in a buffer.  I can look into
this later.

BTW, I suppose you mean that font-lock should add all face and extra
properties too when it's active in a buffer.

martin




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 14:32       ` Chong Yidong
  2008-12-07 14:53         ` Chong Yidong
  2008-12-07 14:59         ` martin rudalics
@ 2008-12-07 15:07         ` Chong Yidong
  2008-12-07 17:04           ` martin rudalics
  2008-12-07 20:59         ` Stefan Monnier
  3 siblings, 1 reply; 16+ messages in thread
From: Chong Yidong @ 2008-12-07 15:07 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lennart Borgman, emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

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

Whoops, too untested :-P

Try this patch instead:

*** trunk/src/undo.c.~1.86.~	2008-09-24 23:23:04.000000000 -0400
--- trunk/src/undo.c	2008-12-07 10:05:52.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
***************
*** 174,179 ****
--- 178,187 ----
    if (EQ (current_buffer->undo_list, Qt))
      return;
  
+   Fremove_text_properties (make_number (0), make_number (SCHARS (string)),
+ 			   Vundo_discarded_text_properties,
+ 			   string);
+ 
    if (PT == beg + SCHARS (string))
      {
        XSETINT (sbeg, -beg);
***************
*** 734,739 ****
--- 742,757 ----
    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_LISP ("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"), Qnil,
+ 	     intern ("jit-lock-defer-multiline"), Qnil);
+   staticpro (&Vundo_discarded_text_properties);
  }
  
  /* arch-tag: d546ee01-4aed-4ffb-bb8b-eefaae50d38a




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 15:07         ` Chong Yidong
@ 2008-12-07 17:04           ` martin rudalics
  0 siblings, 0 replies; 16+ messages in thread
From: martin rudalics @ 2008-12-07 17:04 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

 > Try this patch instead:

This works.  I can do

     (set (make-local-variable 'undo-discarded-text-properties)
	 (append undo-discarded-text-properties
		 (if font-lock-syntactic-keywords
		     '(syntax-table nil face nil font-lock-multiline nil)
		   '(face nil font-lock-multiline nil))))

in `font-lock-set-defaults'.

Thanks, martin.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 14:32       ` Chong Yidong
                           ` (2 preceding siblings ...)
  2008-12-07 15:07         ` Chong Yidong
@ 2008-12-07 20:59         ` Stefan Monnier
  2008-12-08 18:26           ` Richard M Stallman
  3 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2008-12-07 20:59 UTC (permalink / raw)
  To: Chong Yidong; +Cc: martin rudalics, Lennart Borgman, emacs-devel

> +   string = Fremove_text_properties (0, SCHARS (string),
> + 				    Vundo_discarded_text_properties,
> + 				    string);

I wonder:
- Why use an alist rather than a list.
- I.e. why use Fremove_text_properties rather than
  Fremove_list_of_text_properties?
- Why isn't one of those two functions implemented by calling the other one?
- And why is the code of the two functions different?


        Stefan




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 14:53         ` Chong Yidong
@ 2008-12-08 11:48           ` Richard M Stallman
  0 siblings, 0 replies; 16+ messages in thread
From: Richard M Stallman @ 2008-12-08 11:48 UTC (permalink / raw)
  To: Chong Yidong; +Cc: rudalics, lennart.borgman, emacs-devel

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

    BTW, I don't think such a change should go into Emacs 23.1; it might be
    worth doing after the release.

That depends on how much it affects performance.  I have noticed
lots of garbage collection during font lock processing.
Is this the reason why?  Does fixing this lead to a big speedup?




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-07 20:59         ` Stefan Monnier
@ 2008-12-08 18:26           ` Richard M Stallman
  2008-12-08 19:59             ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Richard M Stallman @ 2008-12-08 18:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: rudalics, cyd, lennart.borgman, emacs-devel

    - Why use an alist rather than a list.

I think Joe Arceneaux did it that way just to have parallel calling
conventions for several functions.

Someone later added `remove-list-of-text-properties' which is similar but
takes a list of property names.

It would be possible to implement `remove-list-of-text-properties' by
consing up an alist and calling `remove-text-properties', but that
would be wasteful consing.  The inverse would also be wasteful
consing.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Undo-limit default
  2008-12-08 18:26           ` Richard M Stallman
@ 2008-12-08 19:59             ` Stefan Monnier
  0 siblings, 0 replies; 16+ messages in thread
From: Stefan Monnier @ 2008-12-08 19:59 UTC (permalink / raw)
  To: rms; +Cc: rudalics, cyd, lennart.borgman, emacs-devel

>     - Why use an alist rather than a list.
> I think Joe Arceneaux did it that way just to have parallel calling
> conventions for several functions.

I meant in the new code, not in remove-text-properties.

> It would be possible to implement `remove-list-of-text-properties' by
> consing up an alist and calling `remove-text-properties', but that
> would be wasteful consing.  The inverse would also be wasteful
> consing.

The current duplication of code (worse yet: it's not actually identical)
is a problem.  I'd rather have some extra consing (and just mark the
consing one as obsolete).  And I'm pretty sure we can also remove the
duplication without adding extra consing.


        Stefan




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-12-08 19:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-07  1:35 Undo-limit default Chong Yidong
2008-12-07  2:06 ` Michael Ekstrand
2008-12-07  2:12 ` Lennart Borgman
2008-12-07  8:15 ` Dan Nicolaescu
2008-12-07 13:02 ` martin rudalics
2008-12-07 13:10   ` Lennart Borgman
2008-12-07 13:20     ` martin rudalics
2008-12-07 14:32       ` Chong Yidong
2008-12-07 14:53         ` Chong Yidong
2008-12-08 11:48           ` Richard M Stallman
2008-12-07 14:59         ` martin rudalics
2008-12-07 15:07         ` Chong Yidong
2008-12-07 17:04           ` martin rudalics
2008-12-07 20:59         ` Stefan Monnier
2008-12-08 18:26           ` Richard M Stallman
2008-12-08 19:59             ` Stefan Monnier

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.