unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
To: alinsoar@voila.fr
Cc: "Emacs   Dev  \[emacs-devel\]" <emacs-devel@gnu.org>
Subject: Re: Watchpoints for emacs lisp.
Date: Tue, 11 May 2010 21:53:17 -0400	[thread overview]
Message-ID: <C52C2902-5F09-4418-BC32-862DFFDCD34B@raeburn.org> (raw)
In-Reply-To: <8371144.1993831273586052309.JavaMail.www@wwinf4619>

On May 11, 2010, at 09:54, A. Soare wrote:
>>> I insert to the struct Lisp_Symbol a field :watched: .
>> 
>> So, no support for watching for an element of an array or pair to be changed, or part of a string?
> 
> Hm... I thought only to symbols, true. Not to arrays, not to numbers.
> 
> Can you use the change of an array if a symbol does not point to it? Probably yes. There exist lambda function (functions without name), but probably one can debug also the change of an array without name.

The 'aset' function can change an element of a vector or string (or certain other objects), in place.  So any existing references to the containing vector/string/whatever will now see the new element.  Similarly, setcar and setcdr can change the values contained within a cell that may be referred to elsewhere, and the change will be visible.  This isn't the case with numbers, as numbers can't act as containers or references for other values.

>> What about changes to the property list, or function value, of a symbol?
>> 
> 
> Can you figure an algorithm for checking very fast (O (0)) whether a symbol has a given property ?

I don't think that matters.  You could have the flag on the symbol indicate that the handler should be called if *any* of the slots are changed (function, value, plist, aliasing, becoming buffer-local, etc).  The property list may be changed by changing the 'plist' field in the C structure, which would be noticed by the above mechanism, or it can be changed by altering elements of the list stored in the 'plist' field.  If you make it possible to watch for changes to a cons cell, though, that could be applied to the (original) property list itself.  (Managing that and figuring out when to stop watching those cells could be tricky, but the fundamentals would be there.)

However, I don't think there's any spare room in a cons cell allocation at the moment.  Doing this efficiently, and ideally without getting too intimate with the garbage collection system, could be difficult... perhaps watching symbols would suffice for a first cut, and cons cells could be worked on later if desired.  (But I'd still suggest you have the watchpoint trigger for changes to *any* field of a symbol, not just the 'value' field.)

Ken


  reply	other threads:[~2010-05-12  1:53 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11 13:54 Watchpoints for emacs lisp A. Soare
2010-05-12  1:53 ` Ken Raeburn [this message]
2010-05-12  2:04 ` Stephen J. Turnbull
  -- strict thread matches above, loose matches on Subject: below --
2010-05-10 16:28 alin.s
2010-05-11 11:59 ` Richard Stallman
2010-05-11 12:54   ` alin.s
2010-05-11 13:43     ` Ken Raeburn
2010-05-11 14:10     ` Stefan Monnier
2010-05-11 15:37       ` alin.s
2010-05-15 11:16       ` alin.s
2010-05-15 11:24         ` alin.s
2010-05-15 11:44           ` alin.s
2010-05-15 11:56             ` alin.s
2010-05-15 12:43               ` Helmut Eller
2010-05-15 13:06                 ` alin.s
2010-05-15 17:48             ` Stefan Monnier
2010-05-16 13:07               ` alin.s
2010-05-16 13:09                 ` Lennart Borgman
2010-05-16 13:42                   ` alin.s
2010-05-16 16:28                     ` Lennart Borgman
2010-05-16 19:46                       ` alin.s
2010-05-16 20:42                 ` Stefan Monnier
2010-05-16 21:10                   ` alin.s
2010-05-17 13:24                     ` Stefan Monnier
2010-05-15 12:15           ` Andreas Schwab
2010-05-15 17:43         ` Stefan Monnier
2010-05-16 13:05           ` alin.s
2010-05-16 15:03             ` Chad Brown
2010-05-16 19:44               ` alin.s
2010-05-16 21:31               ` alin.s
2010-05-16 22:38                 ` alin.s
2010-05-16 23:47                 ` Lennart Borgman
2010-05-16 23:56                   ` alin.s
2010-05-17 15:52                   ` alin.s
2010-05-17 16:09                     ` Lennart Borgman
2010-05-17 16:40                       ` alin.s
2010-05-17 17:00                         ` Lennart Borgman
2010-05-17 17:29                           ` alin.s
2010-05-17 18:39                             ` alin.s
2010-05-17 18:41                               ` alin.s
2010-05-17 20:22                                 ` alin.s
2010-05-17 18:59                               ` Eli Zaretskii
2010-05-17 19:04                                 ` Lennart Borgman
2010-05-17 19:00                               ` Chad Brown
2010-05-18  8:22                                 ` Adrian Robert
2010-05-18 19:46                                   ` Chad Brown
2010-05-18 22:38                                     ` Andreas Schwab
2010-05-24 14:36                                       ` alin.s
2010-05-24 14:46                                         ` Ken Raeburn
2010-05-26  8:27                                           ` alin.s
2010-05-24 15:12                                         ` alin.s
2010-05-24 17:36                                           ` Jan Djärv
2010-05-24 17:47                                           ` Stefan Monnier
2010-05-26 10:38                                             ` alin.s
2010-05-26 13:46                                               ` Stefan Monnier
2010-05-26 16:49                                                 ` alin.s
2010-05-27 14:08                                                   ` alin.s
2010-05-27 22:05                                                     ` Andreas Schwab
2010-05-28 20:09                                                       ` alin.s
2010-07-06 12:26                                                         ` alin.s
2010-08-10 11:00                                                           ` Stefan Monnier
2010-05-29  4:25                                                       ` tomas
2010-05-19  4:30                                   ` Ken Raeburn
2010-05-19  6:20                                     ` Adrian Robert
2010-05-17 19:56                               ` Andreas Schwab

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=C52C2902-5F09-4418-BC32-862DFFDCD34B@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=alinsoar@voila.fr \
    --cc=emacs-devel@gnu.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).